You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see in the above script, The method_exists return true even the method not overwritten in the child class, Not that passing static::class, self::class and $this don't solve the problem
The text was updated successfully, but these errors were encountered:
foremtehan
changed the title
Method to check if method overwritten in child class
Helper function to check if method overwritten in child class
Nov 8, 2023
There's ReflectionMethod::hasPrototype(). It indicates whether the declared method is overriding some other declaration (including interface methods). There's also getPrototype() to get the class/interface that declares it (at the top-most level). Does that suffice? This seems like a fringe case, so a little helper function should serve you well. I don't think this is common enough to justify a new function.
Description
It would be great if we could have a method that checks whether the child class overwritten the parent class's method
https://3v4l.org/hTQWO
As you can see in the above script, The
method_exists
return true even the method not overwritten in the child class, Not that passingstatic::class
,self::class
and$this
don't solve the problemThe text was updated successfully, but these errors were encountered: