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
A project of mine runs on PHP 7.4 but already has some "forward-compatible" attribute syntax for the switch to PHP8 included (it is tested for both versions, but the server has not been upgraded yet), which with PHPStan 1.0 leads to errors that cannot be ignored or baselined.
Code snippet that reproduces the problem
Symfony project with controllers like the following, with annotations for PHP 7.4 and attributes for when the project switches to PHP8:
Leads to the following errors, when I run it with PHP8 CLI (not sure if it would also appear with PHP 7.4 CLI):
Named arguments are supported only on PHP 8.0 and later. for the Route attribute definition, yet for PHP 7.4 that attribute definition is just a comment.
Expected output
An advantage of the attribute syntax in PHP is that you can start adding it while still using PHP 7.4 - in that case I would expect PHPStan to ignore all attributes if the project is set to run on PHP 7.4. This is also an error that cannot be ignored - it cannot be added to the baseline file, PHPStan reports this when I try: Some errors could not be put into baseline. Re-run PHPStan and fix them..
As a positive last note: PHPStan 1.0 has become really fast, and this is the only problem I noticed in all my projects when upgrading, thanks for all your work!
The text was updated successfully, but these errors were encountered:
Bug report
A project of mine runs on PHP 7.4 but already has some "forward-compatible" attribute syntax for the switch to PHP8 included (it is tested for both versions, but the server has not been upgraded yet), which with PHPStan 1.0 leads to errors that cannot be ignored or baselined.
Code snippet that reproduces the problem
Symfony project with controllers like the following, with annotations for PHP 7.4 and attributes for when the project switches to PHP8:
Leads to the following errors, when I run it with PHP8 CLI (not sure if it would also appear with PHP 7.4 CLI):
Named arguments are supported only on PHP 8.0 and later.
for the Route attribute definition, yet for PHP 7.4 that attribute definition is just a comment.Expected output
An advantage of the attribute syntax in PHP is that you can start adding it while still using PHP 7.4 - in that case I would expect PHPStan to ignore all attributes if the project is set to run on PHP 7.4. This is also an error that cannot be ignored - it cannot be added to the baseline file, PHPStan reports this when I try:
Some errors could not be put into baseline. Re-run PHPStan and fix them.
.As a positive last note: PHPStan 1.0 has become really fast, and this is the only problem I noticed in all my projects when upgrading, thanks for all your work!
The text was updated successfully, but these errors were encountered: