0

How to overcome this ? This is my class path: app/code/vendor/module/Block/Catalog/Product/List/Toolbar.php

namespace vendor\module\Block\Catalog\Product\List;

class Toolbar
{...}

How to overcome this ? This is my class path: app/code/vendor/module/Block/Catalog/Product/List/Toolbar.php

in my Toolbar.php

namespace vendor\module\Block\Catalog\Product\List;

class Toolbar {...} Since the namespace cannot end with a reserved keyword "List", im unabel to use it that way. It throws : syntax error, unexpected 'List' (T_LIST), expecting identifier (T_STRING)

How to use that the same in Magento 2

1
  • I cant edit the list folder as there are many dependencies in the naming conventions which i ve to change in many places. what s the other alternative
    – Sushivam
    Commented Jun 20, 2016 at 3:39

1 Answer 1

0

You're getting this error, because list is a reserved keyword in PHP and therefore cannot be used as the name of your class;

http://php.net/manual/en/reserved.keywords.php

Rename your Block to something else and you should be fine.

Like

namespace vendor\module\Block\Catalog\Product\MyList;

class Toolbar
{...}

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.