diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0c5951..cbbe6dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,14 +2,13 @@ name: ci on: push: - branches: - - main + jobs: run: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["8.2", "8.3", "8.4"] + php-versions: ["8.2", "8.3", "8.4", "8.5"] name: PHP ${{ matrix.php-versions }} steps: - name: Checkout diff --git a/composer.json b/composer.json index 2e17fcc..94d44f7 100644 --- a/composer.json +++ b/composer.json @@ -19,9 +19,9 @@ }, "require-dev": { "laravel/pint": "^1.17.3", - "pestphp/pest": "^2.35.1", - "phpstan/phpstan": "^1.12.2", - "rector/rector": "^1.2.4", + "pestphp/pest": "^v3.8.6", + "phpstan/phpstan": "^2.2.5", + "rector/rector": "^2.5.3", "symfony/var-dumper": "^6.4|^7.1.4" }, "autoload": { diff --git a/src/Nodes/ArrayNode.php b/src/Nodes/ArrayNode.php index 72a0abf..7bab883 100644 --- a/src/Nodes/ArrayNode.php +++ b/src/Nodes/ArrayNode.php @@ -1,5 +1,7 @@ self::toArray($value), (array) $object); + return array_map(self::toArray(...), (array) $object); } return $object; diff --git a/src/TomlEncoder.php b/src/TomlEncoder.php index 8a02a5a..06e7446 100644 --- a/src/TomlEncoder.php +++ b/src/TomlEncoder.php @@ -83,7 +83,7 @@ protected static function stringifyTable(object $obj, string $prefix = ''): stri } $type = self::extendedTypeOf($obj->{$k}); - $key = preg_match(self::BARE_KEY, $k) ? $k : self::formatString($k); + $key = preg_match(self::BARE_KEY, (string) $k) ? $k : self::formatString($k); if ($type === 'array' && self::isArrayOfTables($obj->{$k})) { $tables .= self::stringifyArrayTable($obj->{$k}, $prefix !== '' && $prefix !== '0' ? "$prefix.$key" : $key); } elseif ($type === 'object') { @@ -205,7 +205,7 @@ protected static function stringifyInlineTable(array|stdClass $obj): string if ($i !== 0) { $res .= ', '; } - $res .= preg_match(self::BARE_KEY, $k) ? $k : self::formatString($k); + $res .= preg_match(self::BARE_KEY, (string) $k) ? $k : self::formatString($k); $res .= ' = '; $res .= self::stringifyValue($obj->{$k}); } diff --git a/src/TomlInputIterator.php b/src/TomlInputIterator.php index a1c8802..279e47e 100644 --- a/src/TomlInputIterator.php +++ b/src/TomlInputIterator.php @@ -1,5 +1,7 @@ self::normalize($element), $items); + return array_map(self::normalize(...), $items); } /** diff --git a/src/TomlObject.php b/src/TomlObject.php index c640233..754c8fe 100644 --- a/src/TomlObject.php +++ b/src/TomlObject.php @@ -1,5 +1,7 @@ $token->value, $tokens)); - $lastTokenValue = strtolower($tokens[count($tokens) - 1]->value); + $lastTokenValue = strtolower((string) $tokens[count($tokens) - 1]->value); if (str_ends_with($lastTokenValue, 'z')) { return new OffsetDateTimeNode($this->parseDate($value)); @@ -429,7 +429,7 @@ protected function parseInteger( } $octalOrBinary = ($radix === 8 && $char === 'o') || ($radix === 2 && $char === 'b'); - if (! ($i === 1 && $octalOrBinary) && ! $this->digitalChecks($radix, $char)) { + if (($i !== 1 || ! $octalOrBinary) && ! $this->digitalChecks($radix, $char)) { break; } diff --git a/src/TomlTag.php b/src/TomlTag.php index 24bf70d..bea90d7 100644 --- a/src/TomlTag.php +++ b/src/TomlTag.php @@ -61,7 +61,7 @@ public static function tagObject(mixed $obj): array|stdClass } if (is_array($obj)) { - return array_map(static fn ($item) => self::tagObject($item), $obj); + return array_map(self::tagObject(...), $obj); } $tagged = new stdClass; @@ -84,7 +84,7 @@ public static function tagObject(mixed $obj): array|stdClass public static function untagObject($obj) { if (is_array($obj)) { - return array_map(static fn ($item) => self::untagObject($item), $obj); + return array_map(self::untagObject(...), $obj); } if (property_exists($obj, 'type') && property_exists($obj, 'value') && count(get_object_vars($obj)) === 2) { diff --git a/src/TomlTokenizer.php b/src/TomlTokenizer.php index a0b3eab..e6d210f 100644 --- a/src/TomlTokenizer.php +++ b/src/TomlTokenizer.php @@ -355,7 +355,7 @@ protected function scanBasicString(): TomlToken */ public function sequence(...$types): array { - return array_map(fn ($type) => $this->expect($type), $types); + return array_map($this->expect(...), $types); } /** diff --git a/src/TomlUtils.php b/src/TomlUtils.php index 50ea2ed..c98106f 100644 --- a/src/TomlUtils.php +++ b/src/TomlUtils.php @@ -1,5 +1,7 @@