How do I use hyphen in namespacing?

2019-02-22 09:23发布

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 ?

1条回答
Lonely孤独者°
2楼-- · 2019-02-22 09:43

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

查看更多
登录 后发表回答