Skip to content

Commit

Permalink
Updated Rector to commit e90812c07277304a4b57b62058f6d61ce9a11833
Browse files Browse the repository at this point in the history
rectorphp/rector-src@e90812c Make use of toPhpDocNode() - take #2 (#4555)
  • Loading branch information
TomasVotruba committed Jul 20, 2023
1 parent 45ea7ee commit 26ecf7b
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\AccessoryLiteralStringType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('string');
return $type->toPhpDocNode();
}
/**
* @param AccessoryLiteralStringType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('string');
return $type->toPhpDocNode();
}
/**
* @param AccessoryNonEmptyStringType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\AccessoryNonFalsyStringType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('string');
return $type->toPhpDocNode();
}
/**
* @param AccessoryNonFalsyStringType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\AccessoryNumericStringType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('string');
return $type->toPhpDocNode();
}
/**
* @param AccessoryNumericStringType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantBooleanType;
Expand Down Expand Up @@ -39,10 +38,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
if ($type instanceof ConstantBooleanType) {
return new IdentifierTypeNode($type->getValue() ? 'true' : 'false');
}
return new IdentifierTypeNode('bool');
return $type->toPhpDocNode();
}
/**
* @param BooleanType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
$type = TypeCombinator::union($type->getIf(), $type->getElse());
return $this->phpStanStaticTypeMapper->mapToPHPStanPhpDocTypeNode($type);
return $type->toPhpDocNode();
}
/**
* @param ConditionalTypeForParameter $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\FloatType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('float');
return $type->toPhpDocNode();
}
/**
* @param FloatType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;

use PhpParser\Node;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\HasMethodType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -35,7 +34,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('object');
return $type->toPhpDocNode();
}
/**
* @param HasMethodType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\HasOffsetType;
use PHPStan\Type\Type;
Expand All @@ -28,7 +26,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new ArrayTypeNode(new IdentifierTypeNode('mixed'));
return $type->toPhpDocNode();
}
/**
* @param HasOffsetType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\HasOffsetValueType;
use PHPStan\Type\Type;
Expand All @@ -28,7 +26,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new ArrayTypeNode(new IdentifierTypeNode('mixed'));
return $type->toPhpDocNode();
}
/**
* @param HasOffsetValueType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;

use PhpParser\Node;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\HasPropertyType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -35,7 +34,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('object');
return $type->toPhpDocNode();
}
/**
* @param HasPropertyType $type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
// note: cannot be handled by PHPStan as uses explicit values
return new IdentifierTypeNode('int');
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function getNodeClass() : string
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode('string');
return $type->toPhpDocNode();
}
public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node
{
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 = '7b2f2e8f866a4f7f32e37e37180d401a4b2cc199';
public const PACKAGE_VERSION = 'e90812c07277304a4b57b62058f6d61ce9a11833';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-07-20 19:06:42';
public const RELEASE_DATE = '2023-07-20 21:11:13';
/**
* @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 ComposerAutoloaderInite8eb1b7c9dec69c434147c35a6fb48b7::getLoader();
return ComposerAutoloaderInit29762075c4c169116a99dd54a4e4ecda::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 ComposerAutoloaderInite8eb1b7c9dec69c434147c35a6fb48b7
class ComposerAutoloaderInit29762075c4c169116a99dd54a4e4ecda
{
private static $loader;

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

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

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

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

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

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

0 comments on commit 26ecf7b

Please sign in to comment.