Re: [PHP-DEV] Casting array to any class

2022-10-15 Thread Larry Garfield
On Sat, Oct 15, 2022, at 6:18 AM, Gianni Gentile wrote: > Hi, > > in my every day experience, using custom DTO classes and different API, > I often write code to instantiate my objects from associative arrays. > > What are your thoughts on introduce the `(AnyType)` cast to instantiate > objects f

Re: [PHP-DEV] Casting array to any class

2022-10-15 Thread Dan Ackroyd
On Sat, 15 Oct 2022 at 13:14, Gianni Gentile wrote: > > What are your thoughts on introduce the `(AnyType)` cast to instantiate > objects from associative array (or object properties also)? It seems a pretty bad idea. In particular, it makes for hard to maintain code as it doesn't give a place f

Re: [PHP-DEV] Casting array to any class

2022-10-15 Thread Thomas Nunninger
Hi, Am 15.10.22 um 13:18 schrieb Gianni Gentile: Hi, in my every day experience, using custom DTO classes and different API, I often write code to instantiate my objects from associative arrays. What are your thoughts on introduce the `(AnyType)` cast to instantiate objects from associative