You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to upgrade from PHP 7.4 to PHP 8.x and have used this package to check the code -- just warnings reported, no errors, but after upgrade, I am indeed getting errors, most prevalent for me is
From https://www.php.net/manual/en/migration80.incompatible.php:
The signature of abstract methods defined in traits is now checked against the implementing class method:
Describe the solution you'd like
I'm not too sure about inner workings of phpcs. I would like this issue to be reported ofc :) I can try to add this, but I would probably need some guidance.
I intend to create a pull request to implement this feature.
The text was updated successfully, but these errors were encountered:
@lee-van-oetz Thank you for reporting this. I believe your issue is related to this RFC.
Unfortunately, this is not something which can reliably be checked with PHPCompatibility as, by its nature, PHP_CodeSniffer only has access to the current file.
The only case in which this could reliably be checked by PHPCompatibility, is when the interface/trait and the class implementing the interface/using the trait would be declared in the same file, however, as it is uncommon to have multiple OO structures defined in the same file as the fast majority of PHP projects adhere to PSR-4, this would be an edge case, which makes it not worth the time investment to write the sniff.
While PHPCompatibility can find a lot of things, you will also need good tests when upgrading and these signature issues would be flagged via a failing test suite.
@lee-van-oetz You might be interested in PHPStan, which I believe should catch this issue. PHPStan also uses static analysis, but works at a project level rather than a file level, so it knows about parent classes/traits/etc. It isn't a compatibility-testing tool, but it does check for a number of code-correctness issues, and so it should report on this (and if not, I'm sure it's on the roadmap).
Is your feature request related to a problem?
I am trying to upgrade from PHP 7.4 to PHP 8.x and have used this package to check the code -- just warnings reported, no errors, but after upgrade, I am indeed getting errors, most prevalent for me is
From https://www.php.net/manual/en/migration80.incompatible.php:
Describe the solution you'd like
I'm not too sure about inner workings of phpcs. I would like this issue to be reported ofc :) I can try to add this, but I would probably need some guidance.
The text was updated successfully, but these errors were encountered: