Skip to content

Commit 5f1810b

Browse files
committed
Symfony 7
1 parent b277f5a commit 5f1810b

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

Helper/ArrayHelper.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,18 @@ public static function without(array $array, ...$keys): array
3333
}
3434

3535
/**
36-
* @psalm-suppress InvalidArrayOffset
37-
*
3836
* @param string ...$keys
3937
*/
4038
public static function remove(array &$array, ...$keys): array
4139
{
4240
$newArray = [];
43-
foreach (array_keys($newArray) as $key) {
44-
if (!in_array($key, $keys)) {
41+
foreach (array_keys($array) as $key) {
42+
if (in_array($key, $keys)) {
4543
$newArray[$key] = $array[$key];
4644
unset($array[$key]);
4745
}
4846
}
4947

50-
foreach ($keys as $key) {
51-
if (!array_key_exists($key, $newArray)) {
52-
$newArray[$key] = null;
53-
}
54-
}
55-
5648
return $newArray;
5749
}
5850
}

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ $ composer req secretary/core
3030

3131
| Version (X.Y.Z) | PHP | Symfony | Comment |
3232
|:---------------:|:----------:|:----------:|:--------------------|
33-
| `2.*` | `>= 8.1.0` | `5.4, 6.0` | **Current version** |
33+
| `3.*` | `>= 8.1.0` | `7.0` | **Current version** |
34+
| `2.*` | `>= 8.1.0` | `5.4, 6.0` | Previous version |
3435
| `1.*` | `>= 7.4.0` | `5.3` | Previous version |
3536

3637
By itself, the core is useless. You will also need to add at least one adapter:

Secret.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,17 @@
1313
use Secretary\Exception\ValueNotSupportedException;
1414

1515
/**
16-
* @package Secretary
16+
* @implements \ArrayAccess<string, mixed>
1717
*/
1818
class Secret implements \ArrayAccess
1919
{
2020
private string $key;
2121

22-
/**
23-
* @var array|string
24-
*/
25-
private $value;
22+
private array|string $value;
2623

27-
private ?array $metadata = null;
24+
private ?array $metadata;
2825

29-
/**
30-
* @param array|string $value
31-
*/
32-
public function __construct(string $key, $value, ?array $metadata = null)
26+
public function __construct(string $key, array|string $value, ?array $metadata = null)
3327
{
3428
$this->key = $key;
3529
$this->value = $value;
@@ -55,15 +49,13 @@ public function getMetadata(): array
5549
}
5650

5751
/**
58-
* @param mixed $offset
5952
*/
6053
public function offsetExists($offset): bool
6154
{
6255
return is_array($this->value) && array_key_exists($offset, $this->value);
6356
}
6457

6558
/**
66-
* @param mixed $offset
6759
*
6860
* @throws ValueNotSupportedException
6961
*/

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"minimum-stability": "stable",
2020
"require": {
2121
"php": "^8.0",
22-
"symfony/options-resolver": "^5.4 || ^6.0"
22+
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0"
2323
},
2424
"require-dev": {
2525
"phpunit/phpunit": "^9.0",

0 commit comments

Comments
 (0)