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

@return phpdoc not parsed in some cases starting with phpstan v1.3 #6253

Closed
mvorisek opened this issue Dec 30, 2021 · 17 comments
Closed

@return phpdoc not parsed in some cases starting with phpstan v1.3 #6253

mvorisek opened this issue Dec 30, 2021 · 17 comments

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Dec 30, 2021

Bug report

https://github.com/atk4/core/runs/4665738136?check_suite_focus=true

phpdoc is present, before phpstan v1.3, there were no errors

  ------ --------------------------------------------------------------------- 
  Line   src/AppScopeTrait.php (in context of anonymous class)                
 ------ --------------------------------------------------------------------- 
  78     Method class@anonymous/src/CollectionTrait.php:146::getApp() has no  
         return type specified.                                               
 ------ --------------------------------------------------------------------- 

https://github.com/atk4/core/blob/3.1.0/src/AppScopeTrait.php#L78

@mergeable
Copy link

mergeable bot commented Dec 30, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 3, 2022

closing as I think it will be fixed in the next release thank to #6264

@mvorisek mvorisek closed this as completed Jan 3, 2022
@ondrejmirtes ondrejmirtes reopened this Jan 4, 2022
@ondrejmirtes
Copy link
Member

I don't think this is fixed and I can't reproduce it. Can you please create a small reproducing repository that shows this problem? Thanks.

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 4, 2022

can't reproduce it

Did you tried with atk4/core repo directly? If yes, then it is probably fixed alredy. With phpstan v1.3.0, it is failing, repo script https://github.com/atk4/core/blob/3.1.0/.github/workflows/test-unit.yml#L68 , no special environment needed/used.

@ondrejmirtes
Copy link
Member

I need a minimal reproducing code to see what's the reason and figure out the fix. I'm really busy, I'm relying on the bug reporters to provide those. It's their job if they want the problem fixed.

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 4, 2022

I belive it has something to do with this ignore: https://github.com/atk4/core/blob/3.1.0/phpstan.neon.dist#L29

It seems with phpstan v1.3.0+, when the type from phpdoc can not be resolved, it is not parsed at all, IDK.

On phpstan.org, I can not reproduce it, I tried https://phpstan.org/r/899d7388-997d-44a9-a857-f608f8429e93 . Maybe it has to do something with the autoloder/opcache fix (phpstan/phpstan-src@e30f446), IDK.

@ondrejmirtes
Copy link
Member

I'll reopen if you provide what I'm asking for, thanks 😊

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 4, 2022

Ondřej, I tried my best to reproduce on phpstan.org, see post above, but I do not know what causes the issue thus I cannot provide it. I belive it is related to a) ignored unresolved type errors (which is correct and worked prior v1.3.0) b) modified autoloading/analysis of traits.

@ondrejmirtes
Copy link
Member

Try to remove stuff from the repo until it's no longer showing the error, and go one step back to show the error, you'll end up with 2-3 files, commit them to a new repository - now I have something actionable to fix the problem...

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 4, 2022

repro repo: https://github.com/atk4/core/tree/phpstan13issue_6253

there are 4 supersmall files in src/ dir, issue replicable also on different machine/Windows

@ondrejmirtes ondrejmirtes reopened this Jan 4, 2022
@ondrejmirtes
Copy link
Member

Nice, I'm gonna take a look 👍

@ondrejmirtes
Copy link
Member

What's the deal with \Atk4\Ui\App? class? Why it doesn't exist?

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 5, 2022

That class is from atk4/ui, eg. child repo, which should not be included in atk4/core, therefore it is only phpdoced instead of hardly typed. Phpstan errors for no class availability are ignored using phpstan config.

@ondrejmirtes
Copy link
Member

You should rethink your project structure, because the atk4/core repo isn't self-sufficient and cannot be tested/developed on its own, which makes it useless as a separate package...

@ondrejmirtes
Copy link
Member

Anyway, this is fixed: phpstan/phpstan-src@11176c7

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 6, 2022

thank you ❤️

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

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 Feb 7, 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