More precise RecursiveIteratorIterator::__construct() types#2835
More precise RecursiveIteratorIterator::__construct() types#2835ondrejmirtes merged 5 commits intophpstan:1.10.xfrom
RecursiveIteratorIterator::__construct() types#2835Conversation
|
This pull request has been marked as ready for review. |
stubs/iterable.stub
Outdated
There was a problem hiding this comment.
I'd put this in resources/functionMap_bleedingEdge.php.
There was a problem hiding this comment.
initially I tried that, too. turns out I need a mix of both, as the constants were missing on the stub.
There was a problem hiding this comment.
in the first iteration of this PR I tried adding it to resources/functionMap_bleedingEdge.php and did not succeed (without the additional change in iterable stub). now with the PR as is it works
There was a problem hiding this comment.
I'm interested in why you didn't succeeed. It should be fine.
b0676ac to
ff4faed
Compare
|
phpstan-symfony errors are fixed with phpstan/phpstan-symfony#375 |
stubs/iterable.stub
Outdated
There was a problem hiding this comment.
it seems as soon as I keep these phpdocs here, the signature from resources/functionMap_bleedingEdge.php does not work, as it starts failling
There was 1 failure:
1) PHPStan\Rules\Classes\InstantiationRuleTest::testBug10324
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'23: Parameter #3 $flags of class RecursiveIteratorIterator constructor expects 0|16, 2 given.
+'
'
/Users/staabm/workspace/phpstan-src/src/Testing/RuleTestCase.php:159
/Users/staabm/workspace/phpstan-src/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php:466
|
Makes sense now, thank you. |
I had initially implemented it with a separate
StubFilesExtensionto load this more precise signature only in bleedingEdge.later on I realized most iterator implemetations already use pretty narrow $flags/$mode types, therefore I went just with this more precise types.
closes phpstan/phpstan#10324