Skip to content

Commit b4bcbfa

Browse files
authored
Merge pull request #214 from JonasKraska/adding-php-8.2-support
Adding php 8.2 support
2 parents 1dba6b6 + b6922ec commit b4bcbfa

File tree

9 files changed

+113
-113
lines changed

9 files changed

+113
-113
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"description": "Hashmap and Collection",
55
"license": "MIT",
66
"require": {
7-
"php": "~7.4.0 || ~8.0.0 || ~8.1.0",
7+
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
88
"webmozart/assert": "^1.9"
99
},
1010
"require-dev": {
1111
"doctrine/coding-standard": "^11.1",
12-
"phpunit/phpunit": "^9.5",
12+
"phpunit/phpunit": "^9.6",
1313
"psalm/plugin-phpunit": "^0.18.4",
1414
"symfony/polyfill-php80": "^1.22",
1515
"vimeo/psalm": "^5.9"

composer.lock

Lines changed: 25 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment"/>
3333
<!-- Can be removed with dropping support for PHP 7.4 -->
3434
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator.RequiredNullCoalesceEqualOperator"/>
35+
<!-- Static callables are deprecated as of PHP 8.2 -->
36+
<exclude name="SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic"/>
3537
</rule>
3638
</ruleset>

src/Array_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function count(): int
8484
*/
8585
protected function valueComparator(): callable
8686
{
87-
return static function ($a, $b): int {
87+
return function ($a, $b): int {
8888
if (! is_object($a) || ! is_object($b)) {
8989
return $a <=> $b;
9090
}

src/Map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function diffKeys(MapInterface $other, ?callable $keyComparator = null):
112112
*/
113113
private function keyComparator(): callable
114114
{
115-
return static function (string $a, string $b): int {
115+
return function (string $a, string $b): int {
116116
return strcmp($a, $b);
117117
};
118118
}

src/OrderedList.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function toMap(callable $keyGenerator): MapInterface
188188
public function removeElement($element): OrderedListInterface
189189
{
190190
return $this->filter(
191-
static function ($value) use ($element): bool {
191+
function ($value) use ($element): bool {
192192
return $value !== $element;
193193
},
194194
);
@@ -219,14 +219,12 @@ public function unify(
219219
?callable $unificationIdentifierGenerator = null,
220220
?callable $callback = null
221221
): OrderedListInterface {
222-
/** @psalm-suppress MissingClosureParamType */
222+
/**
223+
* @psalm-suppress MissingClosureParamType
224+
* @psalm-var callable(mixed):non-empty-string $unificationIdentifierGenerator
225+
*/
223226
$unificationIdentifierGenerator = $unificationIdentifierGenerator
224-
?? static function ($value): string {
225-
$hash = hash('sha256', serialize($value));
226-
Assert::stringNotEmpty($hash);
227-
228-
return $hash;
229-
};
227+
?? fn ($value): string => hash('sha256', serialize($value));
230228

231229
$instance = clone $this;
232230

@@ -302,7 +300,7 @@ private function createListFilledWithValues(int $start, int $amount, $value): ar
302300
* @psalm-suppress MissingClosureReturnType We have to assume that the value contains the fill value.
303301
* @return TValue
304302
*/
305-
$callable = static fn () => $value;
303+
$callable = fn () => $value;
306304
}
307305

308306
for ($index = $start; $index < $amount; $index++) {
@@ -471,6 +469,6 @@ public function prepend($value): OrderedListInterface
471469

472470
public function removeAt(int $index): OrderedListInterface
473471
{
474-
return $this->filter(static fn ($_, int $i) => $i !== $index);
472+
return $this->filter(fn ($_, int $i) => $i !== $index);
475473
}
476474
}

tests/ForAllPromiseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class ForAllPromiseTest extends TestCase
1212
public function testWillNotExecuteTwiceDueToDestructionOfObject(): void
1313
{
1414
$executed = false;
15-
$task = static function () use (&$executed): void {
15+
$task = function () use (&$executed): void {
1616
self::assertFalse($executed, 'Task was executed more than once!');
1717
$executed = true;
1818
};

0 commit comments

Comments
 (0)