From ff6072c9a93c4be590720b99ddf2b4f8e81d6488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Hansl=C3=ADk?= Date: Fri, 16 Dec 2022 12:29:12 +0100 Subject: [PATCH] Support for unsealed array shapes --- SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php | 2 +- composer.json | 2 +- .../data/shouldBeInUseStatementSearchingInAnnotations.fixed.php | 2 +- .../data/shouldBeInUseStatementSearchingInAnnotations.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php b/SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php index 69920adb7..14e3fdbcc 100644 --- a/SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php +++ b/SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php @@ -420,7 +420,7 @@ public static function change(TypeNode $masterTypeNode, TypeNode $typeNodeToChan $arrayShapeItemNodes[] = self::change($arrayShapeItemNode, $typeNodeToChange, $changedTypeNode); } - return new ArrayShapeNode($arrayShapeItemNodes); + return new ArrayShapeNode($arrayShapeItemNodes, $masterTypeNode->sealed); } if ($masterTypeNode instanceof ArrayShapeItemNode) { diff --git a/composer.json b/composer.json index 3a412c4f8..186005f45 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7.2 || ^8.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "phpstan/phpdoc-parser": ">=1.15.0 <1.16.0", + "phpstan/phpdoc-parser": ">=1.15.2 <1.16.0", "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { diff --git a/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.fixed.php b/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.fixed.php index 6c97edcb9..cfb78a055 100644 --- a/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.fixed.php +++ b/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.fixed.php @@ -135,7 +135,7 @@ public function returnsCallable() /** @var array{int, DateTime} $arrayShape1 */ $arrayShape1 = []; -/** @var array{int: DateTime} $arrayShape2 */ +/** @var array{int: DateTime, ...} $arrayShape2 */ $arrayShape2 = []; /** diff --git a/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.php b/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.php index 28f9229af..51608a4bc 100644 --- a/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.php +++ b/tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.php @@ -114,7 +114,7 @@ public function returnsCallable() /** @var array{int, \Foo\DateTime} $arrayShape1 */ $arrayShape1 = []; -/** @var array{int: \Foo\DateTime} $arrayShape2 */ +/** @var array{int: \Foo\DateTime, ...} $arrayShape2 */ $arrayShape2 = []; /**