vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

non-namespaced @internal annotations should disallow use outside of global namespace #10868

Open kkmuffme opened 7 months ago

kkmuffme commented 7 months ago

Currently @internal annotations on non-namespaced/global namespace functions have no use at all.

Instead methods and properties should be set internal to that class (EDIT: I see this is already implemented for properties)

For classes and functions the behavior should invert to allow them ONLY in global namespace (since we can obviously not restrict them to anything else, since otherwise the class would be restricted to itself, which makes no sense) - these non-namespaced internals generally happen on legacy code and reverting the behavior ensures these won't be used in any "new" code that uses namespaces. https://psalm.dev/r/6907cff962 https://psalm.dev/r/bdc6c78d1a

psalm-github-bot[bot] commented 7 months ago

I found these snippets:

https://psalm.dev/r/6907cff962 ```php
https://psalm.dev/r/bdc6c78d1a ```php