Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-27 Thread radar3301
> $p is Point {x: 3, y: $y}; > // If $p->x === 3, bind $p->y to $y and return true. > $p is Point {y: 37, x:@($x)}; > // $p->x === $x && $p->y == 37 I'm just going to put in my $0.02 here and downvote this syntax. I believe that it should be swapped. IMO, `{x: 3, y: $y}` looks too similar to the

Re: [PHP-DEV] [Initial Feedback] Typed Arrays

2024-06-26 Thread radar3301
ven though my example is for properties.) trait GenericTrait { private ?T $object = null; } class ComposableClass { use GenericTrait; } // Result: class ComposedClass { private ?Foo $object = null; } Just a random thought... Regards, radar3301

Re: [PHP-DEV] Add $this return type

2024-06-26 Thread radar3301
"` returns 8 results - `language:php "class Same "` returns 290 results - `language:php "class Same extends"` returns 193 results - `language:php "class Same implements"` returns 14 results - `language:php "@return $this"` returns 485k results. --- Regards, radar3301

Re: [PHP-DEV] Add $this return type

2024-06-25 Thread radar3301
ate here. Sebastian Bergmann said: > [snip] please not "$this" as the name for a type. > Off the top of my head, I think that "same" could make sense. My primary vote would still be for "$this" as explained above, but I could potentially be persuaded to switch to "this" or "same" as alternatives if the dollar-sign is too much of a hang-up. Regards, radar3301

[PHP-DEV] Add $this return type

2024-06-24 Thread radar3301
. BC: There would be no BC breaks, as this syntax is currently invalid (Parse error: syntax error, unexpected variable "$this"). Other Considerations: With regards to reflection and inheritance, "$this" would be considered an alias for "static". Regards, radar3301