Edit report at http://bugs.php.net/bug.php?id=51554&edit=1

 ID:          51554
 Updated by:  degeb...@php.net
 Reported by: david71rj at gmail dot com
 Summary:     Identifies if a call is static ou 'objective'
-Status:      Open
+Status:      Wont fix
 Type:        Feature/Change Request
 Package:     Class/Object related
 PHP Version: Irrelevant

 New Comment:

You shouldn't interchange static and non-static methods. If you need to
call a method statically, mark it as static. Your code below will give
an E_STRICT error.


Previous Comments:
------------------------------------------------------------------------
[2010-04-14 03:07:55] david71rj at gmail dot com

Description:
------------
If a call a method as static, how I can test if is a static call or
objective?



Well, I think about "is_static_call()", example:



class A {

  public function test(){

    if(is_static_call()){

      echo 'Static method';

    }

    else {

      echo 'Objective method';

    }

  }

}



A::test(); // Static method

$a = new A;

$a->test(); // Objective method



Currently I use a 'workarround' for this problem:



if($this && get_class($this) === get_class()){

  // Objective method

}



This is my sugestion.

Bye.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51554&edit=1

Reply via email to