mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-31 20:51:46 +01:00
Updated Rector to commit 8f521f5500df70f71fd5ee8798a0b0a2e7c64615
8f521f5500
[Php74] Set Nullable for TypedPropertyRector not filled by current class method (#295)
This commit is contained in:
parent
ed4f2ecd4c
commit
a9f2b17421
@ -3,9 +3,31 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\FamilyTree\Reflection;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PhpParser\Parser;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\FamilyTree\ValueObject\PropertyType;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix20210629\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
|
||||
use RectorPrefix20210629\Symplify\SmartFileSystem\SmartFileSystem;
|
||||
final class FamilyRelationsAnalyzer
|
||||
{
|
||||
/**
|
||||
@ -16,10 +38,35 @@ final class FamilyRelationsAnalyzer
|
||||
* @var \Symplify\PackageBuilder\Reflection\PrivatesAccessor
|
||||
*/
|
||||
private $privatesAccessor;
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \RectorPrefix20210629\Symplify\PackageBuilder\Reflection\PrivatesAccessor $privatesAccessor)
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var \Symplify\SmartFileSystem\SmartFileSystem
|
||||
*/
|
||||
private $smartFileSystem;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
private $staticTypeMapper;
|
||||
/**
|
||||
* @var \PhpParser\Parser
|
||||
*/
|
||||
private $parser;
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \RectorPrefix20210629\Symplify\PackageBuilder\Reflection\PrivatesAccessor $privatesAccessor, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \RectorPrefix20210629\Symplify\SmartFileSystem\SmartFileSystem $smartFileSystem, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \PhpParser\Parser $parser)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->privatesAccessor = $privatesAccessor;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->smartFileSystem = $smartFileSystem;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->parser = $parser;
|
||||
}
|
||||
/**
|
||||
* @return ClassReflection[]
|
||||
@ -37,4 +84,78 @@ final class FamilyRelationsAnalyzer
|
||||
}
|
||||
return $childrenClassReflections;
|
||||
}
|
||||
/**
|
||||
* @param Name|NullableType|PhpParserUnionType|null $propertyTypeNode
|
||||
*/
|
||||
public function getPossibleUnionPropertyType(\PhpParser\Node\Stmt\Property $property, \PHPStan\Type\Type $varType, ?\PHPStan\Analyser\Scope $scope, ?\PhpParser\Node $propertyTypeNode) : \Rector\FamilyTree\ValueObject\PropertyType
|
||||
{
|
||||
if ($varType instanceof \PHPStan\Type\UnionType) {
|
||||
return new \Rector\FamilyTree\ValueObject\PropertyType($varType, $propertyTypeNode);
|
||||
}
|
||||
if (!$scope instanceof \PHPStan\Analyser\Scope) {
|
||||
return new \Rector\FamilyTree\ValueObject\PropertyType($varType, $propertyTypeNode);
|
||||
}
|
||||
/** @var ClassReflection $classReflection */
|
||||
$classReflection = $scope->getClassReflection();
|
||||
$ancestors = $classReflection->getAncestors();
|
||||
$propertyName = $this->nodeNameResolver->getName($property);
|
||||
$kindPropertyFetch = $this->getKindPropertyFetch($property);
|
||||
$className = $property->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
|
||||
foreach ($ancestors as $ancestor) {
|
||||
$ancestorName = $ancestor->getName();
|
||||
if ($ancestorName === $className) {
|
||||
continue;
|
||||
}
|
||||
$fileName = $ancestor->getFileName();
|
||||
if ($fileName === \false) {
|
||||
continue;
|
||||
}
|
||||
$fileContent = $this->smartFileSystem->readFile($fileName);
|
||||
$nodes = $this->parser->parse($fileContent);
|
||||
if ($ancestor->isSubclassOf('PHPUnit\\Framework\\TestCase')) {
|
||||
continue;
|
||||
}
|
||||
if ($nodes === null) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isPropertyWritten($nodes, $propertyName, $kindPropertyFetch)) {
|
||||
continue;
|
||||
}
|
||||
$varType = new \PHPStan\Type\UnionType([$varType, new \PHPStan\Type\NullType()]);
|
||||
$propertyTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($varType, \Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind::KIND_PROPERTY);
|
||||
return new \Rector\FamilyTree\ValueObject\PropertyType($varType, $propertyTypeNode);
|
||||
}
|
||||
return new \Rector\FamilyTree\ValueObject\PropertyType($varType, $propertyTypeNode);
|
||||
}
|
||||
private function getKindPropertyFetch(\PhpParser\Node\Stmt\Property $property) : string
|
||||
{
|
||||
return $property->isStatic() ? \PhpParser\Node\Expr\StaticPropertyFetch::class : \PhpParser\Node\Expr\PropertyFetch::class;
|
||||
}
|
||||
/**
|
||||
* @param Stmt[] $nodes
|
||||
*/
|
||||
private function isPropertyWritten(array $nodes, string $propertyName, string $kindPropertyFetch) : bool
|
||||
{
|
||||
return (bool) $this->betterNodeFinder->findFirst($nodes, function (\PhpParser\Node $node) use($propertyName, $kindPropertyFetch) : bool {
|
||||
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->nodeNameResolver->isName($node->name, 'autowire')) {
|
||||
return \false;
|
||||
}
|
||||
return $this->isPropertyAssignedInClassMethod($node, $propertyName, $kindPropertyFetch);
|
||||
});
|
||||
}
|
||||
private function isPropertyAssignedInClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMethod, string $propertyName, string $kindPropertyFetch) : bool
|
||||
{
|
||||
if ($classMethod->stmts === null) {
|
||||
return \false;
|
||||
}
|
||||
return (bool) $this->betterNodeFinder->findFirst($classMethod->stmts, function (\PhpParser\Node $node) use($propertyName, $kindPropertyFetch) : bool {
|
||||
if (!$node instanceof \PhpParser\Node\Expr\Assign) {
|
||||
return \false;
|
||||
}
|
||||
return $kindPropertyFetch === \get_class($node->var) && $this->nodeNameResolver->isName($node->var, $propertyName);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
40
packages/FamilyTree/ValueObject/PropertyType.php
Normal file
40
packages/FamilyTree/ValueObject/PropertyType.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\FamilyTree\ValueObject;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\Type\Type;
|
||||
final class PropertyType
|
||||
{
|
||||
/**
|
||||
* @var \PHPStan\Type\Type
|
||||
*/
|
||||
private $varType;
|
||||
/**
|
||||
* @var \PhpParser\Node|null
|
||||
*/
|
||||
private $propertyTypeNode;
|
||||
/**
|
||||
* @param Name|NullableType|PhpParserUnionType|null $propertyTypeNode
|
||||
*/
|
||||
public function __construct(\PHPStan\Type\Type $varType, ?\PhpParser\Node $propertyTypeNode)
|
||||
{
|
||||
$this->varType = $varType;
|
||||
$this->propertyTypeNode = $propertyTypeNode;
|
||||
}
|
||||
public function getVarType() : \PHPStan\Type\Type
|
||||
{
|
||||
return $this->varType;
|
||||
}
|
||||
/**
|
||||
* @return Name|NullableType|PhpParserUnionType|null
|
||||
*/
|
||||
public function getPropertyTypeNode() : ?\PhpParser\Node
|
||||
{
|
||||
return $this->propertyTypeNode;
|
||||
}
|
||||
}
|
@ -19,6 +19,8 @@ use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover;
|
||||
use Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer;
|
||||
use Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind;
|
||||
use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer;
|
||||
@ -69,7 +71,11 @@ final class TypedPropertyRector extends \Rector\Core\Rector\AbstractRector imple
|
||||
* @var \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer
|
||||
*/
|
||||
private $propertyFetchAnalyzer;
|
||||
public function __construct(\Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer $propertyTypeInferer, \Rector\VendorLocker\VendorLockResolver $vendorLockResolver, \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer $doctrineTypeAnalyzer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer $propertyFetchAnalyzer)
|
||||
/**
|
||||
* @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer
|
||||
*/
|
||||
private $familyRelationsAnalyzer;
|
||||
public function __construct(\Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer $propertyTypeInferer, \Rector\VendorLocker\VendorLockResolver $vendorLockResolver, \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer $doctrineTypeAnalyzer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer $propertyFetchAnalyzer, \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer $familyRelationsAnalyzer)
|
||||
{
|
||||
$this->propertyTypeInferer = $propertyTypeInferer;
|
||||
$this->vendorLockResolver = $vendorLockResolver;
|
||||
@ -77,6 +83,7 @@ final class TypedPropertyRector extends \Rector\Core\Rector\AbstractRector imple
|
||||
$this->varTagRemover = $varTagRemover;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->familyRelationsAnalyzer = $familyRelationsAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
@ -130,6 +137,10 @@ CODE_SAMPLE
|
||||
if ($this->isNullOrNonClassLikeTypeOrMixedOrVendorLockedIn($propertyTypeNode, $node)) {
|
||||
return null;
|
||||
}
|
||||
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||
$propertyType = $this->familyRelationsAnalyzer->getPossibleUnionPropertyType($node, $varType, $scope, $propertyTypeNode);
|
||||
$varType = $propertyType->getVarType();
|
||||
$propertyTypeNode = $propertyType->getPropertyTypeNode();
|
||||
$this->varTagRemover->removeVarPhpTagValueNodeIfNotComment($node, $varType);
|
||||
$this->removeDefaultValueForDoctrineCollection($node, $varType);
|
||||
$this->addDefaultValueNullForNullableType($node, $varType);
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'e666df703e78bed6a404315db4a8482b8f1b98ed';
|
||||
public const PACKAGE_VERSION = '8f521f5500df70f71fd5ee8798a0b0a2e7c64615';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-29 00:21:11';
|
||||
public const RELEASE_DATE = '2021-06-29 14:08:07';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210629\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec::getLoader();
|
||||
return ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2186,6 +2186,7 @@ return array(
|
||||
'Rector\\FamilyTree\\NodeAnalyzer\\ClassChildAnalyzer' => $baseDir . '/packages/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php',
|
||||
'Rector\\FamilyTree\\NodeAnalyzer\\PropertyUsageAnalyzer' => $baseDir . '/packages/FamilyTree/NodeAnalyzer/PropertyUsageAnalyzer.php',
|
||||
'Rector\\FamilyTree\\Reflection\\FamilyRelationsAnalyzer' => $baseDir . '/packages/FamilyTree/Reflection/FamilyRelationsAnalyzer.php',
|
||||
'Rector\\FamilyTree\\ValueObject\\PropertyType' => $baseDir . '/packages/FamilyTree/ValueObject/PropertyType.php',
|
||||
'Rector\\FileFormatter\\Contract\\Formatter\\FileFormatterInterface' => $baseDir . '/packages/FileFormatter/Contract/Formatter/FileFormatterInterface.php',
|
||||
'Rector\\FileFormatter\\EditorConfig\\EditorConfigParser' => $baseDir . '/packages/FileFormatter/EditorConfig/EditorConfigParser.php',
|
||||
'Rector\\FileFormatter\\Exception\\InvalidIndentSizeException' => $baseDir . '/packages/FileFormatter/Exception/InvalidIndentSizeException.php',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec
|
||||
class ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit169e59c18f0376eb2198aa984de135ec::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit169e59c18f0376eb2198aa984de135ec::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire169e59c18f0376eb2198aa984de135ec($fileIdentifier, $file);
|
||||
composerRequire27abd53b5ba69984fb402dee8d6fc3f9($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire169e59c18f0376eb2198aa984de135ec($fileIdentifier, $file)
|
||||
function composerRequire27abd53b5ba69984fb402dee8d6fc3f9($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit169e59c18f0376eb2198aa984de135ec
|
||||
class ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -2541,6 +2541,7 @@ class ComposerStaticInit169e59c18f0376eb2198aa984de135ec
|
||||
'Rector\\FamilyTree\\NodeAnalyzer\\ClassChildAnalyzer' => __DIR__ . '/../..' . '/packages/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php',
|
||||
'Rector\\FamilyTree\\NodeAnalyzer\\PropertyUsageAnalyzer' => __DIR__ . '/../..' . '/packages/FamilyTree/NodeAnalyzer/PropertyUsageAnalyzer.php',
|
||||
'Rector\\FamilyTree\\Reflection\\FamilyRelationsAnalyzer' => __DIR__ . '/../..' . '/packages/FamilyTree/Reflection/FamilyRelationsAnalyzer.php',
|
||||
'Rector\\FamilyTree\\ValueObject\\PropertyType' => __DIR__ . '/../..' . '/packages/FamilyTree/ValueObject/PropertyType.php',
|
||||
'Rector\\FileFormatter\\Contract\\Formatter\\FileFormatterInterface' => __DIR__ . '/../..' . '/packages/FileFormatter/Contract/Formatter/FileFormatterInterface.php',
|
||||
'Rector\\FileFormatter\\EditorConfig\\EditorConfigParser' => __DIR__ . '/../..' . '/packages/FileFormatter/EditorConfig/EditorConfigParser.php',
|
||||
'Rector\\FileFormatter\\Exception\\InvalidIndentSizeException' => __DIR__ . '/../..' . '/packages/FileFormatter/Exception/InvalidIndentSizeException.php',
|
||||
@ -3837,9 +3838,9 @@ class ComposerStaticInit169e59c18f0376eb2198aa984de135ec
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit169e59c18f0376eb2198aa984de135ec::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit169e59c18f0376eb2198aa984de135ec::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit169e59c18f0376eb2198aa984de135ec::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit27abd53b5ba69984fb402dee8d6fc3f9::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
16
vendor/composer/installed.json
vendored
16
vendor/composer/installed.json
vendored
@ -502,17 +502,17 @@
|
||||
},
|
||||
{
|
||||
"name": "myclabs\/php-enum",
|
||||
"version": "1.8.0",
|
||||
"version_normalized": "1.8.0.0",
|
||||
"version": "1.8.1",
|
||||
"version_normalized": "1.8.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/myclabs\/php-enum.git",
|
||||
"reference": "46cf3d8498b095bd33727b13fd5707263af99421"
|
||||
"reference": "55555d31a622b4bc9662664132a0533ae6ef47b1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/myclabs\/php-enum\/zipball\/46cf3d8498b095bd33727b13fd5707263af99421",
|
||||
"reference": "46cf3d8498b095bd33727b13fd5707263af99421",
|
||||
"url": "https:\/\/api.github.com\/repos\/myclabs\/php-enum\/zipball\/55555d31a622b4bc9662664132a0533ae6ef47b1",
|
||||
"reference": "55555d31a622b4bc9662664132a0533ae6ef47b1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -522,9 +522,9 @@
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"squizlabs\/php_codesniffer": "1.*",
|
||||
"vimeo\/psalm": "^4.5.1"
|
||||
"vimeo\/psalm": "^4.6.2"
|
||||
},
|
||||
"time": "2021-02-15T16:11:48+00:00",
|
||||
"time": "2021-06-29T09:20:05+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -549,7 +549,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/myclabs\/php-enum\/issues",
|
||||
"source": "https:\/\/github.com\/myclabs\/php-enum\/tree\/1.8.0"
|
||||
"source": "https:\/\/github.com\/myclabs\/php-enum\/tree\/1.8.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
2
vendor/myclabs/php-enum/composer.json
vendored
2
vendor/myclabs/php-enum/composer.json
vendored
@ -30,6 +30,6 @@
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"squizlabs\/php_codesniffer": "1.*",
|
||||
"vimeo\/psalm": "^4.5.1"
|
||||
"vimeo\/psalm": "^4.6.2"
|
||||
}
|
||||
}
|
14
vendor/myclabs/php-enum/src/Enum.php
vendored
14
vendor/myclabs/php-enum/src/Enum.php
vendored
@ -64,13 +64,23 @@ abstract class Enum implements \JsonSerializable
|
||||
/** @psalm-var T */
|
||||
$value = $value->getValue();
|
||||
}
|
||||
/** @psalm-suppress ImplicitToStringCast assertValidValueReturningKey returns always a string but psalm has currently an issue here */
|
||||
$this->key = static::assertValidValueReturningKey($value);
|
||||
/** @psalm-var T */
|
||||
$this->value = $value;
|
||||
}
|
||||
/**
|
||||
* This method exists only for the compatibility reason when deserializing a previously serialized version
|
||||
* that didn't had the key property
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
/** @psalm-suppress DocblockTypeContradiction key can be null when deserializing an enum without the key */
|
||||
if ($this->key === null) {
|
||||
/**
|
||||
* @psalm-suppress InaccessibleProperty key is not readonly as marked by psalm
|
||||
* @psalm-suppress PossiblyFalsePropertyAssignmentValue deserializing a case that was removed
|
||||
*/
|
||||
$this->key = static::search($this->value);
|
||||
}
|
||||
}
|
||||
@ -191,6 +201,7 @@ abstract class Enum implements \JsonSerializable
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-assert T $value
|
||||
* @param mixed $value
|
||||
*/
|
||||
public static function assertValidValue($value) : void
|
||||
{
|
||||
@ -201,6 +212,8 @@ abstract class Enum implements \JsonSerializable
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-assert T $value
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
private static function assertValidValueReturningKey($value) : string
|
||||
{
|
||||
@ -267,6 +280,7 @@ abstract class Enum implements \JsonSerializable
|
||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @psalm-pure
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->getValue();
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
||||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210629\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec', false) && !interface_exists('ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec', false) && !trait_exists('ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec', false)) {
|
||||
spl_autoload_call('RectorPrefix20210629\ComposerAutoloaderInit169e59c18f0376eb2198aa984de135ec');
|
||||
if (!class_exists('ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9', false) && !interface_exists('ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9', false) && !trait_exists('ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9', false)) {
|
||||
spl_autoload_call('RectorPrefix20210629\ComposerAutoloaderInit27abd53b5ba69984fb402dee8d6fc3f9');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210629\Doctrine\Inflector\Inflector');
|
||||
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210629\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire169e59c18f0376eb2198aa984de135ec')) {
|
||||
function composerRequire169e59c18f0376eb2198aa984de135ec() {
|
||||
return \RectorPrefix20210629\composerRequire169e59c18f0376eb2198aa984de135ec(...func_get_args());
|
||||
if (!function_exists('composerRequire27abd53b5ba69984fb402dee8d6fc3f9')) {
|
||||
function composerRequire27abd53b5ba69984fb402dee8d6fc3f9() {
|
||||
return \RectorPrefix20210629\composerRequire27abd53b5ba69984fb402dee8d6fc3f9(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user