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.
  • PSR-12 declare(s... 'Julian Wittorf' via PHP Framework Interoperability Group

Reply via email to