Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native return types where possible #10547

merged 9 commits into from Feb 21, 2022

Add native return types where possible #10547

merged 9 commits into from Feb 21, 2022


Copy link

@Seldaek Seldaek commented Feb 18, 2022

Thanks to @dseguy using some of his tech I got a list of ~100 classes/interfaces which are extended by the ~2500 packages requiring composer/composer. This allowed me to avoid touching public/protected methods for these, to hopefully mostly avoid breakage in third party packages due to the added return types.

Other files as well as tests have had all their return types added.

The other potential problem point is in 84f0f19 which splits some of Composer\Composer into a base class Composer\PartialComposer for global instances which are not fully loaded for perf reasons. This allows the code here to remain simpler with less nullable properties/getters, but it may have some impact tho that's harder to predict.

The goal here anyway is to ship this out and then promptly undo any return type which causes too much unintended pain. It's the best compromise I've found between doing nothing and doing a hard break for 3.0 forcing all plugins to be updated again.

Copy link

@mroforolhc mroforolhc commented May 6, 2022

In this pre-release writted that:

Added return types where possible. This will break code that extends ours and does not declare the same return types. For this reason, our most extended classes/interfaces have not been modified to retain BC: Composer\IO*, Composer\Installer*, Composer\Autoload\ClassLoader, Composer\InstalledVersions, Composer\Plugin*, Composer\Repository*, Composer\Util{Filesystem,HttpDownloader,RemoteFilesystem} and a few select others.

but this pull request contains changes in Composer\IO\*. help me to understand, please.

Copy link

@stof stof commented May 6, 2022

Well, NullIO was not considered as being part of the most extended classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants