Skip to content

Commit a94b3a4

Browse files
committed
feature #266 Fix support for PHP 8.1 (glensc, come-nc, fabpot)
This PR was merged into the main branch. Discussion ---------- Fix support for PHP 8.1 Avoid deprecated warnings about Iterator and ArrayAccess interfaces methods typing. Commits ------- 7a4a44b Fix return types dade71d Fix support for PHP 8.1 8c28b6e Add php 8.1 to CI testing
2 parents 511acc1 + 7a4a44b commit a94b3a4

4 files changed

Lines changed: 30 additions & 1 deletion

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- "7.3"
1717
- "7.4"
1818
- "8.0"
19+
- "8.1"
1920
dependencies:
2021
- "psr/container:^1.1"
2122
- "psr/container:^2.0"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"psr/container": "^1.1 || ^2.0"
1717
},
1818
"require-dev": {
19-
"symfony/phpunit-bridge": "^5.0"
19+
"symfony/phpunit-bridge": "^5.4@dev"
2020
},
2121
"autoload": {
2222
"psr-0": { "Pimple": "src/" }

src/Pimple/Container.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ public function __construct(array $values = [])
7474
* @param string $id The unique identifier for the parameter or object
7575
* @param mixed $value The value of the parameter or a closure to define an object
7676
*
77+
* @return void
78+
*
7779
* @throws FrozenServiceException Prevent override of a frozen service
7880
*/
81+
#[\ReturnTypeWillChange]
7982
public function offsetSet($id, $value)
8083
{
8184
if (isset($this->frozen[$id])) {
@@ -95,6 +98,7 @@ public function offsetSet($id, $value)
9598
*
9699
* @throws UnknownIdentifierException If the identifier is not defined
97100
*/
101+
#[\ReturnTypeWillChange]
98102
public function offsetGet($id)
99103
{
100104
if (!isset($this->keys[$id])) {
@@ -130,6 +134,7 @@ public function offsetGet($id)
130134
*
131135
* @return bool
132136
*/
137+
#[\ReturnTypeWillChange]
133138
public function offsetExists($id)
134139
{
135140
return isset($this->keys[$id]);
@@ -139,7 +144,10 @@ public function offsetExists($id)
139144
* Unsets a parameter or an object.
140145
*
141146
* @param string $id The unique identifier for the parameter or object
147+
*
148+
* @return void
142149
*/
150+
#[\ReturnTypeWillChange]
143151
public function offsetUnset($id)
144152
{
145153
if (isset($this->keys[$id])) {

src/Pimple/ServiceIterator.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,46 @@ public function __construct(Container $container, array $ids)
4242
$this->ids = $ids;
4343
}
4444

45+
/**
46+
* @return void
47+
*/
48+
#[\ReturnTypeWillChange]
4549
public function rewind()
4650
{
4751
\reset($this->ids);
4852
}
4953

54+
/**
55+
* @return mixed
56+
*/
57+
#[\ReturnTypeWillChange]
5058
public function current()
5159
{
5260
return $this->container[\current($this->ids)];
5361
}
5462

63+
/**
64+
* @return mixed
65+
*/
66+
#[\ReturnTypeWillChange]
5567
public function key()
5668
{
5769
return \current($this->ids);
5870
}
5971

72+
/**
73+
* @return void
74+
*/
75+
#[\ReturnTypeWillChange]
6076
public function next()
6177
{
6278
\next($this->ids);
6379
}
6480

81+
/**
82+
* @return bool
83+
*/
84+
#[\ReturnTypeWillChange]
6585
public function valid()
6686
{
6787
return null !== \key($this->ids);

0 commit comments

Comments
 (0)