Re: Double-Colon Always Follows the 'parent' Keyword?

From: Date: Mon, 11 Mar 2013 12:55:52 +0000
Subject: Re: Double-Colon Always Follows the 'parent' Keyword?
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 03/11/2013 08:19 AM, Ángel González wrote:
On 11/03/13 12:19, Eric James Michael Ritz wrote:
[...] This is what I want to know: Is there any valid situation in PHP where the ‘parent’ keyword is not followed by the scope-resolution operator? I am asking to help me decide on the best way to fix a bug for php-mode[1] for GNU Emacs. Consider these three lines:
    echo $parent;
    echo parent::$foo;
    echo $this->parent;
[...] My idea to fix this problem is to only treat ‘parent’ as a keyword if the scope-resolution operator immediately follows it. But before doing that I want to know whether or not that is true. So is there are valid situation where the keyword ‘parent’ does not have ‘::’ after it?
Hello Eric Wouldn't it be simpler to check that parent if preceded by whitespace/brackets? Checking if it's followed by the paamayim nekudotayim, seems also ok.
Thanks for the idea. Checking for brackets would work but not whitespace since PHP allows programmers to write code such as
    echo $this->  parent;        // Same as $this->parent
So perhaps checking for paamayim nekudotayim would be best. -- ejmr 南無妙法蓮華經

Thread (5 messages)

« previous php.internals (#66586) next »