Libraries maintenanced by wikimedia should declare strict types to ensure correct types are used on function calls to php internal functions or on function calls within the library.
This is about adding declare( strict_types = 1 ); to all php files of the libraries and enable the Generic.PHP.RequireStrictTypes sniff of the squizlabs/php_codesniffer package (via mediawiki/mediawiki-codesniffer).
Declaring strict types means that PHP will no longer automatically cast wrong scalar variables to the expected type, functions will require the correct type to be called.
Strict typing applies to function calls made from within the file with strict typing enabled, not to the functions declared within that file. If a file without strict typing enabled makes a call to a function that was defined in a file with strict typing, the caller's preference (weak typing) will be respected, and the value will be coerced.
This can catch subtle bugs on runtime (by running tests), that are not catched by phan already (stricter mode possible, see T385060). Libraries with a good code coverage benefits more from this approch for the runtime.
There is a small risk that the library throws TypeError for internal typed functions for untested scenario after a new version is released/deployed, but that is not a breaking change.
There is no performance impact as the type check already is done, but instead of doing a cast, now a TypeError is thrown.
There could be a performance benefit (on language level) on newer php versions that use the type information to remove extra checks (as part of a JIT).
This is indented to be done as a mass bulk change. There is no need to build a release for each of this library as this is only for internal calls and can be released on the usually release plan of the affected library (if any release plan exists).