Skip to content

Commit d440dec

Browse files
committed
FIX deprecated converters definitions deprecation for Symfony < 5.1
1 parent fdd80ee commit d440dec

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.3.1] - 2020-11-08
10+
### Fixed
11+
- definition deprecation for *old* service IDs has been corrected for Symfony < 5.1
12+
913
## [1.3.0] - 2020-11-07
1014
### Added
1115
- converter names as services IDs

src/DependencyInjection/Compiler/ConvertersPass.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\DependencyInjection\Definition;
1212
use Symfony\Component\DependencyInjection\Reference;
13+
use Symfony\Component\HttpKernel\Kernel;
1314

1415
/**
1516
* @internal
@@ -73,7 +74,14 @@ private function registerConverters(array $converterConfig, ContainerBuilder $co
7374

7475
$deprecationMessage = 'Using the %service_id% service ID is deprecated and will be removed in v2. ';
7576
$deprecationMessage .= 'You should use the converter name instead.';
76-
$deprecatedConverterDefinition->setDeprecated('aymdev/commonmark-bundle', '1.3.0', $deprecationMessage);
77+
78+
// Symfony <5.1
79+
if (Kernel::MAJOR_VERSION <= 4 || (Kernel::MAJOR_VERSION === 5 && Kernel::MINOR_VERSION === 0)) {
80+
$deprecatedConverterDefinition->setDeprecated(true, $deprecationMessage);
81+
} else {
82+
// Symfony >= 5.1
83+
$deprecatedConverterDefinition->setDeprecated('aymdev/commonmark-bundle', '1.3.0', $deprecationMessage);
84+
}
7785

7886
$converterId = 'aymdev_commonmark.converter.' . $converterConfig['name'];
7987
$container->setDefinition($converterId, $deprecatedConverterDefinition);

0 commit comments

Comments
 (0)