Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a283c9d

Browse files
committedFeb 20, 2024
refactor container aware
1 parent 9b775a8 commit a283c9d

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed
 

‎src/PHPCR/Shell/Console/Application/ShellApplication.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPCR\Shell\Console\Command\Phpcr as CommandPhpcr;
1616
use PHPCR\Shell\Console\Command\Phpcr\BasePhpcrCommand;
1717
use PHPCR\Shell\Console\Command\Shell as CommandShell;
18+
use PHPCR\Shell\DependencyInjection\ContainerAwareInterface;
1819
use PHPCR\Shell\Event;
1920
use PHPCR\Shell\Event\ApplicationInitEvent;
2021
use PHPCR\Shell\Event\PhpcrShellEvents;
@@ -26,7 +27,7 @@
2627
use Symfony\Component\Console\Input\ArrayInput;
2728
use Symfony\Component\Console\Input\InputInterface;
2829
use Symfony\Component\Console\Output\OutputInterface;
29-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
30+
use Symfony\Component\DependencyInjection\ContainerBuilder;
3031
use Symfony\Component\EventDispatcher\EventDispatcher;
3132

3233
/**
@@ -42,7 +43,7 @@ class ShellApplication extends Application
4243
protected $showUnsupported = false;
4344

4445
/**
45-
* @var Symfony\Component\DependencyInjection\ContainerBuilder
46+
* @var ContainerBuilder
4647
*/
4748
protected $container;
4849

‎src/PHPCR/Shell/Console/Command/BaseCommand.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212

1313
namespace PHPCR\Shell\Console\Command;
1414

15+
use PHPCR\Shell\DependencyInjection\ContainerAwareInterface;
1516
use Symfony\Component\Console\Command\Command;
16-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;
1818

1919
class BaseCommand extends Command implements ContainerAwareInterface
2020
{
21+
/**
22+
* @var ContainerInterface
23+
*/
2124
private $container;
2225

23-
public function setContainer(ContainerInterface $container = null)
26+
public function setContainer(ContainerInterface $container = null): void
2427
{
2528
$this->container = $container;
2629
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace PHPCR\Shell\DependencyInjection;
13+
14+
use Symfony\Component\DependencyInjection\ContainerInterface;
15+
16+
/**
17+
* This was removed from Symfony in version 7.
18+
*
19+
* We keep using the pattern in the shell commands for now to avoid a complicated refactor.
20+
*
21+
* @author Fabien Potencier <fabien@symfony.com>
22+
*/
23+
interface ContainerAwareInterface
24+
{
25+
public function setContainer(?ContainerInterface $container): void;
26+
}

0 commit comments

Comments
 (0)
Please sign in to comment.