ID:               46593
 User updated by:  jtaal at eljakim dot nl
 Reported By:      jtaal at eljakim dot nl
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: Irrelevant
 PHP Version:      5.2.6
 New Comment:

I've found the solution:

$otherObject instanceof self

(maybe someone can find this issue using a searchengine)


Previous Comments:
------------------------------------------------------------------------

[2008-11-17 13:17:22] jtaal at eljakim dot nl

Description:
------------
The PHP parser currently cannot handle "__CLASS__" directly after
"instanceof". I think this should be possible.

Reproduce code:
---------------
class myclass {
    function mymethod($otherObject) {
        if ($otherObject instanceof __CLASS__) {
            $otherObject->mymethod(null);
        }
        return 'works!';
    }
}

$a = new myclass();
print $a->mymethod($a);

Expected result:
----------------
works!

Actual result:
--------------
Parse error: syntax error, unexpected T_CLASS_C, expecting T_STRING or
T_VARIABLE or '$' in ... on line 4


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


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

Reply via email to