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
Deprecated/not available functions not reported #6935
Comments
I found these snippets: https://psalm.dev/r/5201b68036<?php
each( $array );
https://psalm.dev/r/208b2cb781<?php
$array = array( rand( 10, 20 ) => 'bar');
echo array_key_first( $array );
|
@weirdan I guess there is no way around hardcoding all deprecated/newly introduced functions and just checking against that in psalm? There is a (non-maintained?) tool, that already has all that data collected up to PHP 8.0 (I think PHP 8.0 isn't fully complete, but before that I'm sure it is): https://github.com/wapmorgan/PhpDeprecationDetector/tree/master/data |
We have most of that data in callmaps (added and removed functions). If we're going to add deprecations for internal functions, it would make sense to have them there as well. |
…older than currently used PHP version Fix vimeo#6935
Assuming psalm.dev runs on PHP 7.4.x (phpVersion=7.4 in config, since I cannot see the actual config)https://psalm.dev/r/5201b68036Should give an error:https://www.php.net/manual/en/migration72.deprecated.php
EDIT: when tested again in 03/2024 with psalm 5.22 this correctly reports
UndefinedFunction
=> this is bc since PHP 8.0.0 the function was completely removed, therefore it's reported as "UndefinedFunction". This works correctly as it should, as psalm reports undefined but not only deprecated functions===
Also vice versa, if phpVersion=7.0, I expect to get an error for this:
https://psalm.dev/r/208b2cb781
as the array_key_first function was added in 7.3.0 https://www.php.net/manual/de/function.array-key-first.php
The text was updated successfully, but these errors were encountered: