The scanner can’t parse files where a PHP reserved keyword is used in the namespace (in my case it is
The same issue has been already reported with previous version of SonarQube/scanner:
- Unable to parse files containing Interface in the namespace
- List keyword is allowed in namespaces since php 8.0, but it causes parse error
I tried the latest version of SonarQube hoping the issue was resovled
but unfortunately the issue is still here:
ERROR: Unable to parse file [file:///builds/htdocs/src/Infrastructure/Database/Entity/Budget.php] at line 9 ERROR: Parse error at line 9 column 40: 1: <?php 2: 3: namespace App\Infrastructure\Database\Entity; 4: 5: use DateTimeInterface; 6: use Doctrine\Common\Collections\ArrayCollection; 7: use Doctrine\Common\Collections\Collection; 8: use Doctrine\ORM\Mapping as ORM; 9: use App\Infrastructure\Database\Entity\Trait\TimestampableTrait; ^
We are using traits a lot, so a large portion of our code base isn’t scanned at all.
With this error, it would be safer to say that SonarQube’s support for PHP 8 is not complete.