warnings - PHP: why is "Strict standards: Declaration of x should be compatible with y" applied to static methods? -


the php warning, "strict standards: declaration of x should compatible y" warns if write code like:

class {   function foo($x) {     ..   } } class b extends {   function foo() {     ..   } } 

this sensible, because object reference "$a" think a, may @ runtime turn out b, dynamically dispatched method call $a->foo(3) may end calling b::foo() wrong number of arguments.

my question is: why same warning applied static methods, not dynamically dispatched?

class x {   static function bar($x) {     ..   } } class y extends x {   static function bar() {     ..   } } 

in example, function y::bar() not override x::bar(), there no reason trigger warning, php still does. why?

just in java, can call static methods on instance too. there still room confusion.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -