mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 526a61b034c626be8c1c86ec5e08c8b64afcde20
526a61b034
[Php83] Skip multiple consts on AddTypeToConstRector when types are different (#5974)
This commit is contained in:
parent
2058e5fc17
commit
b53e3c0d6a
@ -85,7 +85,7 @@ CODE_SAMPLE
|
||||
$parentClassReflections = $this->getParentReflections($className);
|
||||
$hasChanged = \false;
|
||||
foreach ($classConsts as $classConst) {
|
||||
$valueType = null;
|
||||
$valueTypes = [];
|
||||
// If a type is set, skip
|
||||
if ($classConst->type !== null) {
|
||||
continue;
|
||||
@ -97,9 +97,20 @@ CODE_SAMPLE
|
||||
if ($this->canBeInherited($classConst, $node)) {
|
||||
continue;
|
||||
}
|
||||
$valueType = $this->findValueType($constNode->value);
|
||||
$valueTypes[] = $this->findValueType($constNode->value);
|
||||
}
|
||||
if (!($valueType ?? null) instanceof Identifier) {
|
||||
if ($valueTypes === []) {
|
||||
continue;
|
||||
}
|
||||
if (\count($valueTypes) > 1) {
|
||||
$valueTypes = \array_unique($valueTypes, \SORT_REGULAR);
|
||||
}
|
||||
// once more verify after uniquate
|
||||
if (\count($valueTypes) > 1) {
|
||||
continue;
|
||||
}
|
||||
$valueType = \current($valueTypes);
|
||||
if (!$valueType instanceof Identifier) {
|
||||
continue;
|
||||
}
|
||||
$classConst->type = $valueType;
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '9a0d03a293b3a6aef9fb2c134c27586e2f046043';
|
||||
public const PACKAGE_VERSION = '526a61b034c626be8c1c86ec5e08c8b64afcde20';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-06-16 07:09:11';
|
||||
public const RELEASE_DATE = '2024-06-17 10:46:28';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user