Skip to content

Commit 0e61f73

Browse files
authored
chore: Remove the ResettableContainerInterface artifcats (#216)
`ResettableContainerInterface` was a legacy piece from Symfony 4.4 which is no longer needed. To also clarify the existence of `ResetInterface`, `symfony/service-contracts` is made into a direct dependency rather than a transitive one.
1 parent 651a50f commit 0e61f73

3 files changed

Lines changed: 4 additions & 27 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"symfony/dependency-injection": "^5.4 || ^6.0",
2323
"symfony/deprecation-contracts": "^2.5 || ^3.1",
2424
"symfony/process": "^5.4 || ^6.0",
25+
"symfony/service-contracts": "^3.3",
2526
"thecodingmachine/safe": "^1.3.3 || ^2.4",
2627
"webmozart/assert": "^1.5"
2728
},

phpstan-src.neon.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ parameters:
44
- bin/set-composer-conflicts.php
55
- src
66
ignoreErrors:
7-
- path: src/ErrorHandler/ResetServiceErrorHandler.php
8-
message: '#ResettableContainerInterface#'
9-
107
# This is due to usages of func_get_args()
118
- path: src/Logger/DecoratorLogger.php
129
message: '#Parameter \#1#'

src/ErrorHandler/ResetServiceErrorHandler.php

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,17 @@
1414
namespace Webmozarts\Console\Parallelization\ErrorHandler;
1515

1616
use Psr\Container\ContainerInterface;
17-
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
1817
use Symfony\Contracts\Service\ResetInterface;
1918
use Throwable;
2019
use Webmozarts\Console\Parallelization\Logger\Logger;
21-
use function interface_exists;
2220

2321
final class ResetServiceErrorHandler implements ErrorHandler
2422
{
25-
/**
26-
* @var ResetInterface|ResettableContainerInterface
27-
*/
28-
private $resettable;
23+
private ResetInterface $resettable;
2924
private ErrorHandler $decoratedErrorHandler;
3025

31-
/**
32-
* @param ResetInterface|ResettableContainerInterface $resettable
33-
*/
3426
public function __construct(
35-
$resettable,
27+
ResetInterface $resettable,
3628
?ErrorHandler $decoratedErrorHandler = null
3729
) {
3830
$this->resettable = $resettable;
@@ -41,7 +33,7 @@ public function __construct(
4133

4234
public static function forContainer(?ContainerInterface $container): ErrorHandler
4335
{
44-
return null !== $container && self::isResettable($container)
36+
return $container instanceof ResetInterface
4537
? new self($container)
4638
: new NullErrorHandler();
4739
}
@@ -52,17 +44,4 @@ public function handleError(string $item, Throwable $throwable, Logger $logger):
5244

5345
return $this->decoratedErrorHandler->handleError($item, $throwable, $logger);
5446
}
55-
56-
private static function isResettable(ContainerInterface $container): bool
57-
{
58-
return (
59-
interface_exists(ResetInterface::class)
60-
&& $container instanceof ResetInterface
61-
)
62-
// TODO: to remove once we drop Symfony 4.4 support.
63-
|| (
64-
interface_exists(ResettableContainerInterface::class)
65-
&& $container instanceof ResettableContainerInterface
66-
);
67-
}
6847
}

0 commit comments

Comments
 (0)