Re: Use behavior thoughts

From: Date: Fri, 06 Mar 2015 08:46:22 +0000
Subject: Re: Use behavior thoughts
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-84377@lists.php.net to get a copy of this message
> > So, I created a PR to remove this error: > https://github.com/php/php-src/pull/1149 > <https://github.com/php/php-src/pull/1149> +1 > > Note that there is no BC break here, as it's removing an error condition today. > > This results in a weird edge case (which is 100% valid, but feels odd): > > <?php > class Test {} > use Bar\Test; > var_dump(new Test); // class(Bar\Test) > > That's perfectly valid, if not a bit weird. > > The reverse would error mind you: > > <?php > use Bar\Test; > class Test {} > > Because you've already defined the symbol Test in the file. > > To get around this, I've created another PR with a BC break, adding a > compile error if code comes before use: > https://github.com/php/php-src/pull/1150 -1, the example you gave looks totally valid. Regards, Mike

« previous php.internals (#84377) next »