Skip to content

Since 1.8.4, phpstan is loosing array shape #7954

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

Closed
VincentLanglet opened this issue Sep 7, 2022 · 2 comments
Closed

Since 1.8.4, phpstan is loosing array shape #7954

VincentLanglet opened this issue Sep 7, 2022 · 2 comments

Comments

@VincentLanglet
Copy link
Contributor

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/08129cae-4688-4ac1-a7ba-4f035d677e3f

In the same way I have an error with
https://github.com/sonata-project/SonataAdminBundle/blob/4.x/tests/Twig/RenderElementRuntimeTest.php#L487-L490

 Method Sonata\AdminBundle\Tests\Twig\RenderElementRuntimeTest::getRenderListElementTests() should return array<array{string, string, mixed, array<string,          
         mixed>}> but returns                                                                                                                                               
         non-empty-array<0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51  
         |52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|  
         104, non-empty-array<int, 0|10.746135|51.23456|5678|array<int|(literal-string&non-falsy-string), array<literal-string&non-falsy-string,                            
         array<literal-string&non-falsy-string,                                                                                                                             
         literal-string&non-falsy-string>|bool|int|(literal-string&non-falsy-string)>|bool|(literal-string&non-falsy-string)>|bool|DateTime|Sonata\AdminBundle\Tests\Fixtu  
         res\Enum\Suit|non-falsy-string|null>>.

Expected output

No error, like in all previous versions.

@gjuric
Copy link

gjuric commented Sep 7, 2022

Hitting the same issue, it looks like every time there is an if statement types get duplicated with new information and after a while it looses information, probably simpler example can be found here.

I am also seeing "&hasOffsetValue" in the debug output after a while.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants