pecee-pixie icon indicating copy to clipboard operation
pecee-pixie copied to clipboard

Using PHP-CS for better development

Open mrcnpdlk opened this issue 4 years ago • 1 comments

I suggest adding PHPCS for better code structure maintenance by many programmers. https://github.com/FriendsOfPHP/PHP-CS-Fixer Personally, I use the configuration below

        return [
            // default
            '@PSR2'                      => true,
            '@Symfony'                   => true,
            // additionally
            'array_syntax'               => ['syntax' => 'short'],
            'concat_space'               => false,
            'cast_spaces'                => false,
            'no_unused_imports'          => false,
            'no_useless_else'            => true,
            'no_useless_return'          => true,
            'no_superfluous_phpdoc_tags' => false,
            'ordered_imports'            => true,
            'phpdoc_align'               => true,
            'phpdoc_order'               => true,
            'phpdoc_trim'                => true,
            'phpdoc_summary'             => false,
            'simplified_null_return'     => false,
            'ternary_to_null_coalescing' => true,
            'binary_operator_spaces'     => ['default' => 'align'],
        ];

Before each commit run script: composer fixer

I able to prepare the patch

mrcnpdlk avatar Apr 06 '21 08:04 mrcnpdlk

Nice project, I didn't know about CS-fixer. I see it often in simple-router when people add patches, some don't even use PSR2. What a great find 👍

skipperbent avatar Apr 07 '21 15:04 skipperbent