[ 
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}

class A{
    function test(int $x) : bool{
        return $x>0;
 }


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



With PHP7.0 or 7.1 default parameters, this code would trigger the following 
error :
{code}
Fatal error: Declaration of B::test($a) must be compatible with A::test(int
$a): bool 
{code}

(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}

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 :
{code}
Fatal error: Declaration of B::test($a) must be compatible with A::test(int
$a): bool 
{code}

(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}
> class A{
>     function test(int $x) : bool{
>         return $x>0;
>  }
> class B extends A{
>     function test($x){
>         return $x>10;
>     }
> }
> {code}
> With PHP7.0 or 7.1 default parameters, this code would trigger the following 
> error :
> {code}
> Fatal error: Declaration of B::test($a) must be compatible with A::test(int
> $a): bool 
> {code}
> (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)

Reply via email to