deprecated-packages / symplify

[DISCONTINUED] Check split packages in their own repositories :)
MIT License
618 stars 188 forks source link

ECS: Markdown PHP Code Fixer implicitly requires closing tag #4563

Closed ghostwriter closed 1 year ago

ghostwriter commented 1 year ago

Hey, TomasVotruba and samsonasik

Thanks for the work you've done on this project, Absolutely love it!


While checking the README.md file on ghostwriter/coding-standard I was getting this error.

Command: vendor/bin/ecs check --clear-cache

[ERROR] System error: "syntax error, unexpected token "`""Run ECS with "--debug" option and post the report here: https://github.com/symplify/symplify/issues/new in
         /workspace/ghostwriter/coding-standard/README.md:34

Relevant code from the README.md :

> ``` php
> <?php
> 
> declare(strict_types=1);
> 
> use Symplify\EasyCodingStandard\Config\ECSConfig;
> 
> return static function (ECSConfig $ecsConfig): void {
>     $ecsConfig->import(__DIR__ . '/vendor/ghostwriter/coding-standard/ecs.php');
>     $ecsConfig->paths([__DIR__ . '/rector.php', __DIR__ . '/ecs.php', __DIR__ . '/src', __DIR__ . '/tests']);
>     $ecsConfig->skip([__DIR__ . '/vendor/*']);
> };
> ```

I was only able to resolve this issue by adding a closing PHP tag ?>.

 > ``` php
 > <?php
 > 
 > declare(strict_types=1);
 > 
 > use Symplify\EasyCodingStandard\Config\ECSConfig;
 > 
 > return static function (ECSConfig $ecsConfig): void {
 >     $ecsConfig->import(__DIR__ . '/vendor/ghostwriter/coding-standard/ecs.php');
 >     $ecsConfig->paths([__DIR__ . '/rector.php', __DIR__ . '/ecs.php', __DIR__ . '/src', __DIR__ . '/tests']);
 >     $ecsConfig->skip([__DIR__ . '/vendor/*']);
 > };
+ > ?>
 > ```
  1. I expected README to not be forced to include a closing tag.
  2. I expected a better error message.
TomasVotruba commented 1 year ago

Hi @ghostwriter ,

thanks for reporting. This command was causing more issues and tried to solve a problem that was in php-parser printer, so I've decided to remove it.

Instead of trying to make the tool happy like in your case, it's better to handle the snippets manually or in the outputter.