Updated Rector to commit 8bc80b4641429cfcea9a413ff9eb1bd9afaae9ee

8bc80b4641 Add readonly by default on new promoted property (#6650)
This commit is contained in:
Tomas Votruba 2025-01-05 17:39:40 +00:00
parent 40b5c4746e
commit 4405ec5ff8
5 changed files with 20 additions and 9 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '2e82ab4969246050e9fe47df0cf549cc96fdbfd5'; public const PACKAGE_VERSION = '8bc80b4641429cfcea9a413ff9eb1bd9afaae9ee';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2025-01-06 00:05:08'; public const RELEASE_DATE = '2025-01-05 18:37:06';
/** /**
* @var int * @var int
*/ */

View File

@ -44,10 +44,12 @@ use Rector\Exception\NotImplementedYetException;
use Rector\Exception\ShouldNotHappenException; use Rector\Exception\ShouldNotHappenException;
use Rector\NodeDecorator\PropertyTypeDecorator; use Rector\NodeDecorator\PropertyTypeDecorator;
use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php\PhpVersionProvider;
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PostRector\ValueObject\PropertyMetadata; use Rector\PostRector\ValueObject\PropertyMetadata;
use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\ValueObject\PhpVersionFeature;
/** /**
* @see \Rector\Tests\PhpParser\Node\NodeFactoryTest * @see \Rector\Tests\PhpParser\Node\NodeFactoryTest
*/ */
@ -73,17 +75,22 @@ final class NodeFactory
* @readonly * @readonly
*/ */
private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; private SimpleCallableNodeTraverser $simpleCallableNodeTraverser;
/**
* @readonly
*/
private PhpVersionProvider $phpVersionProvider;
/** /**
* @var string * @var string
*/ */
private const THIS = 'this'; private const THIS = 'this';
public function __construct(BuilderFactory $builderFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, PropertyTypeDecorator $propertyTypeDecorator, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) public function __construct(BuilderFactory $builderFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, PropertyTypeDecorator $propertyTypeDecorator, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, PhpVersionProvider $phpVersionProvider)
{ {
$this->builderFactory = $builderFactory; $this->builderFactory = $builderFactory;
$this->phpDocInfoFactory = $phpDocInfoFactory; $this->phpDocInfoFactory = $phpDocInfoFactory;
$this->staticTypeMapper = $staticTypeMapper; $this->staticTypeMapper = $staticTypeMapper;
$this->propertyTypeDecorator = $propertyTypeDecorator; $this->propertyTypeDecorator = $propertyTypeDecorator;
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
$this->phpVersionProvider = $phpVersionProvider;
} }
/** /**
* @param string|ObjectReference::* $className * @param string|ObjectReference::* $className
@ -275,6 +282,10 @@ final class NodeFactory
$param = $paramBuilder->getNode(); $param = $paramBuilder->getNode();
$propertyFlags = $propertyMetadata->getFlags(); $propertyFlags = $propertyMetadata->getFlags();
$param->flags = $propertyFlags !== 0 ? $propertyFlags : Modifiers::PRIVATE; $param->flags = $propertyFlags !== 0 ? $propertyFlags : Modifiers::PRIVATE;
// make readonly by default
if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::READONLY_PROPERTY)) {
$param->flags |= Modifiers::READONLY;
}
return $param; return $param;
} }
public function createFalse() : ConstFetch public function createFalse() : ConstFetch

View File

@ -1866,12 +1866,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git", "url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "29a1abf5d8e8d6150dabe6e79e001a34236e9499" "reference": "f7e0a140e1f6d30252f950b05da1fc89776468eb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/29a1abf5d8e8d6150dabe6e79e001a34236e9499", "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/f7e0a140e1f6d30252f950b05da1fc89776468eb",
"reference": "29a1abf5d8e8d6150dabe6e79e001a34236e9499", "reference": "f7e0a140e1f6d30252f950b05da1fc89776468eb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1896,7 +1896,7 @@
"tomasvotruba\/class-leak": "^1.0", "tomasvotruba\/class-leak": "^1.0",
"tracy\/tracy": "^2.10" "tracy\/tracy": "^2.10"
}, },
"time": "2024-12-08T17:51:24+00:00", "time": "2025-01-05T17:17:55+00:00",
"default-branch": true, "default-branch": true,
"type": "rector-extension", "type": "rector-extension",
"extra": { "extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/ */
final class GeneratedConfig final class GeneratedConfig
{ {
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main f740789'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main f9cc5a0'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6b0e4f0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 29a1abf')); public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main f740789'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main f9cc5a0'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6b0e4f0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main f7e0a14'));
private function __construct() private function __construct()
{ {
} }