-
Notifications
You must be signed in to change notification settings - Fork 7.8k
use reflection to determine whether a global constant is deprecated #13570
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
Comments
I don't see a (reasonable) way to get that information. What do you need it for and how were you intending to use it? |
I was looking into phpstan/phpstan#10662 and tried implementing detection of deprecated constants in PHPStan. In the meantime I found that this information is also available on stubs phpdocs. This seems to work in my first prototype, so my initial feature request might no longer be necessary. I need todo a few more tests |
Even if you are able to find a workaround, I think a request makes sense in its own right. But it may need an RFC, perhaps only to cover some reasonable changes to ReflectionClassConstant (ie. how it should probably extend the new class). See also the typed_constants RFC, which covered both class-level and global-level constants in reflection, but it seems the half supporting global constants never materialized. There have also been a few times a "ReflectionConstant" has been raised in the past, such as request #45569, but they all seemed to fixate on class constants only. |
you can set own error handler and detect raised warning - https://3v4l.org/M1cgh
what do you expect, how would that info be defineable for user constants? |
@mvorisek We already have |
Note on my initial use-case: PHPStan can/will report uses of deprecated constants based on phpdoc of php-stubs, jetbrains/stubs and other phpdocs starting with the next release Implemented with phpstan/phpstan-src#2953 |
I created a simple PR here: #13669 |
Description
I did not found a way to determine whether a constant is deprecated.
https://3v4l.org/opYVk#v8.1.21
does the reflection extension miss someting like
ReflectionConstant
?The text was updated successfully, but these errors were encountered: