Skip to content

Commit a018694

Browse files
committed
Updated Rector to commit ee04ee1dc59ff0a6c3ff5d6558612dce7757a8f2
rectorphp/rector-src@ee04ee1 Fix multi property default assign (#2986)
1 parent 6fe7603 commit a018694

File tree

9 files changed

+72
-37
lines changed

9 files changed

+72
-37
lines changed

rules/CodeQuality/Rector/Class_/InlineConstructorDefaultToPropertyRector.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpParser\Node\Stmt\Class_;
88
use PhpParser\Node\Stmt\ClassMethod;
99
use PhpParser\Node\Stmt\Property;
10+
use PhpParser\Node\Stmt\PropertyProperty;
1011
use Rector\CodeQuality\NodeAnalyzer\ConstructorPropertyDefaultExprResolver;
1112
use Rector\Core\Rector\AbstractRector;
1213
use Rector\Core\ValueObject\MethodName;
@@ -69,22 +70,34 @@ public function refactor(Node $node) : ?Node
6970
return null;
7071
}
7172
$hasChanged = \false;
73+
$propertyProperties = $this->getNonReadonlyPropertyProperty($node);
7274
foreach ($defaultPropertyExprAssigns as $defaultPropertyExprAssign) {
73-
$property = $node->getProperty($defaultPropertyExprAssign->getPropertyName());
74-
if (!$property instanceof Property) {
75-
continue;
76-
}
77-
if ($property->isReadonly()) {
78-
continue;
75+
foreach ($propertyProperties as $propertyProperty) {
76+
if (!$this->isName($propertyProperty, $defaultPropertyExprAssign->getPropertyName())) {
77+
continue;
78+
}
79+
$propertyProperty->default = $defaultPropertyExprAssign->getDefaultExpr();
80+
$hasChanged = \true;
81+
$this->removeNode($defaultPropertyExprAssign->getAssignExpression());
7982
}
80-
$propertyProperty = $property->props[0];
81-
$propertyProperty->default = $defaultPropertyExprAssign->getDefaultExpr();
82-
$hasChanged = \true;
83-
$this->removeNode($defaultPropertyExprAssign->getAssignExpression());
8483
}
8584
if (!$hasChanged) {
8685
return null;
8786
}
8887
return $node;
8988
}
89+
/**
90+
* @return PropertyProperty[]
91+
*/
92+
private function getNonReadonlyPropertyProperty(Class_ $class) : array
93+
{
94+
$propertyProperties = [];
95+
foreach ($class->getProperties() as $property) {
96+
if ($property->isReadonly()) {
97+
continue;
98+
}
99+
$propertyProperties = \array_merge($propertyProperties, $property->props);
100+
}
101+
return $propertyProperties;
102+
}
90103
}

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ final class VersionResolver
1717
* @api
1818
* @var string
1919
*/
20-
public const PACKAGE_VERSION = '2427c5a094a39018e0c558482faf218d577e3382';
20+
public const PACKAGE_VERSION = 'ee04ee1dc59ff0a6c3ff5d6558612dce7757a8f2';
2121
/**
2222
* @api
2323
* @var string
2424
*/
25-
public const RELEASE_DATE = '2022-10-14 11:43:45';
25+
public const RELEASE_DATE = '2022-10-14 16:46:51';
2626
/**
2727
* @var int
2828
*/

vendor/autoload.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,23 @@
33
// autoload.php @generated by Composer
44

55
if (PHP_VERSION_ID < 50600) {
6-
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7-
exit(1);
6+
if (!headers_sent()) {
7+
header('HTTP/1.1 500 Internal Server Error');
8+
}
9+
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10+
if (!ini_get('display_errors')) {
11+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12+
fwrite(STDERR, $err);
13+
} elseif (!headers_sent()) {
14+
echo $err;
15+
}
16+
}
17+
trigger_error(
18+
$err,
19+
E_USER_ERROR
20+
);
821
}
922

1023
require_once __DIR__ . '/composer/autoload_real.php';
1124

12-
return ComposerAutoloaderInit7801c2cd5fb87fbd8521631b02cf69bc::getLoader();
25+
return ComposerAutoloaderInit5c1fdb34e3926a7a0bf66efb0dc94722::getLoader();

vendor/composer/autoload_real.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit7801c2cd5fb87fbd8521631b02cf69bc
5+
class ComposerAutoloaderInit5c1fdb34e3926a7a0bf66efb0dc94722
66
{
77
private static $loader;
88

@@ -22,19 +22,19 @@ public static function getLoader()
2222
return self::$loader;
2323
}
2424

