Skip to content

Instantly share code, notes, and snippets.

@carusogabriel
Created April 15, 2020 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carusogabriel/e0b36e7cd9e6846e04f79008cb7e35d6 to your computer and use it in GitHub Desktop.
Save carusogabriel/e0b36e7cd9e6846e04f79008cb7e35d6 to your computer and use it in GitHub Desktop.
Impact of RFC
wrong native return type of __call(): string
https://github.com/mockery/mockery/blob/05b2459503f7e821295dd22c18d206d3e49d957b/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php#L349
wrong native return type of __callstatic(): int
https://github.com/mockery/mockery/blob/05b2459503f7e821295dd22c18d206d3e49d957b/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php#L353
wrong native return type of __call(): string
https://github.com/mockery/mockery/blob/05b2459503f7e821295dd22c18d206d3e49d957b/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php#L380
wrong native return type of __call(): int
https://github.com/mockery/mockery/blob/05b2459503f7e821295dd22c18d206d3e49d957b/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php#L382
wrong native return type of __call(): void
https://github.com/cakephp/cakephp/blob/8718b2e9bbd092b991a1da6472d1a28e89b63dac/src/Controller/Component/FlashComponent.php#L137
wrong native return type of __get(): void
https://github.com/sebastianbergmann/object-enumerator/blob/9bb439a4522a4ea30382861dfb87653c4f4b375b/tests/_fixture/ExceptionThrower.php#L23
wrong native return type of __call(): string
https://github.com/solariumphp/solarium/blob/500018020f7dc34f29cfc474ca0432ae22772640/src/QueryType/Stream/ExpressionBuilder.php#L251
@carusogabriel
Copy link
Author

carusogabriel commented Apr 15, 2020

This result was only possible thanks to @nikic's script: https://gist.github.com/nikic/a2bfa3e2f604f66115c3e4b8963a6c72.

@nicolas-grekas
Copy link

To me, none of those look like actual bugs. LSP allows narrowing the return type, this looks like what's happening here.

@carusogabriel
Copy link
Author

@nicolas-grekas Indeed, even __get() fits under the LSP. I'll update the RFC 👍

@carusogabriel
Copy link
Author

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