Skip to content

Commit 72fc0f3

Browse files
authored
Merge pull request #7 from symplify/tv-refresh-2025
Function file must be loaded manually to function_exists to work + remove dependency on deprecated easy-testing package
2 parents a64c9e3 + 43413f8 commit 72fc0f3

File tree

14 files changed

+114
-35
lines changed

14 files changed

+114
-35
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
name: 'Tests'
3333
run: vendor/bin/phpunit
3434

35+
-
36+
name: 'Dependency Analysis'
37+
run: vendor/bin/composer-dependency-analyser
38+
3539
-
3640
name: 'Check Active Classes'
3741
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"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
composer.lock
33

44
.phpunit.cache
5+
6+
# symfony kernel cache dir
7+
/var

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Downloads total](https://img.shields.io/packagist/dt/symplify/php-config-printer.svg?style=flat-square)](https://packagist.org/packages/symplify/php-config-printer/stats)
44

5-
Print Symfony services array with configuration to to plain PHP file format thanks to this simple php-parser wrapper
5+
Print Symfony services array with configuration to to plain PHP file format using [nikic/php-parser](https://github.com/nikic/PHP-Parser)
66

77
## Install
88

composer-dependency-analyser.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
6+
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
7+
8+
// include ref() function
9+
// require __DIR__ . '/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php';
10+
11+
$configuration = new Configuration();
12+
13+
// can be used conditionally, based on project context
14+
$configuration->ignoreErrorsOnPackage('myclabs/php-enum', [ErrorType::DEV_DEPENDENCY_IN_PROD]);
15+
16+
return $configuration;

composer.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44
"license": "MIT",
55
"require": {
66
"php": ">=8.2",
7-
"nette/utils": "^3.2",
8-
"nikic/php-parser": "^5.3",
9-
"symfony/yaml": "^6.4"
7+
"ext-ctype": "*",
8+
"nette/utils": "^4.0",
9+
"nikic/php-parser": "^5.5",
10+
"symfony/dependency-injection": "^6.4|^7.3",
11+
"symfony/service-contracts": "^3.6",
12+
"symfony/yaml": "^6.4",
13+
"webmozart/assert": "^1.11"
1014
},
1115
"require-dev": {
16+
"symfony/config": "^6.4|^7.3",
17+
"symfony/http-kernel": "^6.4|^7.3",
1218
"myclabs/php-enum": "^1.8",
19+
"phpecs/phpecs": "^2.1",
1320
"phpstan/extension-installer": "^1.4",
1421
"phpstan/phpstan": "^2.1",
15-
"phpunit/phpunit": "^10.5",
16-
"rector/rector": "^2.0",
17-
"phpecs/phpecs": "^2.0",
18-
"symplify/easy-testing": "^11.1",
22+
"phpunit/phpunit": "^11.5",
23+
"rector/rector": "^2.1",
24+
"shipmonk/composer-dependency-analyser": "^1.8",
1925
"symplify/phpstan-extensions": "^12.0",
2026
"tomasvotruba/class-leak": "^2.0"
2127
},

config/config.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
__DIR__ . '/../src/RoutingCaseConverter'
3838
)->tag(RoutingCaseConverterInterface::class);
3939

40-
4140
$services->load(
4241
'Symplify\\PhpConfigPrinter\\ServiceOptionConverter\\',
4342
__DIR__ . '/../src/ServiceOptionConverter'

ecs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
return ECSConfig::configure()
88
->withPaths([
9+
__DIR__ . '/config',
910
__DIR__ . '/src',
1011
__DIR__ . '/tests',
1112
])

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ parameters:
2222

2323
# unclear what to do
2424
- '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array<PhpParser\\Node\\ArrayItem>, array<PhpParser\\Node\\Arg> given#'
25+
26+
# runs also on older PHP versions, like 7.4+
27+
-
28+
message: '#Right side of && is always true#'
29+
path: src/NodeFactory/ArgsNodeFactory.php

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@
2424

2525
// old value is needed
2626
\Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector::class,
27-
2827
]);

src/Naming/ReferenceFunctionNameResolver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ final class ReferenceFunctionNameResolver
1717
*/
1818
public static function resolve(): string
1919
{
20+
$symfonyFunctionsFile = getcwd() . '/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php';
21+
22+
if (file_exists($symfonyFunctionsFile)) {
23+
// this file must be included manually, as composer will only load it once function called
24+
require_once $symfonyFunctionsFile;
25+
}
26+
2027
if (function_exists(FunctionName::REF)) {
2128
return FunctionName::REF;
2229
}

0 commit comments

Comments
 (0)