2016-07-20 10 views
1

저는 PHP 7 프로젝트에서 PhpStorm 10.0.2으로 작업 중입니다.PhpStorm에서 "인수 유형이 일치하지 않습니다"오류를보고하는 이유는 무엇입니까?

인수 유형이

일치하지 않는 : 나는 스칼라 타입 힌트 입력이있는 함수 매개 변수에 대한하는 PHPDoc @param를 선언 할 때마다

(string, int는, ...) 나는이 경고를

class HostConfig 
{ 
    /** 
    * @var string 
    */ 
    private $hostname; 
    /** 
    * @var string 
    */ 
    private $domainname; 

    /** 
    * Creates a new instance of hte HostConfig model. 
    * 
    * @param string $hostname A host name (e.g. "dev", "int", "feature-xy") 
    * @param string $domainname A domain name (e.g. "example.com") 
    * 
    * @throws \InvalidArgumentException If the given $hostname is empty 
    * @throws \InvalidArgumentException If the given $domainname is empty 
    */ 
    public function __construct(string $hostname, string $domainname) 
    { 
     if (strlen(trim($hostname)) === 0) { 
      throw new \InvalidArgumentException("The host name cannot be empty"); 
     } 

     if (strlen(trim($domainname)) === 0) { 
      throw new \InvalidArgumentException("The domain name cannot be empty"); 
     } 

     $this->hostname = $hostname; 
     $this->domainname = $domainname; 
    } 
} 

그리고 다음은

는 PhpStorm에 대해 불만을 일부 샘플 코드

Screenshot of PhpStorm displaying an "Argument type does not match" hint for a string function parameter that has type hinting

아무도 내가 뭔가 잘못하고있는 중이 야 알고 또는 않습니다이 강력하게 형식화 된 문자열 매개 변수가있는 생성자의하는 PHPDoc에 대한 -hint "를 일치하지 않는 인수 유형"의심을 표시 PhpStorm의 스크린 샷 이것이 PhpStorm의 버그 일 뿐이라면?

+0

저는 지난 2 년 동안 매일 PHPStorm을 사용하고 있으며 불행히도 출시 사이에 이런 불쾌한 버그로 가득합니다. – Marty

+0

@ Marty 왜 계속 사용합니까? 왜 전환하지 않았습니까? – BeetleJuice

+0

@BeetleJuice 무엇에? PHPDoc과 동일한 기능을 가진 것은 없습니다. – Marty

답변

4

PHPStorm의 버전은 PHP 7 이후 7 개월 만에 릴리스되었으므로 언어의 새로운 기능 (스칼라 유형 힌팅 포함)에 대한 지원은 그리 좋지 않습니다. IDE 버그가 발생했습니다. 귀하의 문제는 probably this one입니다. PHPStorm 10.0.3