私はAPIプロバイダの特性を簡単にセットアップすることに取り組んでいます。各プロバイダは、それぞれの宣言のPHPドキュメンテーションに従って、機能と必要な機能を宣言するための特性とインタフェースを実装しています。PhpStorm:インターフェイスと特性に基づいて、クラスによる可変メンバの可視性
My PhpStormは、インターフェイスと特性関数を明確にインデックスしますが、変数メンバのインデックスは作成しません。私はそれらを公開、保護、または非公開と宣言しました - 何も動作していないようです。彼らは明らかにPHP7環境で動作しますが、私のPhpStormは私がそれらを動的に宣言したと考えています。
基本的に、これは私の設定です。
interface ProviderInterface
{
const TYPE_ELECTRICITY = 'electricity';
const TYPE_GAS = 'gas';
/**
* @param ContainerInterface $container
*
* @return void
*/
function setContainer(ContainerInterface $container);
/**
* @return Client|\SoapClient
*/
function client();
}
trait ProviderTrait
{
/**
* @var string
*/
private $endpoint = '';
public function setContainer($container) {
/** void for demo purposes */
}
}
class Provider implements ProviderInterface
{
use ProviderTrait;
/**
* @var string
*/
private $username;
/**
* @var string
*/
private $password;
/**
* constructor.
*
* @param ContainerInterface $container
*/
final public function __construct(ContainerInterface $container)
{
$this->setContainer($container);
/**
* While $username and $password are declared within this class, the $endpoint is declared in the ProviderTrait. PHP works fine. PhpStorm ignores it and says it is declared "dynamically".
*/
$this->endpoint = $this->container->getParameter('api.endpoint');
$this->username = $this->container->getParameter('api.username');
$this->password = $this->container->getParameter('api.password');
}
私はキャッシュをクリアしようとした( "&再起動を無効")が、同じことが起こるのインデックスの後にしました。
誰かがアイデアを得ましたか?
あなたのIDEのバージョンは何ですか? – LazyOne
PhpStorm 2017年2月1日 ビルド#PS-172.3544.41、2017年8月2日 JREの上に構築された:1.8.0_152-リリース-915-B6 AMD64 JVM:JetBrainsのことでOpenJDKの64ビットサーバーVMがs.r.o のWindows 10 10.0 – ReSpawN