Skip to content

Commit

Permalink
Updated Rector to commit 120e0ccfc40bc696d23a9e1d93b6662ea7dfa682
Browse files Browse the repository at this point in the history
rectorphp/rector-src@120e0cc Bump to php parser 4.18 (#5362)
  • Loading branch information
TomasVotruba committed Dec 16, 2023
1 parent bd56d13 commit 168d6a7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 50 deletions.
68 changes: 34 additions & 34 deletions rules/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,40 @@ public function getNodeTypes() : array
{
return [ClassMethod::class, Function_::class, Expression::class, Property::class];
}
/**
* @param ClassMethod|Function_|Expression|Property $node
*/
public function refactor(Node $node) : ?Node
{
if ($node instanceof Expression || $node instanceof Property) {
return $this->processVarTagNull($node);
}
$phpdocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$removedParamNames = [];
foreach ($node->params as $param) {
$paramName = $this->getName($param);
$paramTagValueNode = $phpdocInfo->getParamTagValueByName($paramName);
if ($paramTagValueNode instanceof ParamTagValueNode && $this->isNull($paramTagValueNode)) {
$removedParamNames[] = $paramTagValueNode->parameterName;
}
}
$hasRemoved = \false;
if ($removedParamNames !== []) {
$this->removeParamNullTag($phpdocInfo, $removedParamNames);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
$hasRemoved = \true;
}
$returnTagValueNode = $phpdocInfo->getReturnTagValue();
if ($returnTagValueNode instanceof ReturnTagValueNode && $this->isNull($returnTagValueNode)) {
$phpdocInfo->removeByType(ReturnTagValueNode::class);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
$hasRemoved = \true;
}
if (!$hasRemoved) {
return null;
}
return $node;
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode|\PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode|\PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode $tag
*/
Expand Down Expand Up @@ -113,38 +147,4 @@ private function processVarTagNull($node) : ?Node
}
return null;
}
/**
* @param ClassMethod|Function_|Expression|Property $node
*/
public function refactor(Node $node) : ?Node
{
if ($node instanceof Expression || $node instanceof Property) {
return $this->processVarTagNull($node);
}
$phpdocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$removedParamNames = [];
foreach ($node->params as $param) {
$paramName = $this->getName($param);
$paramTagValueNode = $phpdocInfo->getParamTagValueByName($paramName);
if ($paramTagValueNode instanceof ParamTagValueNode && $this->isNull($paramTagValueNode)) {
$removedParamNames[] = $paramTagValueNode->parameterName;
}
}
$hasRemoved = \false;
if ($removedParamNames !== []) {
$this->removeParamNullTag($phpdocInfo, $removedParamNames);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
$hasRemoved = \true;
}
$returnTagValueNode = $phpdocInfo->getReturnTagValue();
if ($returnTagValueNode instanceof ReturnTagValueNode && $this->isNull($returnTagValueNode)) {
$phpdocInfo->removeByType(ReturnTagValueNode::class);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
$hasRemoved = \true;
}
if (!$hasRemoved) {
return null;
}
return $node;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ final class StringClassNameToClassConstantRector extends AbstractRector implemen
* @var \PHPStan\Reflection\ReflectionProvider
*/
private $reflectionProvider;
/**
* @var string
*/
public const SHOULD_KEEP_PRE_SLASH = 'should_keep_pre_slash';
/**
* @var string
*/
Expand All @@ -43,10 +47,6 @@ final class StringClassNameToClassConstantRector extends AbstractRector implemen
* @var bool
*/
private $shouldKeepPreslash = \false;
/**
* @var string
*/
public const SHOULD_KEEP_PRE_SLASH = 'should_keep_pre_slash';
public function __construct(ReflectionProvider $reflectionProvider)
{
$this->reflectionProvider = $reflectionProvider;
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 = '39cce5ccb84ce4ac40eeae113db339a961db9489';
public const PACKAGE_VERSION = '120e0ccfc40bc696d23a9e1d93b6662ea7dfa682';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-12-16 16:40:38';
public const RELEASE_DATE = '2023-12-16 15:53:06';
/**
* @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 ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185::getLoader();
return ComposerAutoloaderInit8339caf294dd12447c06647e5d0dc118::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 ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185
class ComposerAutoloaderInit8339caf294dd12447c06647e5d0dc118
{
private static $loader;

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

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

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

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

$filesToLoad = \Composer\Autoload\ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit8339caf294dd12447c06647e5d0dc118::$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 ComposerStaticInita55c41c7fa52abd86138c6f32df1d185
class ComposerStaticInit8339caf294dd12447c06647e5d0dc118
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -2619,9 +2619,9 @@ class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit8339caf294dd12447c06647e5d0dc118::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8339caf294dd12447c06647e5d0dc118::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8339caf294dd12447c06647e5d0dc118::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 168d6a7

Please sign in to comment.