How to set PHP version?

Hello, how can I specify PHP version which Sonar uses to checks my code? I write code in PHP7 and I receive Code Smells notices for PHP4. Of course these PHP4 notices are no longer valid for PHP7. Here is my project dashboard: https://sonarcloud.io/dashboard?id=Webiik Thank you for your help.

Hi,

I suppose you refer to the issue you have on the rule named “PHP 4 constructor declarations should not be used”.
That rule seems to be still relevant for code which is valid with PHP 7 but uses old-style constructors.

However, I think that the issue you got is a false positive. As mentioned in PHP documentation for constructors, PHP logs a warning when it finds such methods but only inside non-namespaced classes.
I believe the rule should have the same behavior and I created SONARPHP-884 to track the problem.

Thanks for your feedback!

1 Like

Hello, yes that’s it. Thank you for creating the ticket and I’m looking forward for the bug fix. Have a nice day!