Skip to content

Commit 8cd8259

Browse files
committed
Make unit tests compatible to PHP <7.3
1 parent 4682bbf commit 8cd8259

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/src/FakeTagRepository.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,18 @@ public function getLastUsedId(): int
4040
return array_key_last($this->tags);
4141
}
4242

43+
}
44+
45+
/*
46+
* PHP 7.2 Polyfill
47+
*/
48+
if (!\function_exists('array_key_last')) {
49+
function array_key_last(array $array)
50+
{
51+
if (empty($array)) {
52+
return null;
53+
}
54+
55+
return key(array_slice($array, -1, 1, true));
56+
}
4357
}

0 commit comments

Comments
 (0)