Unable to parse file on constant using PHP8.3

In PHP 8.3 (with Drupal 10), using SonarQube v10.1 I have this following error (and on some other files using constants) and I have no clue why.

13:31:46.475 ERROR: Unable to parse file [file:///builds/project-digital/projects/nova/discovery-cms/src/web/modules/custom/project_resources/src/Export/ExportCustomerService.php] at line 15
13:31:46.475 ERROR: Parse error at line 15 column 24:
 5: namespace Drupal\project_resources\Export;
6: 
 7: use Drupal\Core\Logger\LoggerChannelFactoryInterface;
 8: use Drupal\project_customer_service\Entity\CustomerService;
 9: use Drupal\project_static_storage\Manager\StorageFilesManager;
10: use Drupal\project_utils\Bar;
11: use Drupal\project_utils\Foo;
12: 
13: class ExportCustomerService {
14:
15:   private const string DEFAULT_TITLE = 'customer-service';
                           ^

I did execute the command sonar-scanner with --debug and no extra info on the Parse error which is too bad.

Hi,

Your version is past EOL. You should upgrade the latest version at your earliest convenience. Your upgrade path is:

10.1 → 10.6 (last step optional)

You may find these resources helpful:

At this point, you should be on a version with SONARPHP-1430 fixed.

1 Like

Thanks for your help. I’ll try that ASAP :slight_smile:

We have the same issue, on a Magento application, running PHP 8.3
We are using 9.9 LTA.
Would upgrading to 2025.1 LTA fix for us as well?

If you’re facing the same issue, yes! 2025.1 is newer than 10.6.

Thank you!