8
PHPStorm에서 개체 배열의 코드 힌트는 간단하고 멋지다. 내가 그렇다면PHPStorm 코드 개체 배열 배열에 대한 힌트
class FooList {
public function __construct(){
$this->_fooList[] = new Foo(1);
$this->_fooList[] = new Foo(2);
$this->_fooList[] = new Foo(3);
$this->_fooList[] = new Foo(4);
}
/**
* @return Foo[]
*/
getFoos() {
return $this->_fooList;
}
}
...
$fooList = new FooList();
foreach($fooList as $foo)
{
// Nice hinting.
$foo->FooMethod...
}
PHPStorm은 $ fooList는, FOOS의 배열임을 이해하고, 따라서 그 $ foo는의 유형을 알고는 푸입니다.
문제는 FooList의 배열을 원한다는 것입니다.
$listOfLists[] = new FooList();
$listOfLists[] = new FooList();
$listOfLists[] = new FooList();
$listOfLists[] = new FooList();
foreach ($listOfLists as $fooList)
{
foreach($fooList as $foo)
{
// No code hinting for $foo :(
}
}
내가 좋아하는, 수동으로 foreach는 내부에 힌트를 코딩 할 수 있다는 사실을 알고 ...
foreach ($listOfLists as $fooList)
{
foreach($fooList as $foo)
{
/** $var $foo Foo */
// Code hinting, yay!!
}
}
또는 ...
foreach ($listOfLists as $fooList)
{
/** $var $fooList Foo[] */
foreach($fooList as $foo)
{
// Code hinting, yay!!
}
}
하지만 그 추한 생각, $ listOfLists는 Foo 배열로 구성되어 있으므로 listOfLists를 구현할 때마다 내가 상기시키는 내용을 상기해야합니다.
구현 방법이 있습니까?
http://youtrack.jetbrains.com/issue/WI-12303 – LazyOne
감사 LazyOne
이것은 당신이 지금이 작업을 수행 할 수 있음을 의미 ! 나는 이미 그 문제를 Upvoted. 이 게시물에 답글을 달아서이 문제가 실제로 요청한 기능이라고 설명하는 답변을 받으면 받아 들일 것입니다. –
이 질문은 타사 응용 프로그램의 기능 요청에 관한 내용이므로 주제와 관련이없는 것으로 보입니다. –