Skip to content

Commit

Permalink
fix: compatibility with symfony/dependency-injection 7.1.4 (#95)
Browse files Browse the repository at this point in the history
* fix: compatibility with `symfony/dependency-injection` 7.1.4

* satisfy phpstan

* dep
  • Loading branch information
priyadi authored Sep 1, 2024
1 parent 444dc07 commit 79d4d31
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.5.6

* fix: compatibility with `symfony/dependency-injection` 7.1.4

## 1.5.5

* build: add rector
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"symfony/clock": "^6.4 || ^7.0",
"symfony/config": "^6.4 || ^7.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4.11 || ^6.5 || ^7.1.4 || ^7.2",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "6.4.0 - 6.4.8 || 7.0.0 - 7.0.8 || 7.1.0 - 7.1.1 || ^7.2",
"symfony/serializer": "^6.4 || ^7.0",
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ parameters:
# constants: true
ignoreErrors:
- '#ContainerBuilder::registerAttributeForAutoconfiguration#'
-
message: '#Property .* is never assigned .+ so it can be removed from the property type.#'
reportUnmatched: false
banned_code:
non_ignorable: false
includes:
Expand Down
14 changes: 3 additions & 11 deletions src/DependencyInjection/CompilerPass/DebugPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,31 @@ public function process(ContainerBuilder $container): void
foreach (array_keys($taggedServices) as $serviceId) {
$decoratedServiceId = 'debug.' . $serviceId;

$service = $container->getDefinition($serviceId);
/** @var array<string,mixed> */
$tagAttributes = $service->getTag('rekalogika.mapper.transformer')[0] ?? [];
$service->clearTag('rekalogika.mapper.transformer');

$container->register($decoratedServiceId, TraceableTransformer::class)
->setDecoratedService($serviceId)
->addTag('rekalogika.mapper.transformer', $tagAttributes)
->setArguments([
$service,
new Reference($decoratedServiceId . '.inner'),
$dataCollector,
]);
}

// decorates ObjectToObjectMetadataFactory

$serviceId = 'rekalogika.mapper.object_to_object_metadata_factory.cache';
$decoratedService = $container->getDefinition($serviceId);
$container->register('debug.' . $serviceId, TraceableObjectToObjectMetadataFactory::class)
->setDecoratedService($serviceId)
->setArguments([
$decoratedService,
new Reference('debug.' . $serviceId . '.inner'),
$dataCollector,
]);

// decorates mapping factory

$serviceId = 'rekalogika.mapper.mapping_factory';
$decoratedService = $container->getDefinition($serviceId);
$container->register('debug.' . $serviceId, TraceableMappingFactory::class)
->setDecoratedService($serviceId, null, 50)
->setArguments([
$decoratedService,
new Reference('debug.' . $serviceId . '.inner'),
$dataCollector,
])
->addTag('kernel.reset', ['method' => 'reset']);
Expand Down

0 comments on commit 79d4d31

Please sign in to comment.