How to teach phpstan what´s behind my $GLOBALS #4277
sabbelasichon
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi, you can't hook into that right now. I'd recommend you to first refactor away from $GLOBALS, you'll be able to typehint your code in a much nicer way :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a set of rules to rewrite the CMS TYPO3 with RectorPHP. TYPO3 still uses a lot of $GLOBALS.
There are some $GLOBALS entries which are very important and often used by 3rd party extensions. For example $GLOBALS['TSFE'].
Is it possible to tell phpstan what type we expect behind it? I couldn´t find anything to hook into like the dynamicMethodReturnTypeExtension.
I cannot expect that every developer uses some kind of Annotation or helper method with a dedicated return type declaration. Often the $GLOBALS are used directly. I know this is all bad practice but i have to deal with it.
Beta Was this translation helpful? Give feedback.
All reactions