Re: [PHP-DEV] Typed constants revisited

2022-03-29 Thread Alexandru Pătrănescu
Hey Mark, On Wed, Mar 30, 2022 at 6:03 AM Mark Niebergall wrote: > > I have updated the RFC https://wiki.php.net/rfc/typed_class_constants with > more details and examples from this thread, and updated the RFC status to > Under Discussion. Hopefully the updated RFC helps answer questions and >

Re: [PHP-DEV] Typed constants revisited

2022-03-29 Thread Mark Niebergall
On Mon, Mar 28, 2022 at 6:54 AM Guilliam Xavier wrote: > Constants are not abstract in an interface - they must be assigned a >> value. Only classes and methods can be abstract. Within an abstract class >> it is not valid to have an abstract property. Properties can be defined >> `protected int $

[PHP-DEV] Undefined variables and the array append operator

2022-03-29 Thread Rowan Tommins
Hi all, If $foo is not defined, statements such as $foo += 1 and $foo .= 'blah' raise "undefined variable" Warnings in PHP 8, and will throw Errors in PHP 9. However, the very similar looking $foo[] = 1 succeeds silently. This seems odd to me, as "append to string" and "append to array" seem

Re: [PHP-DEV] instance version of match ?

2022-03-29 Thread Thomas Nunninger
Hi, Am 29.03.22 um 14:34 schrieb Rowan Tommins: On 29/03/2022 11:59, Robert Landers wrote: $object instanceof AnotherInterface => 'bar', We can see that `SomeInterface` will resolve the interface and not the constant. Yeah, the instanceof operator is magic in that regard - it has a

Re: [PHP-DEV] instance version of match ?

2022-03-29 Thread Rowan Tommins
On 29/03/2022 11:59, Robert Landers wrote: $object instanceof AnotherInterface => 'bar', We can see that `SomeInterface` will resolve the interface and not the constant. Yeah, the instanceof operator is magic in that regard - it has a special parsing rule to consume the next token a

Re: [PHP-DEV] instance version of match ?

2022-03-29 Thread Robert Landers
On Tue, Mar 29, 2022 at 3:47 AM Bruce Weirdan wrote: > > On Mon, Mar 28, 2022 at 7:56 PM Karoly Negyesi wrote: > > match ($object) { > > Someinterface => 'foo', > > AnotherInterface => 'bar', > > } > > > > this can not clash with any existing code as using identifiers like this > > are a synt