contao / easy-coding-standard
EasyCodingStandard configurations for Contao
                                    Fund package maintenance!
                                                                            
                                                                                                                                        to.contao.org/donate
                                                                                    
                                                                
Installs: 183 140
Dependents: 254
Suggesters: 0
Security: 0
Stars: 12
Watchers: 6
Forks: 9
Open Issues: 0
pkg:composer/contao/easy-coding-standard
Requires
- php: ^8.1
- kubawerlos/php-cs-fixer-custom-fixers: ^3.14
- slevomat/coding-standard: ^8.0
- symplify/easy-coding-standard: ^12.1
Requires (Dev)
- contao/rector: ^1.2
- phpunit/phpunit: ^11.5
Conflicts
- squizlabs/php_codesniffer: >=4.0.0
- dev-main
- 6.13.5
- 6.13.4
- 6.13.3
- 6.13.2
- 6.13.1
- 6.13.0
- 6.12.1
- 6.12.0
- 6.11.0
- 6.10.0
- 6.9.1
- 6.9.0
- 6.8.2
- 6.8.1
- 6.8.0
- 6.7.2
- 6.7.1
- 6.7.0
- 6.6.2
- 6.6.1
- 6.6.0
- 6.5.1
- 6.5.0
- 6.4.1
- 6.4.0
- 6.3.1
- 6.3.0
- 6.2.0
- 6.1.0
- 6.0.0
- 5.4.3
- 5.4.2
- 5.4.1
- 5.4.0
- 5.3.1
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.0
- 4.3.0
- 4.2.0
- 4.1.0
- 4.0.1
- 4.0.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
This package is auto-updated.
Last update: 2025-10-26 12:05:32 UTC
README
This package includes the EasyCodingStandard configuration for Contao.
Installation
Add the package to your Contao installation via Composer:
composer require contao/easy-coding-standard --dev
Usage
Create a file named ecs.php in the root directory of your project.
<?php declare(strict_types=1); use Contao\EasyCodingStandard\Set\SetList; use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() ->withSets([SetList::CONTAO]) // Adjust the configuration according to your needs. ;
Then run the script like this:
vendor/bin/ecs check
What's inside?
The package contains the following custom fixers:
| Class | Description | 
|---|---|
| AssertEqualsFixer | Replaces asserEquals()withassertSame()in unit tests unless the method is used to compare two objects. | 
| CaseCommentIndentationFixer | Fixes the comment indentation before a casestatement. | 
| ChainedMethodBlockFixer | Adds an empty line after a block of chained method calls. | 
| CommentLengthFixer | Adjusts the length of comments regardless of their indentation so that each line is about 80 characters long. | 
| ExpectsWithCallbackFixer | Adjusts the indentation of $this->callback()calls inside thewith()method of a unit test. | 
| FindByPkFixer | Replaces findByPk()calls withfindById(). | 
| FunctionCallWithMultilineArrayFixer | Fixes the indentation of function calls with multi-line array arguments. | 
| InlinePhpdocCommentFixer | Ensures that inline phpDoc comments are not converted to regular comments. | 
| IsArrayNotEmptyFixer | Fixes the order of isset()andempty()calls in conjunction withis_array()checks. | 
| MockMethodChainingIndentationFixer | Fixes the indentation of chained mock methods. | 
| MultiLineIfIndentationFixer | Fixes the indentation of multi-line if statements. | 
| MultiLineLambdaFunctionArgumentsFixer | Fixes the indentation of multi-line lambda function arguments. | 
| NoExpectsThisAnyFixer | Removes the explicit any()assertion in unit tests. | 
| NoLineBreakBetweenMethodArgumentsFixer | Fixes the indentation of method declarations. | 
| NoSemicolonAfterShortEchoTagFixer | Removes the semicolon after short echo tag instructions. | 
| SingleLineConfigureCommandFixer | Fixes the indentation of Symfony command arguments and options. | 
| TypeHintOrderFixer | Fixes the type hint order in method declarations. | 
The package contains the following custom sniffs:
| Class | Description | 
|---|---|
| ContaoFrameworkClassAliasSniff | Prevents using aliased Contao classes instead of their originals. | 
| SetDefinitionCommandSniff | Prevents using the setDefinition()method in Symfony commands. | 
| UseSprintfInExceptionsSniff | Prevents using string interpolation in exception messages. | 
License
Contao is licensed under the terms of the LGPLv3.
Getting support
Visit the support page to learn about the available support options.