Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use hyphen in namespacing?

I am using https://packagist.org/packages/bitdevelopment/yii2-validators , a word count validation in Yii2, but I am getting

>PHP Parse Error – yii\base\ErrorException
    syntax error, unexpected '-', expecting ',' or ';'
    \bitdevelopment\yii2-validators\WordValidator;

How do I use this yii2 validator ?

like image 283
maan81 Avatar asked Jul 07 '16 12:07

maan81


Video Answer


1 Answers

You cannot use hypen(-) in namespace. As Class naming convention don't accept hypen, you have to use underscore. See the namespace convention here.

like image 62
Varun Krish Avatar answered Nov 11 '22 05:11

Varun Krish