我的IDE PHPStorm将下一行标记为错误(单词“password”)
Yii::$app->passport->getLoginUrl($Url);
我如何为它编写phpdoc。
可能是这样还是怎么样?
/** @var $Yii::$app->passport array */
Yii::$app->passport->getLoginUrl($Url);
最佳答案
您可以在Yii 2.0 Cookbook - IDE autocompletion for custom components中找到解决方案
<?php
/**
* Yii bootstrap file.
* Used for enhanced IDE code autocompletion.
*/
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 \app\components\RbacManager $authManager The auth manager for this application. Null is returned if auth manager is not configured. This property is read-only. Extended component.
* @property \app\components\Mailer $mailer The mailer component. This property is read-only. Extended component.
*/
abstract class BaseApplication extends yii\base\Application
{
}
/**
* Class WebApplication
* Include only Web application related components here
*
* @property \app\components\User $user The user component. This property is read-only. Extended component.
* @property \app\components\MyResponse $response The response component. This property is read-only. Extended component.
* @property \app\components\ErrorHandler $errorHandler The error handler application component. This property is read-only. Extended component.
*/
class WebApplication extends yii\web\Application
{
}
/**
* Class ConsoleApplication
* Include only Console application related components here
*
* @property \app\components\ConsoleUser $user The user component. This property is read-only. Extended component.
*/
class ConsoleApplication extends yii\console\Application
{
}
关于yii2 - Yii的Yii2 phpdoc::$ app-> passport,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38890647/