From b0251feb1643853329077be044505e22ab62f20b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 8 Nov 2023 12:07:04 +0000 Subject: [PATCH] Updated Rector to commit 437f96a264be9b974d2c5abcc4f5097bfb57b20e https://github.com/rectorphp/rector-src/commit/437f96a264be9b974d2c5abcc4f5097bfb57b20e RestoreDefaultNullToNullableTypePropertyRector: skip `@readonly` phpdoc (#5233) --- ...storeDefaultNullToNullableTypePropertyRector.php | 13 ++++++++++++- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php index 95943ee6e75..899f98a86d6 100644 --- a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php +++ b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php @@ -88,7 +88,7 @@ CODE_SAMPLE if ($onlyProperty->default instanceof Expr) { return \true; } - if ($property->isReadonly()) { + if ($this->isReadonly($property)) { return \true; } if (!$this->nodeTypeResolver->isNullableType($property)) { @@ -98,4 +98,15 @@ CODE_SAMPLE $propertyName = $this->getName($property); return $this->constructorAssignDetector->isPropertyAssigned($class, $propertyName); } + private function isReadonly(Property $property) : bool + { + // native readonly + if ($property->isReadonly()) { + return \true; + } + // @readonly annotation + $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property); + $tags = $phpDocInfo->getTagsByName('@readonly'); + return $tags !== []; + } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index c8ef76a8bc4..19aa34b5f56 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'cb1b0c7348d1e80806b2e600823dbfa38b9836c7'; + public const PACKAGE_VERSION = '437f96a264be9b974d2c5abcc4f5097bfb57b20e'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-11-07 22:49:21'; + public const RELEASE_DATE = '2023-11-08 19:04:48'; /** * @var int */