【发布时间】:2019-04-13 04:01:24
【问题描述】:
【问题讨论】:
标签: php netbeans yii yii2 codesniffer
【问题讨论】:
标签: php netbeans yii yii2 codesniffer
Yii2 至少需要 PHP 5.4,所以如果您的 IDE 支持 PHP 5.4 或更高版本,那么它也会显示 Yii2 的标准。
你也可以查看这个 yii pligin for netbeans http://plugins.netbeans.org/plugin/47246/php-yii-framework-netbeans-phpcc
【讨论】:
$ ./vendor/bin/phpcs --extensions=php --standard=Yii2 /home/resurtm/work/Yii2MegaApp/
在你的项目的根目录中创建名为 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
{
}
【讨论】: