Hi I am getting the below error while upgrading Magento 2.3.4 to 2.4.4

MiBsyntax error, unexpected token "", expecting variable#0 /var/www/html/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/var/www/html/v...'

5 Answers 5


I faced a similar issue so I tracked it back to below class and added a echo statement. The last class shown in the output was having a extra comma in the constructor.

Class /vendor/composer/ClassLoader.php Line 428

enter image description here


I found the issue , It was in my extension where there was space after \ in constructor.


In my case, there is new line after ResourceModel\ in the following path


the code was like bellow

use Company\MpVendorRegistration\Model\ResourceModel\
        VendorRegistrationAssignGroup\CollectionFactory as VendorRegistrationAssignGroupCollection;
use Company\MpVendorRegistration\Model\ResourceModel\
        VendorRegistrationAttribute\CollectionFactory as VendorRegistrationAttributeCollection;

It must be like bellow code

use Company\MpVendorRegistration\Model\ResourceModel\VendorRegistrationAssignGroup\CollectionFactory as VendorRegistrationAssignGroupCollection;
use Company\MpVendorRegistration\Model\ResourceModel\VendorRegistrationAttribute\CollectionFactory as VendorRegistrationAttributeCollection;

I get this error in my custom extension when ; (semicolon) was missing.


Try to run command using php version like:

/usr/bin/php8.1 bin/magento setup:di: compile

Instead of php bin/magento setup:di:compile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.