Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Faizan Akram Dar
On Fri, Jul 19, 2024 at 1:34 AM Oliver Nybroe wrote: > Hello internals. > > I am looking into making the constructor body optional in classes, > essentially allowing you to write > > ``` > class User { > public function __construct( > private string $name, > ) > } > ``` > > Curren

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Gina P. Banyard
On Thursday, 18 July 2024 at 19:23, Tim Düsterhus wrote: > On 7/18/24 16:03, Lily Bergonzat wrote: > > > I feel like the more substantial one would be more likely to break > > stuff, compared to the minor one, and so I don't see why the minor one > > would be refused? > > > There is no such thi

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Tim Düsterhus
Hi On 7/18/24 17:04, Lily Bergonzat wrote: I am not top-posting right now? Thank you for giving me a nudge. To confirm: Yes, this email is not a top post. Top-posting means putting your reply at the very top of the email, above the quoted bits, instead of below them. The "gold standard" woul

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Tim Düsterhus
Hi On 7/18/24 16:03, Lily Bergonzat wrote: I feel like the more substantial one would be more likely to break stuff, compared to the minor one, and so I don't see why the minor one would be refused? There is no such thing as a minor syntax change. Any changes to the syntax has consequences fo

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Oliver Nybroe
On Thu, 18 Jul 2024 at 15:48, Larry Garfield wrote: > > Please don't top-post. > > Since the last time this came up, PSR-12 has been replaced with PER-CS, > which as of 2.0 now says: > > > If a function or method contains no statements or comments (such as an > empty no-op implementation or when

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Lily Bergonzat
On Thu, Jul 18, 2024 at 4:40 PM Larry Garfield wrote: > > On Thu, Jul 18, 2024, at 2:03 PM, Lily Bergonzat wrote: > > I would love to see those improvements as well, however I am surprised > > we seem to be more inclined to push a more substantial change than a > > minor one. > > > > I feel like t

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Larry Garfield
On Thu, Jul 18, 2024, at 2:03 PM, Lily Bergonzat wrote: > I would love to see those improvements as well, however I am surprised > we seem to be more inclined to push a more substantial change than a > minor one. > > I feel like the more substantial one would be more likely to break > stuff, compar

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Lily Bergonzat
I would love to see those improvements as well, however I am surprised we seem to be more inclined to push a more substantial change than a minor one. I feel like the more substantial one would be more likely to break stuff, compared to the minor one, and so I don't see why the minor one would be

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Larry Garfield
On Thu, Jul 18, 2024, at 10:11 AM, Oliver Nybroe wrote: > Thanks for sharing previous discussions, I will definitely take a look > at those before writing up the RFC. > > >> If you do with to go with an RFC, I'd like to see if your proposal > addresses whether this syntax should implicitly call >

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Rob Landers
On Thu, Jul 18, 2024, at 12:11, Oliver Nybroe wrote: > Thanks for sharing previous discussions, I will definitely take a look at > those before writing up the RFC. > > > > If you do with to go with an RFC, I'd like to see if your proposal > addresses whether this syntax should implicitly call >

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Oliver Nybroe
Thanks for sharing previous discussions, I will definitely take a look at those before writing up the RFC. > If you do with to go with an RFC, I'd like to see if your proposal addresses whether this syntax should implicitly call `parent::__construct()`, and if a semi colon is expected or not (`pu

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Lily Bergonzat
I don't view this proposition as a breaking change. The way I understand it, writing an empty body for a constructor would still work, but we would also get the option to just omit the body altogether. I think it would be a very sensible update. I also think it should require a semicolon, just so

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Ayesh Karunaratne
> > Hello internals. > > I am looking into making the constructor body optional in classes, > essentially allowing you to write > > ``` > class User { > public function __construct( > private string $name, > ) > } > ``` > > Currently to make this code valid, it would have to be wri

Re: [PHP-DEV] Optional constructor body

2024-07-18 Thread Christoph M. Becker
Hi Oliver! On 18.07.2024 at 11:21, Oliver Nybroe wrote: > I am looking into making the constructor body optional in classes, > essentially allowing you to write > > ``` > class User { > public function __construct( > private string $name, > ) > } > ``` See https://externals.io/me

[PHP-DEV] Optional constructor body

2024-07-18 Thread Oliver Nybroe
Hello internals. I am looking into making the constructor body optional in classes, essentially allowing you to write ``` class User { public function __construct( private string $name, ) } ``` Currently to make this code valid, it would have to be written the following way ```