Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8c84f57
Showing
9 changed files
with
434 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Composer | ||
/composer.lock | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# EasyCodingStandard configurations for Contao | ||
|
||
[![](https://img.shields.io/packagist/v/contao/easy-coding-standard.svg?style=flat-square)](https://packagist.org/packages/contao/easy-coding-standard) | ||
[![](https://img.shields.io/packagist/dt/contao/easy-coding-standard.svg?style=flat-square)](https://packagist.org/packages/contao/easy-coding-standard) | ||
|
||
This package includes the EasyCodingStandard configurations for [Contao][1]. | ||
|
||
## Installation | ||
|
||
You can install the package with Composer: | ||
|
||
``` | ||
composer require contao/easy-coding-standard | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
vendor/bin/ecs check *-bundle/src *-bundle/tests --config vendor/bin/contao/easy-coding-standard/config/default.yaml | ||
``` | ||
|
||
## License | ||
|
||
Contao is licensed under the terms of the LGPLv3. | ||
|
||
## Getting support | ||
|
||
Visit the [support page][2] to learn about the available support options. | ||
|
||
[1]: https://contao.org | ||
[2]: https://contao.org/en/support.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "contao/easy-coding-standard", | ||
"type": "library", | ||
"description": "EasyCodingStandard configurations for Contao", | ||
"license": "LGPL-3.0-or-later", | ||
"authors": [ | ||
{ | ||
"name": "Leo Feyer", | ||
"homepage": "https://github.com/leofeyer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.1", | ||
"symplify/coding-standard": "^7.1", | ||
"symplify/easy-coding-standard": "^7.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Contao\\EasyCodingStandard\\": "src/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
imports: | ||
- { resource: set/contao.yaml } | ||
|
||
parameters: | ||
exclude_files: | ||
- '*/Resources/*' | ||
|
||
skip: | ||
Symplify\CodingStandard\Sniffs\Naming\AbstractClassNameSniff: | ||
- '*TestCase.php' | ||
|
||
cache_directory: '%sys_get_temp_dir%/ecs_default_cache' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
imports: | ||
- { resource: set/contao.yaml } | ||
|
||
parameters: | ||
exclude_files: | ||
- '*/languages/*' | ||
- '*/templates/*' | ||
- '*/themes/*' | ||
|
||
skip: | ||
PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer: ~ | ||
PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer: ~ | ||
PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer: ~ | ||
PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer: ~ | ||
PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer: ~ | ||
PhpCsFixer\Fixer\Operator\IncrementStyleFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer: ~ # FIXME: remove | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer: ~ | ||
PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer: ~ | ||
PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer: ~ | ||
PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer: ~ | ||
PhpCsFixer\Fixer\Strict\StrictComparisonFixer: ~ | ||
PhpCsFixer\Fixer\Strict\StrictParamFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer: ~ | ||
SlevomatCodingStandard\Sniffs\PHP\UselessParenthesesSniff: ~ | ||
SlevomatCodingStandard\Sniffs\Variables\UselessVariableSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\AbstractClassNameSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\InterfaceNameSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\TraitNameSniff: ~ | ||
|
||
indentation: tab | ||
cache_directory: '%sys_get_temp_dir%/ecs_legacy_cache' | ||
|
||
services: | ||
PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer: | ||
syntax: long | ||
|
||
PhpCsFixer\Fixer\Basic\BracesFixer: | ||
allow_single_line_closure: true | ||
position_after_anonymous_constructs: next | ||
position_after_control_structures: next | ||
|
||
PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer: | ||
syntax: long | ||
|
||
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: | ||
spacing: one | ||
|
||
# Remove the "case" statement (see contao.yaml) | ||
PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer: | ||
statements: | ||
- declare | ||
- default | ||
- do | ||
- for | ||
- foreach | ||
- if | ||
- return | ||
- switch | ||
- throw | ||
- try | ||
- while | ||
|
||
# Remove the "throws" token (see symfony.yaml) | ||
PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer: | ||
tokens: | ||
- curly_brace_block | ||
- extra | ||
- parenthesis_brace_block | ||
- square_brace_block | ||
- use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
imports: | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/php70.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/php71.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/common.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/clean-code.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/dead-code.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/symfony.yaml' } | ||
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/symfony-risky.yaml' } | ||
|
||
parameters: | ||
skip: | ||
# We allow assignments in conditions (see common.yaml) | ||
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff: ~ | ||
|
||
# We do not want explicit variables (see common.yaml) | ||
PhpCsFixer\Fixer\LanguageConstruct\ExplicitIndirectVariableFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer: ~ | ||
|
||
# We do not want a space after the ! operator (see common.yaml) | ||
PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer: ~ | ||
|
||
# We allow assertEquals() to compare objects in configuration tests (see phpunit.yaml) | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer: | ||
- '*/*BundleTest.php' | ||
- '*/*ExtensionTest.php' | ||
|
||
# The method chaining identation fixer does not work for the Symfony configuration tree | ||
PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer: | ||
- '*/Configuration.php' | ||
- '*/src/Resources/contao/*' # FIXME: remove? | ||
|
||
# We do not require null default values to be nullable (see php71.yaml) | ||
SlevomatCodingStandard\Sniffs\TypeHints\NullableTypeForNullDefaultValueSniff: ~ | ||
|
||
# Do not report unused variables in foreach loops etc. (see clean-code.yaml) | ||
SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff: ~ # FIXME: remove? | ||
|
||
services: | ||
PhpCsFixer\Fixer\Comment\HeaderCommentFixer: | ||
header: "This file is part of Contao.\n\n(c) Leo Feyer\n\n@license LGPL-3.0-or-later" | ||
|
||
PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer: | ||
scope: namespaced | ||
fix_built_in: false | ||
include: | ||
- DIRECTORY_SEPARATOR | ||
- PHP_SAPI | ||
- PHP_VERSION_ID | ||
|
||
PhpCsFixer\Fixer\FunctionNotation\FopenFlagsFixer: | ||
b_mode: false | ||
|
||
PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer: | ||
scope: namespaced | ||
strict: true | ||
include: | ||
- '@@compiler_optimized' | ||
|
||
# We do not enforce blank lines before "break", "continue" and "yield" | ||
PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer: | ||
statements: | ||
- case | ||
- declare | ||
- default | ||
- do | ||
- for | ||
- foreach | ||
- if | ||
- return | ||
- switch | ||
- throw | ||
- try | ||
- while | ||
|
||
PhpCsFixer\Fixer\PhpUnit\PhpUnitTestCaseStaticMethodCallsFixer: | ||
call_type: this | ||
|
||
# Add fixers from PHP-CS-Fixer | ||
PhpCsFixer\Fixer\Alias\PowToExponentiationFixer: ~ | ||
PhpCsFixer\Fixer\Alias\SetTypeToCastFixer: ~ | ||
PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer: ~ | ||
PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer: ~ | ||
PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer: ~ | ||
PhpCsFixer\Fixer\CastNotation\NoUnsetCastFixer: ~ | ||
PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer: ~ | ||
PhpCsFixer\Fixer\Comment\MultilineCommentOpeningClosingFixer: ~ | ||
PhpCsFixer\Fixer\ControlStructure\IncludeFixer: ~ | ||
PhpCsFixer\Fixer\ControlStructure\NoAlternativeSyntaxFixer: ~ | ||
PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\CombineNestedDirnameFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\FopenFlagOrderFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\ImplodeCallFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\SingleLineThrowFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\StaticLambdaFixer: ~ | ||
PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer: ~ | ||
PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer: ~ | ||
PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer: ~ | ||
PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer: ~ | ||
PhpCsFixer\Fixer\LanguageConstruct\ErrorSuppressionFixer: ~ | ||
PhpCsFixer\Fixer\LanguageConstruct\NoUnsetOnPropertyFixer: ~ | ||
PhpCsFixer\Fixer\Operator\LogicalOperatorsFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer: ~ | ||
PhpCsFixer\Fixer\Phpdoc\PhpdocVarAnnotationCorrectOrderFixer: ~ | ||
PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer: ~ | ||
PhpCsFixer\Fixer\PhpTag\NoShortEchoTagFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertInternalTypeFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitMockFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitMockShortWillReturnFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitNamespacedFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitNoExpectationAnnotationFixer: ~ | ||
PhpCsFixer\Fixer\PhpUnit\PhpUnitOrderedCoversFixer: ~ | ||
PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer: ~ | ||
PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\EscapeImplicitBackslashesFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\HeredocToNowdocFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\NoBinaryStringFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\SimpleToComplexStringVariableFixer: ~ | ||
PhpCsFixer\Fixer\StringNotation\StringLineEndingFixer: ~ | ||
|
||
# Add fixers and sniffs from https://github.com/Symplify/CodingStandard | ||
Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer: ~ | ||
Symplify\CodingStandard\Fixer\Commenting\RemoveEmptyDocBlockFixer: ~ | ||
Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousDocBlockWhitespaceFixer: ~ | ||
Symplify\CodingStandard\Fixer\ControlStructure\RequireFollowedByAbsolutePathFixer: ~ | ||
Symplify\CodingStandard\Sniffs\CleanCode\ForbiddenParentClassSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Commenting\AnnotationTypeExistsSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Debug\DebugFunctionCallSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\AbstractClassNameSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\InterfaceNameSniff: ~ | ||
Symplify\CodingStandard\Sniffs\Naming\TraitNameSniff: ~ | ||
|
||
# Add custom fixers | ||
Contao\EasyCodingStandard\Fixer\SingleLineConfigureCommandFixer: ~ | ||
Contao\EasyCodingStandard\Sniffs\SetDefinitionCommandSniff: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
imports: | ||
- { resource: set/contao.yaml } | ||
|
||
parameters: | ||
file_extensions: | ||
- html5 | ||
|
||
skip: | ||
PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer: ~ | ||
PhpCsFixer\Fixer\Comment\HeaderCommentFixer: ~ | ||
PhpCsFixer\Fixer\ControlStructure\NoAlternativeSyntaxFixer: ~ | ||
PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer: ~ | ||
PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer: ~ | ||
PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer: ~ | ||
PhpCsFixer\Fixer\PhpTag\NoShortEchoTagFixer: ~ | ||
PhpCsFixer\Fixer\Semicolon\SemicolonAfterInstructionFixer: ~ | ||
PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer: ~ | ||
PhpCsFixer\Fixer\Strict\StrictComparisonFixer: ~ | ||
PhpCsFixer\Fixer\Strict\StrictParamFixer: ~ | ||
|
||
cache_directory: '%sys_get_temp_dir%/ecs_template_cache' |
Oops, something went wrong.