Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error in generated ecs.php file #171

Closed
gemal opened this issue Feb 2, 2024 · 1 comment · Fixed by #172
Closed

syntax error in generated ecs.php file #171

gemal opened this issue Feb 2, 2024 · 1 comment · Fixed by #172

Comments

@gemal
Copy link

gemal commented Feb 2, 2024

I just installed ecs and had it generate a ecs.php file

EasyCodingStandard 12.1.8

But it had a syntax error in it

the auto generated file looks like this:

<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([
        __DIR__ . '/app',
    ])

    // add a single rule
    ->withRules([
        NoUnusedImportsFixer::class,
    ])

    // add sets - group of rules
    ->withPreparedSets(
        arrays: true,
        // namespaces: true,
        // spaces: true,
        // docblocks: true,
        // comments: true,
    );

php -l ecs.php
PHP Parse error:  syntax error, unexpected ':', expecting ')' in ecs.php on line 20
Errors parsing ecs.php
@samsonasik
Copy link
Collaborator

It seems you're using php < 8, you should can comment named arg:

- arrays: true,
+ // arrays: true,

and use normal arg for the methods if needed.

@TomasVotruba I think template need to be updated to comment named args or comment the sub method ->withPreparedSets()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants