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:18:02 UTC

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

     [ https://issues.apache.org/jira/browse/NETBEANS-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alperovitch updated NETBEANS-108:
---------------------------------
    Description: 
Let's consider the following code :

{code}
// 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.

  was:
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.


> 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 - Editor
>    Affects Versions: 8.2
>         Environment: Both Windows and Mac OS
>            Reporter: Alperovitch
>
> Let's consider the following code :
> {code}
> // 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)