25-
spl_autoload_register(array('ComposerAutoloaderInit7801c2cd5fb87fbd8521631b02cf69bc', 'loadClassLoader'), true, true);
25+
spl_autoload_register(array('ComposerAutoloaderInit5c1fdb34e3926a7a0bf66efb0dc94722', 'loadClassLoader'), true, true);
2626
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27-
spl_autoload_unregister(array('ComposerAutoloaderInit7801c2cd5fb87fbd8521631b02cf69bc', 'loadClassLoader'));
27+
spl_autoload_unregister(array('ComposerAutoloaderInit5c1fdb34e3926a7a0bf66efb0dc94722', 'loadClassLoader'));
2828

2929
require __DIR__ . '/autoload_static.php';
30-
call_user_func(\Composer\Autoload\ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722::getInitializer($loader));
3131

3232
$loader->setClassMapAuthoritative(true);
3333
$loader->register(true);
3434

35-
$includeFiles = \Composer\Autoload\ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc::$files;
35+
$includeFiles = \Composer\Autoload\ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722::$files;
3636
foreach ($includeFiles as $fileIdentifier => $file) {
37-
composerRequire7801c2cd5fb87fbd8521631b02cf69bc($fileIdentifier, $file);
37+
composerRequire5c1fdb34e3926a7a0bf66efb0dc94722($fileIdentifier, $file);
3838
}
3939

4040
return $loader;
@@ -46,7 +46,7 @@ public static function getLoader()
4646
* @param string $file
4747
* @return void
4848
*/
49-
function composerRequire7801c2cd5fb87fbd8521631b02cf69bc($fileIdentifier, $file)
49+
function composerRequire5c1fdb34e3926a7a0bf66efb0dc94722($fileIdentifier, $file)
5050
{
5151
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
5252
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

vendor/composer/autoload_static.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc
7+
class ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722
88
{
99
public static $files = array (
1010
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@@ -3091,9 +3091,9 @@ class ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc
30913091
public static function getInitializer(ClassLoader $loader)
30923092
{
30933093
return \Closure::bind(function () use ($loader) {
3094-
$loader->prefixLengthsPsr4 = ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc::$prefixLengthsPsr4;
3095-
$loader->prefixDirsPsr4 = ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc::$prefixDirsPsr4;
3096-
$loader->classMap = ComposerStaticInit7801c2cd5fb87fbd8521631b02cf69bc::$classMap;
3094+
$loader->prefixLengthsPsr4 = ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722::$prefixLengthsPsr4;
3095+
$loader->prefixDirsPsr4 = ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722::$prefixDirsPsr4;
3096+
$loader->classMap = ComposerStaticInit5c1fdb34e3926a7a0bf66efb0dc94722::$classMap;
30973097

30983098
}, null, ClassLoader::class);
30993099
}

vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,17 @@
685685
},
686686
{
687687
"name": "phpstan\/phpdoc-parser",
688-
"version": "1.10.0",
689-
"version_normalized": "1.10.0.0",
688+
"version": "1.11.0",
689+
"version_normalized": "1.11.0.0",
690690
"source": {
691691
"type": "git",
692692
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
693-
"reference": "87fa2d526e56737a2ae8fa201a61b15efae59b8a"
693+
"reference": "7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65"
694694
},
695695
"dist": {
696696
"type": "zip",
697-
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/87fa2d526e56737a2ae8fa201a61b15efae59b8a",
698-
"reference": "87fa2d526e56737a2ae8fa201a61b15efae59b8a",
697+
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65",
698+
"reference": "7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65",
699699
"shasum": ""
700700
},
701701
"require": {
@@ -710,7 +710,7 @@
710710
"phpunit\/phpunit": "^9.5",
711711
"symfony\/process": "^5.2"
712712
},
713-
"time": "2022-10-12T19:19:18+00:00",
713+
"time": "2022-10-14T13:32:28+00:00",
714714
"type": "library",
715715
"installation-source": "dist",
716716
"autoload": {
@@ -727,7 +727,7 @@
727727
"description": "PHPDoc parser with support for nullable, intersection and generic types",
728728
"support": {
729729
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
730-
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.10.0"
730+
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.11.0"
731731
},
732732
"install-path": "..\/phpstan\/phpdoc-parser"
733733
},

0 commit comments

Comments
 (0)