Hi all.

> Em sex., 7 de jun. de 2024 às 17:53, Pierre <pierre-...@processus.org>
escreveu:
> I do agree with you that when you use value objects, you need it a lot,
> but I'd much prefer having a JS like value objects initializer syntax,
> such as `Point {x: 1, y: 2}` syntax than creating another way to call
> the constructor, which already has a mastered and comprehensive syntax
> which is simply `new`.

I also think that `new `(4 chars, if we count the blank space) is short
enough.
But a JS-like syntax that's already known for representing objects could be
used.
I'm sympathetic to something like this (changing the OP examples):

class A {
     public function b() {
          echo "I'm B";
     }
 }

 A::{}->b();


class Foo {
    public function __construct(
        public string $name
    ) {}
}

class Bar {
   public function __construct(
        public Foo $foo
   ) {}
}

 $bar = Bar::{ Foo::{ "I'm foo in bar" } };
 echo $bar->foo->name;


#[AttributeOverrides([
    AttributeOverride::{
        name: "id",
        column: Column::{ name: "guest_id", type: "integer", length: 140 }
    },
    AttributeOverride::{
        name: "name",
        column: Column::{ name: "guest_name", nullable: false, unique:
true, length: 240 }
    }]
)]


#[AttributeOverrides([
    AttributeOverride::{
        name: "id",
        column: Column::{ name: "guest_id", type: "integer", length: 140 }
    },
    AttributeOverride::{
        name: "name",
        column: Column::{ name: "guest_name", nullable: false, unique:
true, length: 240 }
    }]
)]

--
Erick

Reply via email to