Skip to content

Commit 6544153

Browse files
committed
Only support hyperf 3.0
1 parent 388655a commit 6544153

File tree

8 files changed

+19
-18
lines changed

8 files changed

+19
-18
lines changed

.php-cs-fixer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
'constant_case' => [
6666
'case' => 'lower',
6767
],
68+
'global_namespace_import' => [
69+
'import_classes' => true,
70+
'import_constants' => true,
71+
'import_functions' => true,
72+
],
6873
'class_attributes_separation' => true,
6974
'combine_consecutive_unsets' => true,
7075
'declare_strict_types' => true,

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
}
2121
},
2222
"require": {
23-
"php": ">=7.4",
23+
"php": ">=8.0",
2424
"doctrine/instantiator": "^1.0",
25-
"hyperf/utils": "^2.2|^3.0",
25+
"hyperf/context": "^3.0",
26+
"hyperf/contract": "^3.0",
2627
"pimple/pimple": "^3.3"
2728
},
2829
"require-dev": {

src/Container.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,13 @@
2424

2525
class Container implements ContainerInterface
2626
{
27-
/**
28-
* @var Pimple\Container
29-
*/
30-
protected $pimple;
31-
3227
/**
3328
* @var ReflectionClass[]
3429
*/
3530
protected $reflection = [];
3631

37-
public function __construct(Pimple\Container $pimple)
32+
public function __construct(protected Pimple\Container $pimple)
3833
{
39-
$this->pimple = $pimple;
4034
$this->pimple[ContainerInterface::class] = $this;
4135
$this->pimple[PsrContainerInterface::class] = $this;
4236
}

src/ContainerFactory.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@
1111
*/
1212
namespace Hyperf\Pimple;
1313

14-
use Hyperf\Utils\ApplicationContext;
14+
use Hyperf\Context\ApplicationContext;
1515
use Pimple;
1616

1717
class ContainerFactory
1818
{
19-
protected $providers = [];
20-
21-
public function __construct(array $providers = [])
19+
public function __construct(protected array $providers = [])
2220
{
23-
$this->providers = $providers;
2421
}
2522

2623
public function __invoke()

src/Exception/InvalidDefinitionException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
*/
1212
namespace Hyperf\Pimple\Exception;
1313

14+
use Exception;
1415
use Psr\Container\ContainerExceptionInterface;
1516

16-
class InvalidDefinitionException extends \Exception implements ContainerExceptionInterface
17+
class InvalidDefinitionException extends Exception implements ContainerExceptionInterface
1718
{
1819
}

src/Exception/NotFoundException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
namespace Hyperf\Pimple\Exception;
1313

1414
use Psr\Container\NotFoundExceptionInterface;
15+
use RuntimeException;
1516

16-
class NotFoundException extends \RuntimeException implements NotFoundExceptionInterface
17+
class NotFoundException extends RuntimeException implements NotFoundExceptionInterface
1718
{
1819
}

src/Exception/NotSupportException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
*/
1212
namespace Hyperf\Pimple\Exception;
1313

14+
use Exception;
1415
use Psr\Container\ContainerExceptionInterface;
1516

16-
class NotSupportException extends \Exception implements ContainerExceptionInterface
17+
class NotSupportException extends Exception implements ContainerExceptionInterface
1718
{
1819
}

tests/Cases/ContainerFactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Hyperf\Utils\ApplicationContext;
1717
use HyperfTest\Stub\BarProvider;
1818
use HyperfTest\Stub\Foo;
19+
use Mockery;
1920
use Psr\Container\ContainerInterface;
2021

2122
/**
@@ -26,7 +27,7 @@ class ContainerFactoryTest extends AbstractTestCase
2627
{
2728
public function testContainerFactory()
2829
{
29-
ApplicationContext::setContainer(\Mockery::mock(ContainerInterface::class));
30+
ApplicationContext::setContainer(Mockery::mock(ContainerInterface::class));
3031

3132
$container = (new ContainerFactory())();
3233

0 commit comments

Comments
 (0)