Skip to content

Commit

Permalink
Updated Rector to commit 8bc80b4641429cfcea9a413ff9eb1bd9afaae9ee
Browse files Browse the repository at this point in the history
rectorphp/rector-src@8bc80b4 Add readonly by default on new promoted property (#6650)
  • Loading branch information
TomasVotruba committed Jan 5, 2025
1 parent 40b5c47 commit 4405ec5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '2e82ab4969246050e9fe47df0cf549cc96fdbfd5';
public const PACKAGE_VERSION = '8bc80b4641429cfcea9a413ff9eb1bd9afaae9ee';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2025-01-06 00:05:08';
public const RELEASE_DATE = '2025-01-05 18:37:06';
/**
* @var int
*/
Expand Down
13 changes: 12 additions & 1 deletion src/PhpParser/Node/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
use Rector\Exception\ShouldNotHappenException;
use Rector\NodeDecorator\PropertyTypeDecorator;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php\PhpVersionProvider;
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PostRector\ValueObject\PropertyMetadata;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\ValueObject\PhpVersionFeature;
/**
* @see \Rector\Tests\PhpParser\Node\NodeFactoryTest
*/
Expand All @@ -73,17 +75,22 @@ final class NodeFactory
* @readonly
*/
private SimpleCallableNodeTraverser $simpleCallableNodeTraverser;
/**
* @readonly
*/
private PhpVersionProvider $phpVersionProvider;
/**
* @var string
*/
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->phpDocInfoFactory = $phpDocInfoFactory;
$this->staticTypeMapper = $staticTypeMapper;
$this->propertyTypeDecorator = $propertyTypeDecorator;
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
$this->phpVersionProvider = $phpVersionProvider;
}
/**
* @param string|ObjectReference::* $className
Expand Down Expand Up @@ -275,6 +282,10 @@ public function createPromotedPropertyParam(PropertyMetadata $propertyMetadata)
$param = $paramBuilder->getNode();
$propertyFlags = $propertyMetadata->getFlags();
$param->flags = $propertyFlags !== 0 ? $propertyFlags : Modifiers::PRIVATE;
// make readonly by default
if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::READONLY_PROPERTY)) {
$param->flags |= Modifiers::READONLY;
}
return $param;
}
public function createFalse() : ConstFetch
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1866,12 +1866,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "29a1abf5d8e8d6150dabe6e79e001a34236e9499"
"reference": "f7e0a140e1f6d30252f950b05da1fc89776468eb"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/29a1abf5d8e8d6150dabe6e79e001a34236e9499",
"reference": "29a1abf5d8e8d6150dabe6e79e001a34236e9499",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/f7e0a140e1f6d30252f950b05da1fc89776468eb",
"reference": "f7e0a140e1f6d30252f950b05da1fc89776468eb",
"shasum": ""
},
"require": {
Expand All @@ -1896,7 +1896,7 @@
"tomasvotruba\/class-leak": "^1.0",
"tracy\/tracy": "^2.10"
},
"time": "2024-12-08T17:51:24+00:00",
"time": "2025-01-05T17:17:55+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
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()
{
}
Expand Down

0 comments on commit 4405ec5

Please sign in to comment.