Skip to content

Commit 951af2e

Browse files
committed
Update test tools
1 parent 889001e commit 951af2e

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/master.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- '8.2'
1616
- '8.3'
1717
- '8.4'
18+
- '8.5'
1819
steps:
1920
- name: Checkout repository
2021
uses: actions/checkout@v4
@@ -44,7 +45,7 @@ jobs:
4445
- name: Run tests
4546
run: |
4647
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
47-
if [[ "${{ matrix.php }}" == '8.1' ]]; then
48+
if [[ "${{ matrix.php }}" == '8.5' ]]; then
4849
composer require --dev --no-interaction --no-progress --quiet scrutinizer/ocular
4950
vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
5051
fi

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
"ext-json": "*"
2121
},
2222
"require-dev": {
23-
"inspirum/coding-standard": "^1.6",
23+
"inspirum/coding-standard": "^1.8",
2424
"phpstan/phpstan": "^2.0",
25-
"phpunit/phpunit": "^10.5 || ^11.0",
26-
"shipmonk/composer-dependency-analyser": "^1.8",
27-
"squizlabs/php_codesniffer": "^3.11"
25+
"phpunit/phpunit": "^10.5 || ^11.5 || ^12.5 || ^13.0",
26+
"shipmonk/composer-dependency-analyser": "^1.8"
2827
},
2928
"autoload": {
3029
"psr-4": {

src/Convertor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use RuntimeException;
88
use UnexpectedValueException;
99
use stdClass;
10+
use function is_int;
1011
use function is_iterable;
12+
use function is_string;
1113
use const PHP_INT_MAX;
1214

1315
final class Convertor
@@ -56,6 +58,10 @@ private static function toArrayWithDepth(mixed $data, int $limit, int $depth): m
5658
if (is_iterable($data)) {
5759
$arrayData = [];
5860
foreach ($data as $k => $v) {
61+
if (!is_int($k) && !is_string($k)) {
62+
throw new RuntimeException('Iterable key must be int|string');
63+
}
64+
5965
$arrayData[$k] = self::toArrayWithDepth($v, $limit, $depth + 1);
6066
}
6167

0 commit comments

Comments
 (0)