Magento 2 – Fixing Parse Error: Syntax Error, Unexpected ” ”

errormagento2module

This is my first time trying out Magento 2 and I tried creating a basic custom module, but when I tried to execute the php bin/magento setup:upgrade it, I got an error:

Parse error: syntax error, unexpected ''Jurgis_Twilio'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in C:\wamp64\www\magento2\app\code\Jurgis\Twilio\registration.php on line 4

C:\wamp64\www\magento2\app\code\Jurgis\Twilio\registration.php:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Jurgis_Twilio',
    __DIR__
);

my php version (php -v):

PHP 7.0.10 (cli) (built: Aug 18 2016 09:48:53) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

Best Answer

I cannot explain this, but the error was fixed by just rearranging the elements in one line like this:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::MODULE, 'Jurgis_Twilio', __DIR__);
Related Topic