Skip to content

Commit 3ea3a64

Browse files
committed
Switch to psr/container:2.0 and PHP8+
1 parent fb7ea3f commit 3ea3a64

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
php: [ '7.1', '7.2', '7.3', '7.4', '8.0' ]
9+
php: [ '8.0' ]
1010

1111
steps:
1212
- uses: actions/checkout@master

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"simple"
1212
],
1313
"require": {
14-
"php": ">=7.1",
15-
"psr/container": "^1.0"
14+
"php": "^8.0",
15+
"psr/container": "^2.0"
1616
},
1717
"require-dev": {
1818
"peridot-php/peridot": "^1.19"

src/ArrayContainer.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77

88
final class ArrayContainer implements ContainerInterface
99
{
10-
/**
11-
* @var mixed[]
12-
*/
13-
private $services;
10+
private array $services;
1411

1512
/**
16-
* @param mixed[] $services
13+
* @param array<string,mixed> $services
1714
*/
1815
public function __construct(array $services = [])
1916
{
@@ -31,7 +28,7 @@ public function __construct(array $services = [])
3128
*
3229
* @return bool
3330
*/
34-
public function has($id)
31+
public function has(string $id): bool
3532
{
3633
return array_key_exists($id, $this->services);
3734
}
@@ -45,7 +42,7 @@ public function has($id)
4542
*
4643
* @return mixed Entry.
4744
*/
48-
public function get($id)
45+
public function get(string $id): mixed
4946
{
5047
if (array_key_exists($id, $this->services)) {
5148
return $this->services[$id];
@@ -62,15 +59,15 @@ public function get($id)
6259
*
6360
* @return void
6461
*/
65-
public function set($id, $entry)
62+
public function set(string $id, mixed $entry): void
6663
{
6764
$this->services[$id] = $entry;
6865
}
6966

7067
/**
7168
* Return an associative array of all container entries.
7269
*
73-
* @return mixed[]
70+
* @return array<string,mixed>
7471
*/
7572
public function toArray(): array
7673
{

0 commit comments

Comments
 (0)