From bd8c20d6b3cd82e600cfd817c228210d03bb071a Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 12 Aug 2023 13:57:17 +0200 Subject: [PATCH] use class-leak --- .gitattributes | 1 - .github/workflows/code_analysis.yaml | 2 +- composer.json | 1 + easy-ci.php | 56 ------------------- ecs.php | 1 - src/CaseConverter/AliasCaseConverter.php | 4 +- ...tainerConfiguratorReturnClosureFactory.php | 2 +- .../Service/SingleServicePhpNodeFactory.php | 2 +- 8 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 easy-ci.php diff --git a/.gitattributes b/.gitattributes index 72b1777..476fb15 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,6 @@ .gitignore export-ignore *.md export-ignore /tests export-ignore -/easy-ci.php export-ignore /ecs.php export-ignore /phpstan.neon export-ignore /rector.php export-ignore diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 55c4b3b..44964bc 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -46,7 +46,7 @@ jobs: - name: 'Check Active Classes' - run: vendor/bin/easy-ci check-active-class src --ansi + run: vendor/bin/class-leak check src --ansi --skip-type="\Symplify\PhpConfigPrinter\Contract\Converter\ServiceOptionsKeyYamlToPhpFactoryInterface" --skip-type="\Symplify\PhpConfigPrinter\Contract\RoutingCaseConverterInterface" --skip-type="\Symplify\PhpConfigPrinter\Contract\CaseConverterInterface" name: ${{ matrix.actions.name }} runs-on: ubuntu-latest diff --git a/composer.json b/composer.json index 51b86ee..0aadc52 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "symplify/phpstan-extensions": "^11.2", "symplify/phpstan-rules": "^12.0", "symplify/symplify-kernel": "^11.0", + "tomasvotruba/class-leak": "0.1.1.72", "tomasvotruba/unused-public": "^0.2.0" }, "autoload": { diff --git a/easy-ci.php b/easy-ci.php deleted file mode 100644 index fbb0017..0000000 --- a/easy-ci.php +++ /dev/null @@ -1,56 +0,0 @@ -typesToSkip([ - AliasCaseConverter::class, - ClassServiceCaseConverter::class, - ConfiguredServiceCaseConverter::class, - ExtensionConverter::class, - ImportCaseConverter::class, - NameOnlyServiceCaseConverter::class, - ParameterCaseConverter::class, - ResourceCaseConverter::class, - ServicesDefaultsCaseConverter::class, - ConditionalEnvRoutingCaseConverter::class, - ImportRoutingCaseConverter::class, - PathRoutingCaseConverter::class, - AbstractServiceOptionKeyYamlToPhpFactory::class, - ArgumentsServiceOptionKeyYamlToPhpFactory::class, - AutowiringTypesOptionKeyYamlToPhpFactory::class, - BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory::class, - CallsServiceOptionKeyYamlToPhpFactory::class, - DecoratesServiceOptionKeyYamlToPhpFactory::class, - DeprecatedServiceOptionKeyYamlToPhpFactory::class, - FactoryConfiguratorServiceOptionKeyYamlToPhpFactory::class, - ParentLazyServiceOptionKeyYamlToPhpFactory::class, - PropertiesServiceOptionKeyYamlToPhpFactory::class, - SharedPublicServiceOptionKeyYamlToPhpFactory::class, - ]); -}; diff --git a/ecs.php b/ecs.php index bb42212..862b15d 100644 --- a/ecs.php +++ b/ecs.php @@ -9,7 +9,6 @@ $ecsConfig->paths([ __DIR__ . '/ecs.php', __DIR__ . '/rector.php', - __DIR__ . '/easy-ci.php', __DIR__ . '/src', __DIR__ . '/tests', ]); diff --git a/src/CaseConverter/AliasCaseConverter.php b/src/CaseConverter/AliasCaseConverter.php index 7cfda73..fcf60bf 100644 --- a/src/CaseConverter/AliasCaseConverter.php +++ b/src/CaseConverter/AliasCaseConverter.php @@ -114,10 +114,10 @@ private function createAliasNode(string $key, string $fullClassName, mixed $serv private function createFromClassLike(string $key, mixed $values, Variable $servicesVariable): Expression { - $classReference = $this->commonNodeFactory->createClassReference($key); + $classConstFetch = $this->commonNodeFactory->createClassReference($key); $argValues = []; - $argValues[] = $classReference; + $argValues[] = $classConstFetch; $argValues[] = $values[MethodName::ALIAS] ?? $values; $args = $this->argsNodeFactory->createFromValues($argValues, true); diff --git a/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php b/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php index fc222e7..3b0193b 100644 --- a/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php +++ b/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php @@ -134,7 +134,7 @@ private function resolveExpressionWhenAtEnv( $args = $expr->getArgs(); if (! isset($args[1]) || ! $args[1]->value instanceof Array_ || ! isset($args[1]->value->items[0]) - || ! $args[1]->value->items[0] instanceof ArrayItem || $args[1]->value->items[0]->key === null) { + || ! $args[1]->value->items[0] instanceof ArrayItem || ! $args[1]->value->items[0]->key instanceof Expr) { throw new ShouldNotHappenException(); } diff --git a/src/NodeFactory/Service/SingleServicePhpNodeFactory.php b/src/NodeFactory/Service/SingleServicePhpNodeFactory.php index 1e28651..05d8326 100644 --- a/src/NodeFactory/Service/SingleServicePhpNodeFactory.php +++ b/src/NodeFactory/Service/SingleServicePhpNodeFactory.php @@ -87,7 +87,7 @@ private function createCallMethodCall(mixed $call, MethodCall $methodCall): Meth $args[] = new Arg($argumentsExpr); $returnCloneExpr = $this->resolveCallReturnClone($call); - if ($returnCloneExpr !== null) { + if ($returnCloneExpr instanceof Expr) { $args[] = new Arg($returnCloneExpr); }