Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.
<?php $instance = new class {};
Should we make this clearer?
How would you word it instead?
On Fri, Jan 24, 2020 at 11:46 AM Alessandro Lai
<alessand...@gmail.com> wrote:
>
> While following PSR-12 implementation on PHP-CS-Fixer, a comment indicated a possible inconsistency in the PSR-12 text: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4502#issuecomment-578006523
>
> The issue is in the fact that chapter 4 says:
>
> The term “class” refers to all classes, interfaces, and traits.
> [...]
> When instantiating a new class, parentheses MUST always be present even when there are no arguments passed to the constructor.
>
> But chapter 8 for anonymous classes says:
>
> Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.
>
> <?php
>
> $instance = new class {};
>
>
> Should we make this clearer?
>
> --
> You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
I'd prefer errata as well.
On Fri, Jan 24, 2020 at 2:23 PM Alessandro Lai
<alessan...@gmail.com> wrote:
>
> First we need the opinion of the editor (Korvin Szanto), to decide if we want to correct course or just clarify our intention.
>
> IMHO, looking at the code example, it seems that we're not requiring the parentheses, but it would be inconsistent, so I would prefer an errata that requires them.
>
> This PR contains my proposed fix, minus the errata text that should be added in the meta: https://github.com/php-fig/fig-standards/pull/1206
>
> Il giorno venerdì 24 gennaio 2020 11:12:59 UTC+1, Alex Makarov ha scritto:
>>
>> How would you word it instead?
>>
>> On Fri, Jan 24, 2020 at 11:46 AM Alessandro Lai
>> <alessan...@gmail.com> wrote:
>> >
>> > While following PSR-12 implementation on PHP-CS-Fixer, a comment indicated a possible inconsistency in the PSR-12 text: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4502#issuecomment-578006523
>> >
>> > The issue is in the fact that chapter 4 says:
>> >
>> > The term “class” refers to all classes, interfaces, and traits.
>> > [...]
>> > When instantiating a new class, parentheses MUST always be present even when there are no arguments passed to the constructor.
>> >
>> > But chapter 8 for anonymous classes says:
>> >
>> > Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.
>> >
>> > <?php
>> >
>> > $instance = new class {};
>> >
>> >
>> > Should we make this clearer?
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to php...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/4f9352d1-f65b-47bb-9c08-e06ecc6ece1f%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to php...@googlegroups.com.