Cannot use yii\base\Object as Object because 'Object' is a special class name yii2 advance

前端 未结 3 1547
慢半拍i
慢半拍i 2021-01-13 19:59

I just bougth a stronger pc, installed composer and wanted to continue my project on it but when I use gii it give me this error. How can I fix it ? Why am I getting it ? Th

相关标签:
3条回答
  • 2021-01-13 20:41

    solved. since 2.0.13, the class name Object is invalid since PHP 7.2, use [[BaseObject]] instead. So in the vendor/yiisoft/yii2-gii/CodeFile.php just had to change Object to BaseObject.

    0 讨论(0)
  • 2021-01-13 20:50

    in my case i change file /vendor/trntv/yii2-command-bus/src/middlewares/BackgroundCommandMiddleware.php use yii\base\Object; to use yii\base\BaseObject; and class BackgroundCommandMiddleware extends Object implements Middleware to ; class BackgroundCommandMiddleware extends BaseObject implements Middleware

    0 讨论(0)
  • 2021-01-13 20:52

    solved. since 2.0.13, the class name Object is invalid in PHP 7.2,

    //Replace //class User extends \yii\base\Object implements \yii\web\IdentityInterface

    class User extends \yii\base\BaseObject implements \yii\web\IdentityInterface

    And Download the yii-basic-app-2.0.25 from https://www.yiiframework.com/download after that copy the yiisoft folder from vendor and replace the yiisoft folder in your project in vendor folder

    Now check your project will be working fine. Its work for me hope it will work for you.

    0 讨论(0)
提交回复
热议问题