You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Alperovitch (JIRA)" <ji...@apache.org> on 2017/10/30 12:16:00 UTC

[jira] [Created] (NETBEANS-108) No check of type hinting constistancy in overwritten methods

Alperovitch created NETBEANS-108:
------------------------------------

             Summary: No check  of type hinting constistancy in overwritten methods
                 Key: NETBEANS-108
                 URL: https://issues.apache.org/jira/browse/NETBEANS-108
             Project: NetBeans
          Issue Type: Bug
          Components: php - Code
    Affects Versions: 8.2
         Environment: Both Windows and Mac OS
            Reporter: Alperovitch


Let's consider the following code :

{code:PHP}
// Some comments here
public String getFoo()
{
  class A{
    function test(int $x) : bool{
        return $x>0;
    }
}

class B extends A{
    function test($x){
        return $x>10;
    }
}
}
{code}



With PHP7.0+ default parameters, this code would trigger the following error :
Fatal error: Declaration of B::test($a) must be compatible with A::test(int
$a): bool (and I am even not sure that there is any way to parameter PHP so that it does not trigger sur error)

It would be useful if the Editor would flag this issuue as a warning or an
error on the row of the definition of function test in class B.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)