Hi Julian,
The best place to effect change in coding standards these days is in PER-CS
since it can actually change in future releases:
https://github.com/php-fig/per-coding-style

That said, I struggle to see how this isn't just an issue with CS Fixer.
For example if you completely exclude CS Fixer the following is valid and
parses fine:

```
<?php declare(strict_types=1) ?>
Hello Word
```
https://3v4l.org/oJlV4

Restricting valid syntax in order to prevent unforeseeable bugs in
third-party tools would require us to make guesses about what to disallow
which would lead to a more restrictive spec without improving readability.

On Thu, Mar 30, 2023, 6:29 AM 'Julian Wittorf' via PHP Framework
Interoperability Group <php-fig@googlegroups.com> wrote:

> The title basically says it all but I'll list the issue I found so one can
> reproduce it:
>
>    1. Copy the code example from
>    
> https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements
>    into a file and DO NOT add optional semi-colon (although this is a part of
>    the PHP manual
>    https://www.php.net/manual/en/control-structures.declare.php)
>    2. Run PHP CS Fixer on the file
>    3. The code is now broken, because the fixer kind of thinks it's a
>    function (call? declaration?) (but not really either), see code example
>    below.
>    4. This FatalError could simply be prevent if the semi-colon is
>    required in PSR-12.
>
> Broken/resulted code due to the missing semi-colon:
> <?php declare(strict_types=1) {
>     ;
> } ?>
> <!DOCTYPE html>
> ...
>
> I'm aware the PHP-FIG can't respond to all the tools out there but I'm
> just trying to make the point, that a coding standard must not make
> recommendations, that don't follow the official language documentation and
> general coding best practices like "finish a statement/instruction properly
> with a terminating semicolon" which is mentioned in the manual as well:
> https://www.php.net/manual/en/language.basic-syntax.instruction-separation.php
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/php-fig/3564160b-b997-4f6a-a3d8-9e61baa35659n%40googlegroups.com
> <https://groups.google.com/d/msgid/php-fig/3564160b-b997-4f6a-a3d8-9e61baa35659n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CANeXGWURhs-frA%2B9kvEmdGCmpOix%3Dhtrev4qdWHvWN%2BWj%2Bm%3D2w%40mail.gmail.com.
  • PSR-12 declare(s... 'Julian Wittorf' via PHP Framework Interoperability Group
    • Re: PSR-12 ... Korvin Szanto

Reply via email to