Closed gubler closed 4 years ago
Just released possible fix:
Could you try dev-master
of prefixed version?
New errors :)
First, I got this:
Fatal error: Uncaught _HumbugBox0f4e8e911c87\Symfony\Component\Config\Exception\FileLocatorFileNotFoundException: The file "vendor/symplify/easy-coding-standard/config/set/clean-code.yaml" does not exist (in: /home/vagrant/code). in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/config/FileLocator.php:60
I updated my ecs.yml
to replace the imports:
section with the new sets:
section and that changed the error to:
PHP Fatal error: Uncaught _HumbugBox0f4e8e911c87\Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer": argument "$classLikeExistenceChecker" of method "__construct()" references class "Symplify\PackageBuilder\Types\ClassLikeExistenceChecker" but no such service exists. in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:49
Here is my current ecs.yml
file for testing:
parameters:
cache_directory: var/cache/ecs
skip:
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff: ~
PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: ~
PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer: ~
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: ~
PhpCsFixer\Fixer\Operator\IncrementStyleFixer: ~
PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer: ~
PhpCsFixer\Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer: ~
PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer: ~
SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff.MissingTraversableParameterTypeHintSpecification: ~
SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff.MissingTraversableReturnTypeHintSpecification: ~
Symplify\CodingStandard\Sniffs\ControlStructure\SprintfOverContactSniff: ~
SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: ~
Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff: ~
SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff: ~
PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer: ~
exclude_files:
- 'src/Kernel.php'
sets:
- 'clean-code'
- 'common'
- 'php70'
- 'php71'
- 'psr2'
- 'psr12'
- 'symfony'
- 'symfony-risky'
services:
# PHP 5.5
Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer: ~
# Control Structures
Symplify\CodingStandard\Fixer\Property\ArrayPropertyDefaultValueFixer: ~
Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer: ~
Symplify\CodingStandard\Fixer\ControlStructure\RequireFollowedByAbsolutePathFixer: ~
# Spaces
Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer: ~
# Comments
Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousDocBlockWhitespaceFixer: ~
# Naming
PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer: ~
# Debug
Symplify\CodingStandard\Sniffs\Debug\DebugFunctionCallSniff: ~
Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff: ~
# final classes
PhpCsFixer\Fixer\ClassNotation\FinalInternalClassFixer: ~
# multibyte
PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer: ~
# psr
PhpCsFixer\Fixer\Basic\Psr0Fixer: ~
PhpCsFixer\Fixer\Basic\Psr4Fixer: ~
# psr-1
PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff: ~
PHP_CodeSniffer\Standards\PSR1\Sniffs\Files\SideEffectsSniff: ~
PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff: ~
PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer: ~
PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer: ~
PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer: ~
PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer: ~
PhpCsFixer\Fixer\Import\OrderedImportsFixer:
importsOrder:
- 'class'
- 'const'
- 'function'
PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer:
space: 'none'
PhpCsFixer\Fixer\Operator\NewWithBracesFixer: ~
PhpCsFixer\Fixer\Basic\BracesFixer:
'allow_single_line_closure': false
'position_after_functions_and_oop_constructs': 'next'
'position_after_control_structures': 'same'
'position_after_anonymous_constructs': 'same'
PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer:
syntax: short
PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer: ~
PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer:
elements:
- 'const'
- 'method'
- 'property'
PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer: ~
PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer:
space_before: 'none'
PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer: ~
PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer: ~
PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer: ~
PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer: ~
# merge issets
PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer: ~
PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer: ~
# remove useless phpdoc
PhpCsFixer\Fixer\FunctionNotation\PhpdocToReturnTypeFixer: ~
PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer: ~
PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer: ~
# arguable checkers, feel free to remove them
Symplify\CodingStandard\Sniffs\ControlStructure\SprintfOverContactSniff: ~
PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer:
order:
- 'use_trait'
PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer: ~
PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer: ~
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer:
spacing: 'one'
PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer:
statements:
- 'return'
# cognitive complexity - adjust level to your needs, starting from 100
Symplify\CodingStandard\Sniffs\CleanCode\CognitiveComplexitySniff:
maxCognitiveComplexity: 30
New errors :)
Yay :smile:
I updated my ecs.yml to replace the imports: section with the new sets: section and that changed the error to:
Correct solution! GJ
Cannot autowire service
That will be probably internal import config path problem. Good report, thanks!
Let's cover it with test: https://github.com/Symplify/EasyCodingStandardPrefixed/commit/7b50eb6fdf46164d7eb10afb6a255611003fec53
Could you re-try with current dev-master
?
Composer update:
- Removing symplify/easy-coding-standard-prefixed (dev-master ff2ea30)
- Installing symplify/easy-coding-standard-prefixed (dev-master 7b50eb6): Downloading (100%)
Deleted the existing cache and the result of the run:
PHP Fatal error: Uncaught _HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer": argument "$classLikeExistenceChecker" of method "__construct()" references class "Symplify\PackageBuilder\Types\ClassLikeExistenceChecker" but no such service exists. in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:49
Stack trace:
#0 phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(72): _HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue(Object(_HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Definition), true)
#1 phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErro in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 49
Fatal error: Uncaught _HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer": argument "$classLikeExistenceChecker" of method "__construct()" references class "Symplify\PackageBuilder\Types\ClassLikeExistenceChecker" but no such service exists. in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 49
_HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer": argument "$classLikeExistenceChecker" of method "__construct()" references class "Symplify\PackageBuilder\Types\ClassLikeExistenceChecker" but no such service exists. in phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 49
Call Stack:
0.0004 388024 1. {main}() /home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs:0
0.1663 2307272 2. require('phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/bin/ecs') /home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs:6
0.5495 7195616 3. Symplify\EasyCodingStandard\HttpKernel\EasyCodingStandardKernel->boot() phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/bin/ecs:68
0.5495 7195616 4. Symplify\EasyCodingStandard\HttpKernel\EasyCodingStandardKernel->initializeContainer() phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/http-kernel/Kernel.php:113
0.8911 12346784 5. _HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\ContainerBuilder->compile() phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/http-kernel/Kernel.php:463
0.9053 12358384 6. _HumbugBox879a7d36aa5c\Symfony\Component\DependencyInjection\Compiler\Compiler->compile() phar:///home/vagrant/code/vendor/symplify/easy-coding-standard-prefixed/ecs/vendor/symfony/dependency-injection/ContainerBuilder.php:620
Could you create reproducible repository on Github? I can't replicate it
You can also extend existing test case to fail: https://github.com/Symplify/EasyCodingStandardPrefixed/blob/7b50eb6fdf46164d7eb10afb6a255611003fec53/.github/workflows/parameters_sets.yaml#L24
That would be even better, as it could be part of our test suite
Sorry for this unexpected comment (don't have time), but I just wanted to report I tried using the phar too today and encountered several issues :
Symplify\EasyCodingStandard\Exception\DependencyInjection\Extension\FixerIsNotConfigurableException
on PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer.allowed_mixed: true
Symplify\EasyCodingStandard\Exception\DependencyInjection\Extension\InvalidSniffPropertyException
on SlevomatCodingStandard\Sniffs\Commenting\ForbiddenCommentsSniff.forbiddenCommentPatterns: ['/^Created by PhpStorm\.$/']
Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer": argument "$lineLengthTransformer" of method "__construct()" references class "Symplify\CodingStandard\TokenRunner\Transformer\FixerTransformer\LineLengthTransformer" but no such service exists.
on Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer: ~
PhpCsFixer\*
services), it ran successfully but changed the final
on my Doctrine Entities (which, I guess, happened for the same reasons as on Rector, see https://github.com/rectorphp/rector/issues/1639) : 12) src/Entity/Task.php
---------- begin diff ----------
--- Original
+++ New
@@ -23,7 +23,7 @@
* @ORM\Table(name="task")
* @ORM\Entity
*/
-class Task
+final class Task
{
----------- end diff -----------
Applied checkers:
* PhpCsFixer\Fixer\ClassNotation\FinalClassFixer
Hope it helps in some way (I switched back to my Docker container for now).
Does it remain with the latest 8f88502
version? There have been some changes
I downloaded https://github.com/symplify/easy-coding-standard-prefixed/blob/2b45db82bd136f1b43a28f6b86ee5b29fba1fabb/ecs.phar and it still bug on Fatal error: Uncaught Symplify\EasyCodingStandard\Exception\DependencyInjection\Extension\InvalidSniffPropertyException: Checker class "SlevomatCodingStandard\Sniffs\Commenting\ForbiddenCommentsSniff" in configuration was not found in phar:///home/gnutix/dev/.../ecs.phar/src/Yaml/CheckerConfigurationGuardian.php:29
.
Good, that's better error. I'll unscope SlevomatCS Too
Thanks for testing, this is helpful
Sorry, I've been swamped with work and I won't be able to try and build a test until Saturday and even that is a bit questionable.
I will put something together when I can carve out the time.
@gnutix Slevomat was unscoped now, could you re-try dev-master
?
@TomasVotruba Tried with dev-master
. Issues 1 and 2 are resolved, issues 3 and 4 remain.
These might be unrelated, or can drag for a longer time. Please create 2 new issues.
Ther narrower scope the better
I updated to the
-prefix
PHAR for ECS and when I try to run it I getFixerIsNotConfigurableException
for any special PhpCsFixer configuration.For example, I have this in my
ecs.yml
:And I get the error:
I rolled back to the non
-prefix
version and I do not receive an error.Please let me know if you want my full
ecs.yml
file.