From 61e2d34006db220e8cd818b71a73512120749a27 Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Mon, 6 Jul 2026 11:46:53 +0200 Subject: [PATCH 1/4] Update dependencies and add php 8.5 to ci tests --- .github/workflows/ci.yaml | 2 +- composer.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0c5951..088646f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: 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..eb9e06b 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": "^v4.7.4", + "phpstan/phpstan": "^2.2.5", + "rector/rector": "^2.5.3", "symfony/var-dumper": "^6.4|^7.1.4" }, "autoload": { From 994affaf57f1c4e7c66d75b3ebedc67ee6f08335 Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Mon, 6 Jul 2026 11:50:57 +0200 Subject: [PATCH 2/4] Test on all pushes --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 088646f..cbbe6dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,8 +2,7 @@ name: ci on: push: - branches: - - main + jobs: run: runs-on: ubuntu-latest From 57ababfbd8a66bee7448bbb48ff0c4ba842515f1 Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Mon, 6 Jul 2026 11:54:01 +0200 Subject: [PATCH 3/4] Downgrade pest back to a php 8.2 compatible version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eb9e06b..94d44f7 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "laravel/pint": "^1.17.3", - "pestphp/pest": "^v4.7.4", + "pestphp/pest": "^v3.8.6", "phpstan/phpstan": "^2.2.5", "rector/rector": "^2.5.3", "symfony/var-dumper": "^6.4|^7.1.4" From c2e60e133c5d95f42be99a82671da6ced8785a5f Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Mon, 6 Jul 2026 11:56:29 +0200 Subject: [PATCH 4/4] Apply rector changes --- src/Nodes/ArrayNode.php | 2 ++ src/Nodes/ArrayTableNode.php | 2 ++ src/Nodes/BareNode.php | 2 ++ src/Nodes/BooleanNode.php | 2 ++ src/Nodes/FloatNode.php | 2 ++ src/Nodes/InlineTableNode.php | 2 ++ src/Nodes/IntegerNode.php | 2 ++ src/Nodes/KeyNode.php | 2 ++ src/Nodes/KeyValuePairNode.php | 2 ++ src/Nodes/LocalDateNode.php | 2 ++ src/Nodes/LocalDateTimeNode.php | 2 ++ src/Nodes/LocalTimeNode.php | 2 ++ src/Nodes/Node.php | 2 ++ src/Nodes/NumericNode.php | 2 ++ src/Nodes/OffsetDateTimeNode.php | 2 ++ src/Nodes/RootTableNode.php | 2 ++ src/Nodes/StringNode.php | 2 ++ src/Nodes/TableNode.php | 2 ++ src/Nodes/TomlDateTimeNode.php | 2 ++ src/Nodes/ValuableNode.php | 2 ++ src/Toml.php | 2 ++ src/TomlDateTimeInterface.php | 2 ++ src/TomlDecoder.php | 2 +- src/TomlEncoder.php | 4 ++-- src/TomlInputIterator.php | 2 ++ src/TomlLocalDate.php | 2 +- src/TomlLocalTime.php | 4 ++-- src/TomlNormalizer.php | 2 +- src/TomlObject.php | 2 ++ src/TomlParser.php | 4 ++-- src/TomlTag.php | 4 ++-- src/TomlTokenizer.php | 2 +- src/TomlUtils.php | 2 ++ src/helpers.php | 2 ++ tests/TestCase.php | 2 ++ tests/Unit/TomlDecodeTest.php | 2 ++ tests/Unit/TomlEncodeTest.php | 2 ++ tests/Unit/TomlErrorTest.php | 2 ++ 38 files changed, 72 insertions(+), 12 deletions(-) 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 @@