Re: [PHP-DEV] RFC: Not Null Assertion Operator

2025-02-07 Thread MrMeshok
> Hello, > > I feel like that is more of an architecture problem than a programming one > though. Instead of constantly checking if the conditions are right, use php's > type system instead, so it would read more like: > > if ($response instanceof SuccessfulResponse) { > return $response->data-

Re: [PHP-DEV] RFC: Not Null Assertion Operator

2025-02-07 Thread MrMeshok
> > Examples of potentially using in PHP: > Without this operator we writing this code: > > $foo = ... > > if ($foo === null) { > throw new FooIsNullException(); > } > > $foo->bar. > > With this operator: > > $foo!->bar > $foo!->someProperty->method(); > $foo!->someProperty->anotherProperty!->m

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-15 Thread MrMeshok
rvice->getBalance(), name: $name, ); ``` чт, 14 нояб. 2024 г. в 22:28, Larry Garfield : > > On Thu, Nov 14, 2024, at 7:37 AM, Christian Schneider wrote: > > Am 14.11.2024 um 10:59 schrieb Marco Pivetta : > >> On Thu, 14 Nov 2024, 11:29 MrMeshok, wrote: > >>>

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread MrMeshok
t; wrote: > > > On Thu, Nov 14, 2024, at 7:37 AM, Christian Schneider wrote: > > > > > Am 14.11.2024 um 10:59 schrieb Marco Pivetta ocram...@gmail.com: > > > > > > > On Thu, 14 Nov 2024, 11:29 MrMeshok, ilyaorlov...@gmail.com wrote: > > > &g

[PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread MrMeshok
Hello, Internals! As you know if you try to unpack a regular object (`...$object`) you will get an error: Only arrays and Traversables can be unpacked. I don't really see a reason for this restriction, because foreach on objects works perfectly fine, so I made a feature request on GitHub to change