【问题标题】:Setup Yii 2 Web Framework Coding Standard in NetBeans在 NetBeans 中设置 Yii 2 Web 框架编码标准
【发布时间】:2019-04-13 04:01:24
【问题描述】:

我读过thisthis。但是如何在 Windows 机器的 NetBeans IDE 中设置呢?

【问题讨论】:

    标签: php netbeans yii yii2 codesniffer


    【解决方案1】:

    Yii2 至少需要 PHP 5.4,所以如果您的 IDE 支持 PHP 5.4 或更高版本,那么它也会显示 Yii2 的标准。

    你也可以查看这个 yii pligin for netbeans http://plugins.netbeans.org/plugin/47246/php-yii-framework-netbeans-phpcc

    【讨论】:

    【解决方案2】:

    在你的项目的根目录中创建名为 autocompletion.php 的文件并将其添加到文件中。

     /**
     * Yii bootstrap file.
     * Used for enhanced IDE code autocompletion.
     * Note: To avoid "Multiple Implementations" PHPStorm warning and make autocomplete faster
     * exclude or "Mark as Plain Text" vendor/yiisoft/yii2/Yii.php file
     */
    class Yii extends \yii\BaseYii
    {
        /**
         * @var BaseApplication|WebApplication|ConsoleApplication the application instance
         */
        public static $app;
    }
    
    /**
     * Class BaseApplication
     * Used for properties that are identical for both WebApplication and ConsoleApplication
     *
     * @property trntv\filekit\Storage $fileStorage
     * @property common\components\keyStorage\KeyStorage $keyStorage
     * @property yii\web\UrlManager $urlManagerFrontend UrlManager for frontend application.
     * @property yii\web\UrlManager $urlManagerBackend UrlManager for backend application.
     * @property yii\web\UrlManager $urlManagerStorage UrlManager for storage application.
     * @property trntv\glide\components\Glide $glide
     * @property trntv\bus\CommandBus $commandBus
     */
    abstract class BaseApplication extends yii\base\Application
    {
    }
    
    /**
     * Class WebApplication
     * Include only Web application related components here
     *
     * @property User $user User component.
     */
    class WebApplication extends yii\web\Application
    {
    }
    
    /**
     * Class ConsoleApplication
     * Include only Console application related components here
     */
    class ConsoleApplication extends yii\console\Application
    {
    }
    
    /**
     * User component
     * Include only Web application related components here
     *
     * @property \common\models\User $identity User model.
     * @method \common\models\User getIdentity() returns User model.
     */
    class User extends \yii\web\User
    {
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-21
      • 2023-04-05
      • 2012-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-28
      相关资源
      最近更新 更多