From f91f50b6cc64549df5e760c2733fc1c827791105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=A4thge?= Date: Mon, 29 Jun 2026 11:55:27 +0200 Subject: [PATCH 1/2] Add JsonSerializable methods to type mapping --- .../ClassMethod/AddReturnTypeWillChangeAttributeRector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector.php b/rules/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector.php index 80f60fde..ac8cf356 100644 --- a/rules/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector.php +++ b/rules/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector.php @@ -35,6 +35,7 @@ final class AddReturnTypeWillChangeAttributeRector extends AbstractRector 'Countable' => ['count'], 'Iterator' => ['current', 'key', 'next', 'rewind', 'valid'], 'IteratorAggregate' => ['getIterator'], + 'JsonSerializable' => ['jsonSerialize'], 'Stringable' => ['__toString'], ]; From 5c41a6dad1eecc30f1e4b6ec085e1406c55a380e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=A4thge?= Date: Mon, 29 Jun 2026 11:59:05 +0200 Subject: [PATCH 2/2] Add test for JsonSerializable --- .../Fixture/json_serializable.php.inc | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 rules-tests/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector/Fixture/json_serializable.php.inc diff --git a/rules-tests/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector/Fixture/json_serializable.php.inc b/rules-tests/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector/Fixture/json_serializable.php.inc new file mode 100644 index 00000000..a3caa9d1 --- /dev/null +++ b/rules-tests/DowngradePhp81/Rector/ClassMethod/AddReturnTypeWillChangeAttributeRector/Fixture/json_serializable.php.inc @@ -0,0 +1,26 @@ + +----- +