mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 3f1ccb3ea131997a435fc2211620e968c6732220
3f1ccb3ea1
Support @immutable phpdoc in RestoreDefaultNullToNullableTypePropertyRector (#5795)
This commit is contained in:
parent
d4fd813b33
commit
77aab2e2a3
|
@ -62,7 +62,7 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isReadonly()) {
|
||||
if ($this->isReadonlyClass($node)) {
|
||||
return null;
|
||||
}
|
||||
$hasChanged = \false;
|
||||
|
@ -95,7 +95,7 @@ CODE_SAMPLE
|
|||
if ($onlyProperty->default instanceof Expr) {
|
||||
return \true;
|
||||
}
|
||||
if ($this->isReadonly($property)) {
|
||||
if ($this->isReadonlyProperty($property)) {
|
||||
return \true;
|
||||
}
|
||||
if (!$this->nodeTypeResolver->isNullableType($property)) {
|
||||
|
@ -105,7 +105,7 @@ CODE_SAMPLE
|
|||
$propertyName = $this->getName($property);
|
||||
return $this->constructorAssignDetector->isPropertyAssigned($class, $propertyName);
|
||||
}
|
||||
private function isReadonly(Property $property) : bool
|
||||
private function isReadonlyProperty(Property $property) : bool
|
||||
{
|
||||
// native readonly
|
||||
if ($property->isReadonly()) {
|
||||
|
@ -116,4 +116,15 @@ CODE_SAMPLE
|
|||
$tags = $phpDocInfo->getTagsByName('@readonly');
|
||||
return $tags !== [];
|
||||
}
|
||||
private function isReadonlyClass(Class_ $class) : bool
|
||||
{
|
||||
// native readonly
|
||||
if ($class->isReadonly()) {
|
||||
return \true;
|
||||
}
|
||||
// @immutable annotation
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
|
||||
$tags = $phpDocInfo->getTagsByName('@immutable');
|
||||
return $tags !== [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'f889e416d94cbfcf3734bb2fd4daf678aa11f8a9';
|
||||
public const PACKAGE_VERSION = '3f1ccb3ea131997a435fc2211620e968c6732220';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-04-03 07:03:17';
|
||||
public const RELEASE_DATE = '2024-04-03 18:19:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -2450,17 +2450,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/service-contracts",
|
||||
"version": "v3.4.1",
|
||||
"version_normalized": "3.4.1.0",
|
||||
"version": "v3.4.2",
|
||||
"version_normalized": "3.4.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/service-contracts.git",
|
||||
"reference": "fe07cbc8d837f60caf7018068e350cc5163681a0"
|
||||
"reference": "11bbf19a0fb7b36345861e85c5768844c552906e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/service-contracts\/zipball\/fe07cbc8d837f60caf7018068e350cc5163681a0",
|
||||
"reference": "fe07cbc8d837f60caf7018068e350cc5163681a0",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/service-contracts\/zipball\/11bbf19a0fb7b36345861e85c5768844c552906e",
|
||||
"reference": "11bbf19a0fb7b36345861e85c5768844c552906e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2470,7 +2470,7 @@
|
|||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2"
|
||||
},
|
||||
"time": "2023-12-26T14:02:43+00:00",
|
||||
"time": "2023-12-19T21:51:00+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -2515,7 +2515,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/service-contracts\/tree\/v3.4.1"
|
||||
"source": "https:\/\/github.com\/symfony\/service-contracts\/tree\/v3.4.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue