Skip to content

Commit

Permalink
Updated Rector to commit 6d009ccad0aacd102fdacba00eb59b32a1104582
Browse files Browse the repository at this point in the history
rectorphp/rector-src@6d009cc [TypeDeclaration] Add return self object support on ReturnTypeFromStrictFluentReturnRector (#4915)
  • Loading branch information
TomasVotruba committed Sep 5, 2023
1 parent 2ae279b commit dbdeb21
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ThisType;
use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\Rector\AbstractScopeAwareRector;
Expand Down Expand Up @@ -94,14 +95,18 @@ public function refactorWithScope(Node $node, Scope $scope) : ?Node
if ($this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($node, $scope)) {
return null;
}
$returnType = $this->returnTypeInferer->inferFunctionLike($node);
if (!$returnType instanceof ThisType) {
return null;
}
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
if (!$classReflection instanceof ClassReflection) {
return null;
}
$returnType = $this->returnTypeInferer->inferFunctionLike($node);
if ($returnType instanceof ObjectType && $returnType->getClassName() === $classReflection->getName()) {
$node->returnType = new Name('self');
return $node;
}
if (!$returnType instanceof ThisType) {
return null;
}
if ($classReflection->isAnonymous() || $classReflection->isFinalByKeyword() || !$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::STATIC_RETURN_TYPE)) {
$node->returnType = new Name('self');
} else {
Expand Down
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 = '093bcb63a19db3fcdab8264897c584212d755463';
public const PACKAGE_VERSION = '6d009ccad0aacd102fdacba00eb59b32a1104582';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-05 13:17:38';
public const RELEASE_DATE = '2023-09-05 22:45:59';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

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

return ComposerAutoloaderInit38b31399dff74dd2a0290c76af352a7d::getLoader();
return ComposerAutoloaderInitdcd48cf0745b1bcb0282fbb71bca3b11::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit38b31399dff74dd2a0290c76af352a7d
class ComposerAutoloaderInitdcd48cf0745b1bcb0282fbb71bca3b11
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit38b31399dff74dd2a0290c76af352a7d', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitdcd48cf0745b1bcb0282fbb71bca3b11', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit38b31399dff74dd2a0290c76af352a7d', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitdcd48cf0745b1bcb0282fbb71bca3b11', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit38b31399dff74dd2a0290c76af352a7d::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInit38b31399dff74dd2a0290c76af352a7d::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit38b31399dff74dd2a0290c76af352a7d
class ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -2612,9 +2612,9 @@ class ComposerStaticInit38b31399dff74dd2a0290c76af352a7d
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit38b31399dff74dd2a0290c76af352a7d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit38b31399dff74dd2a0290c76af352a7d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit38b31399dff74dd2a0290c76af352a7d::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitdcd48cf0745b1bcb0282fbb71bca3b11::$classMap;

}, null, ClassLoader::class);
}
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@
},
{
"name": "illuminate\/container",
"version": "v10.21.1",
"version_normalized": "10.21.1.0",
"version": "v10.22.0",
"version_normalized": "10.22.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/illuminate\/container.git",
Expand Down Expand Up @@ -561,8 +561,8 @@
},
{
"name": "illuminate\/contracts",
"version": "v10.21.1",
"version_normalized": "10.21.1.0",
"version": "v10.22.0",
"version_normalized": "10.22.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/illuminate\/contracts.git",
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

0 comments on commit dbdeb21

Please sign in to comment.