Phpinspectionsea: Default parameter hint also on usage __CLASS__

Created on 5 Jan 2018  路  2Comments  路  Source: kalessil/phpinspectionsea

I found an exception for the hint

The argument can be safely dropped, as it identical to the default value.

Look at the following code

class A {
}
class B extends A {
   function bar($className = __CLASS__) {
      ...
   }
}

Calling A::bar() will be an other result than A::bar(__CLASS__). In first call the $classname is B, in second call its A.

Inspections says: you can drop this parameter value.

bug / false-positive fixed

Most helpful comment

Fixed

All 2 comments

Good catch @dpauli - I'll fix it.

Fixed

Was this page helpful?
0 / 5 - 0 ratings