PHP version 8.1
Magento 2.4.4
3/9 [=========>------------------] 33% 14 secs 300.0 MiBsyntax error, unexpected token "readonly", expecting identifier#0 /home/valdis/webapps/spartan-style/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#2 /home/valdis/webapps/spartan-style/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(182): ReflectionClass->__construct()
#3 /home/valdis/webapps/spartan-style/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ApplicationCodeGenerator.php(77): Magento\Setup\Module\Di\Code\Scanner\PhpScanner->collectEntities()
#4 /home/valdis/webapps/spartan-style/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator->doOperation()
#5 /home/valdis/webapps/spartan-style/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()
#6 /home/valdis/webapps/spartan-style/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute()
#7 /home/valdis/webapps/spartan-style/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#8 /home/valdis/webapps/spartan-style/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#9 /home/valdis/webapps/spartan-style/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun()
#10 /home/valdis/webapps/spartan-style/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun()
#11 /home/valdis/webapps/spartan-style/bin/magento(23): Symfony\Component\Console\Application->run()
#12 {main}
Hello @valdis_strautins
Issue belongs to vendor file. Please remove and update vendor files by composer.
Copy vendor folder first then remove by using below steps:
1. rm -rf vendor/* 2. composer update/install.
It will download latest files and the try after give all required permissions.
It may help you!
Thankyou.