mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
parent
d8c2a5ac52
commit
20323fa50b
|
@ -14,5 +14,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
$services->defaults()->public()->autowire()->autoconfigure();
|
||||
// psr-4
|
||||
$services->alias(\Rector\PSR4\Contract\PSR4AutoloadNamespaceMatcherInterface::class, \Rector\PSR4\Composer\PSR4NamespaceMatcher::class);
|
||||
$services->load('Rector\\', __DIR__ . '/../rules')->exclude([__DIR__ . '/../rules/*/{ValueObject,Rector,Contract,Exception}']);
|
||||
$services->load('Rector\\', __DIR__ . '/../rules')->exclude([__DIR__ . '/../rules/*/{ValueObject,Rector,Contract,Exception,Enum}']);
|
||||
};
|
||||
|
|
23
rules/CodingStyle/Enum/PreferenceSelfThis.php
Normal file
23
rules/CodingStyle/Enum/PreferenceSelfThis.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Enum;
|
||||
|
||||
use RectorPrefix20210628\MyCLabs\Enum\Enum;
|
||||
/**
|
||||
* @method static PreferenceSelfThis PREFER_THIS()
|
||||
* @method static PreferenceSelfThis PREFER_SELF()
|
||||
*/
|
||||
final class PreferenceSelfThis extends \RectorPrefix20210628\MyCLabs\Enum\Enum
|
||||
{
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
private const PREFER_THIS = 'prefer_this';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
private const PREFER_SELF = 'prefer_self';
|
||||
}
|
|
@ -7,9 +7,8 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\CodingStyle\ValueObject\PreferenceSelfThis;
|
||||
use Rector\CodingStyle\Enum\PreferenceSelfThis;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Exception\Configuration\InvalidConfigurationException;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -29,7 +28,7 @@ final class PreferThisOrSelfMethodCallRector extends \Rector\Core\Rector\Abstrac
|
|||
*/
|
||||
private const SELF = 'self';
|
||||
/**
|
||||
* @var array<class-string, string>
|
||||
* @var array<class-string, PreferenceSelfThis>
|
||||
*/
|
||||
private $typeToPreference = [];
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
|
@ -52,7 +51,7 @@ class SomeClass extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::TYPE_TO_PREFERENCE => ['PHPUnit\\Framework\\TestCase' => \Rector\CodingStyle\ValueObject\PreferenceSelfThis::PREFER_SELF]])]);
|
||||
, [self::TYPE_TO_PREFERENCE => ['PHPUnit\\Framework\\TestCase' => \Rector\CodingStyle\Enum\PreferenceSelfThis::PREFER_SELF()]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
|
@ -70,7 +69,8 @@ CODE_SAMPLE
|
|||
if (!$this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType($node, new \PHPStan\Type\ObjectType($type))) {
|
||||
continue;
|
||||
}
|
||||
if ($preference === \Rector\CodingStyle\ValueObject\PreferenceSelfThis::PREFER_SELF) {
|
||||
/** @var PreferenceSelfThis $preference */
|
||||
if ($preference->equals(\Rector\CodingStyle\Enum\PreferenceSelfThis::PREFER_SELF())) {
|
||||
return $this->processToSelf($node);
|
||||
}
|
||||
return $this->processToThis($node);
|
||||
|
@ -78,15 +78,12 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
/**
|
||||
* @param array<string, array<class-string, string>> $configuration
|
||||
* @param array<string, array<class-string, PreferenceSelfThis>> $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$typeToPreference = $configuration[self::TYPE_TO_PREFERENCE] ?? [];
|
||||
\RectorPrefix20210628\Webmozart\Assert\Assert::allString($typeToPreference);
|
||||
foreach ($typeToPreference as $singleTypeToPreference) {
|
||||
$this->ensurePreferenceIsValid($singleTypeToPreference);
|
||||
}
|
||||
\RectorPrefix20210628\Webmozart\Assert\Assert::allIsAOf($typeToPreference, \Rector\CodingStyle\Enum\PreferenceSelfThis::class);
|
||||
$this->typeToPreference = $typeToPreference;
|
||||
}
|
||||
/**
|
||||
|
@ -123,11 +120,4 @@ CODE_SAMPLE
|
|||
}
|
||||
return $this->nodeFactory->createMethodCall('this', $name, $node->args);
|
||||
}
|
||||
private function ensurePreferenceIsValid(string $preference) : void
|
||||
{
|
||||
if (\in_array($preference, \Rector\CodingStyle\ValueObject\PreferenceSelfThis::ALLOWED_VALUES, \true)) {
|
||||
return;
|
||||
}
|
||||
throw new \Rector\Core\Exception\Configuration\InvalidConfigurationException(\sprintf('Preference configuration "%s" for "%s" is not valid. Use one of "%s"', $preference, self::class, \implode('", "', \Rector\CodingStyle\ValueObject\PreferenceSelfThis::ALLOWED_VALUES)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\ValueObject;
|
||||
|
||||
/**
|
||||
* @enum
|
||||
*/
|
||||
final class PreferenceSelfThis
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public const ALLOWED_VALUES = [self::PREFER_THIS, self::PREFER_SELF];
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PREFER_THIS = 'prefer_this';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PREFER_SELF = 'prefer_self';
|
||||
}
|
31
rules/Php80/Enum/MatchKind.php
Normal file
31
rules/Php80/Enum/MatchKind.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php80\Enum;
|
||||
|
||||
use RectorPrefix20210628\MyCLabs\Enum\Enum;
|
||||
/**
|
||||
* @method static MatchKind NORMAL()
|
||||
* @method static MatchKind ASSIGN()
|
||||
* @method static MatchKind RETURN()
|
||||
* @method static MatchKind THROW()
|
||||
*/
|
||||
final class MatchKind extends \RectorPrefix20210628\MyCLabs\Enum\Enum
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const NORMAL = 'normal';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const ASSIGN = 'assign';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const RETURN = 'return';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const THROW = 'throw';
|
||||
}
|
|
@ -11,8 +11,8 @@ use PhpParser\Node\Stmt\Switch_;
|
|||
use PhpParser\Node\Stmt\Throw_;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Php80\Enum\MatchKind;
|
||||
use Rector\Php80\ValueObject\CondAndExpr;
|
||||
use Rector\Php80\ValueObject\MatchKind;
|
||||
final class MatchSwitchAnalyzer
|
||||
{
|
||||
/**
|
||||
|
@ -90,16 +90,16 @@ final class MatchSwitchAnalyzer
|
|||
}
|
||||
/**
|
||||
* @param CondAndExpr[] $condAndExprs
|
||||
* @return string[]
|
||||
* @return MatchKind[]
|
||||
*/
|
||||
private function resolveUniqueKindsWithoutThrows(array $condAndExprs) : array
|
||||
{
|
||||
$condAndExprKinds = [];
|
||||
foreach ($condAndExprs as $condAndExpr) {
|
||||
if ($condAndExpr->getKind() === \Rector\Php80\ValueObject\MatchKind::THROW) {
|
||||
if ($condAndExpr->equalsMatchKind(\Rector\Php80\Enum\MatchKind::THROW())) {
|
||||
continue;
|
||||
}
|
||||
$condAndExprKinds[] = $condAndExpr->getKind();
|
||||
$condAndExprKinds[] = $condAndExpr->getMatchKind();
|
||||
}
|
||||
return \array_unique($condAndExprKinds);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ use PhpParser\Node\Stmt\Expression;
|
|||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\Node\Stmt\Switch_;
|
||||
use PhpParser\Node\Stmt\Throw_;
|
||||
use Rector\Php80\Enum\MatchKind;
|
||||
use Rector\Php80\ValueObject\CondAndExpr;
|
||||
use Rector\Php80\ValueObject\MatchKind;
|
||||
final class SwitchExprsResolver
|
||||
{
|
||||
/**
|
||||
|
@ -56,14 +56,14 @@ final class SwitchExprsResolver
|
|||
if (!$returnedExpr instanceof \PhpParser\Node\Expr) {
|
||||
return [];
|
||||
}
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $returnedExpr, \Rector\Php80\ValueObject\MatchKind::RETURN);
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $returnedExpr, \Rector\Php80\Enum\MatchKind::RETURN());
|
||||
} elseif ($expr instanceof \PhpParser\Node\Expr\Assign) {
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $expr, \Rector\Php80\ValueObject\MatchKind::ASSIGN);
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $expr, \Rector\Php80\Enum\MatchKind::ASSIGN());
|
||||
} elseif ($expr instanceof \PhpParser\Node\Expr) {
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $expr, \Rector\Php80\ValueObject\MatchKind::NORMAL);
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $expr, \Rector\Php80\Enum\MatchKind::NORMAL());
|
||||
} elseif ($expr instanceof \PhpParser\Node\Stmt\Throw_) {
|
||||
$throwExpr = new \PhpParser\Node\Expr\Throw_($expr->expr);
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $throwExpr, \Rector\Php80\ValueObject\MatchKind::THROW);
|
||||
$condAndExpr[] = new \Rector\Php80\ValueObject\CondAndExpr($condExprs, $throwExpr, \Rector\Php80\Enum\MatchKind::THROW());
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ use PhpParser\Node\Stmt\Switch_;
|
|||
use PhpParser\Node\Stmt\Throw_ as ThrowsStmt;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Php80\Enum\MatchKind;
|
||||
use Rector\Php80\NodeAnalyzer\MatchSwitchAnalyzer;
|
||||
use Rector\Php80\NodeFactory\MatchFactory;
|
||||
use Rector\Php80\NodeResolver\SwitchExprsResolver;
|
||||
use Rector\Php80\ValueObject\CondAndExpr;
|
||||
use Rector\Php80\ValueObject\MatchKind;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ CODE_SAMPLE
|
|||
}
|
||||
$isReturn = \false;
|
||||
foreach ($condAndExprs as $condAndExpr) {
|
||||
if ($condAndExpr->getKind() === \Rector\Php80\ValueObject\MatchKind::RETURN) {
|
||||
if ($condAndExpr->equalsMatchKind(\Rector\Php80\Enum\MatchKind::RETURN())) {
|
||||
$isReturn = \true;
|
||||
break;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ CODE_SAMPLE
|
|||
return $match;
|
||||
}
|
||||
$this->removeNode($nextNode);
|
||||
$condAndExprs[] = new \Rector\Php80\ValueObject\CondAndExpr([], $returnedExpr, \Rector\Php80\ValueObject\MatchKind::RETURN);
|
||||
$condAndExprs[] = new \Rector\Php80\ValueObject\CondAndExpr([], $returnedExpr, \Rector\Php80\Enum\MatchKind::RETURN());
|
||||
return $this->matchFactory->createFromCondAndExprs($switch->cond, $condAndExprs);
|
||||
}
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ CODE_SAMPLE
|
|||
}
|
||||
$this->removeNode($nextNode);
|
||||
$throw = new \PhpParser\Node\Expr\Throw_($nextNode->expr);
|
||||
$condAndExprs[] = new \Rector\Php80\ValueObject\CondAndExpr([], $throw, \Rector\Php80\ValueObject\MatchKind::RETURN);
|
||||
$condAndExprs[] = new \Rector\Php80\ValueObject\CondAndExpr([], $throw, \Rector\Php80\Enum\MatchKind::RETURN());
|
||||
return $this->matchFactory->createFromCondAndExprs($switch->cond, $condAndExprs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
|||
namespace Rector\Php80\ValueObject;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use Rector\Php80\Enum\MatchKind;
|
||||
final class CondAndExpr
|
||||
{
|
||||
/**
|
||||
|
@ -15,17 +16,17 @@ final class CondAndExpr
|
|||
*/
|
||||
private $expr;
|
||||
/**
|
||||
* @var string
|
||||
* @var \Rector\Php80\Enum\MatchKind
|
||||
*/
|
||||
private $kind;
|
||||
private $matchKind;
|
||||
/**
|
||||
* @param Expr[] $condExprs
|
||||
*/
|
||||
public function __construct(array $condExprs, \PhpParser\Node\Expr $expr, string $kind)
|
||||
public function __construct(array $condExprs, \PhpParser\Node\Expr $expr, \Rector\Php80\Enum\MatchKind $matchKind)
|
||||
{
|
||||
$this->condExprs = $condExprs;
|
||||
$this->expr = $expr;
|
||||
$this->kind = $kind;
|
||||
$this->matchKind = $matchKind;
|
||||
}
|
||||
public function getExpr() : \PhpParser\Node\Expr
|
||||
{
|
||||
|
@ -38,8 +39,12 @@ final class CondAndExpr
|
|||
{
|
||||
return $this->condExprs;
|
||||
}
|
||||
public function getKind() : string
|
||||
public function getMatchKind() : \Rector\Php80\Enum\MatchKind
|
||||
{
|
||||
return $this->kind;
|
||||
return $this->matchKind;
|
||||
}
|
||||
public function equalsMatchKind(\Rector\Php80\Enum\MatchKind $matchKind) : bool
|
||||
{
|
||||
return $this->matchKind->equals($matchKind);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php80\ValueObject;
|
||||
|
||||
/**
|
||||
* @enum
|
||||
*/
|
||||
final class MatchKind
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NORMAL = 'normal';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ASSIGN = 'assign';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RETURN = 'return';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const THROW = 'throw';
|
||||
}
|
22
rules/TypeDeclaration/Enum/TypeStrictness.php
Normal file
22
rules/TypeDeclaration/Enum/TypeStrictness.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\Enum;
|
||||
|
||||
use RectorPrefix20210628\MyCLabs\Enum\Enum;
|
||||
/**
|
||||
* @enum
|
||||
* @method static TypeStrictness STRICTNESS_TYPE_DECLARATION()
|
||||
* @method static TypeStrictness STRICTNESS_DOCBLOCK()
|
||||
*/
|
||||
final class TypeStrictness extends \RectorPrefix20210628\MyCLabs\Enum\Enum
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const STRICTNESS_TYPE_DECLARATION = 'type_declaration';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const STRICTNESS_DOCBLOCK = 'docblock';
|
||||
}
|
|
@ -14,7 +14,7 @@ use PHPStan\Type\UnionType;
|
|||
use Rector\NodeCollector\ValueObject\ArrayCallable;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
||||
use Rector\TypeDeclaration\ValueObject\TypeStrictness;
|
||||
use Rector\TypeDeclaration\Enum\TypeStrictness;
|
||||
final class CallTypesResolver
|
||||
{
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ final class CallTypesResolver
|
|||
*/
|
||||
public function resolveStrictTypesFromCalls(array $calls) : array
|
||||
{
|
||||
return $this->resolveTypesFromCalls($calls, \Rector\TypeDeclaration\ValueObject\TypeStrictness::STRICTNESS_TYPE_DECLARATION);
|
||||
return $this->resolveTypesFromCalls($calls, \Rector\TypeDeclaration\Enum\TypeStrictness::STRICTNESS_TYPE_DECLARATION());
|
||||
}
|
||||
/**
|
||||
* @param MethodCall[]|StaticCall[]|ArrayCallable[] $calls
|
||||
|
@ -44,13 +44,13 @@ final class CallTypesResolver
|
|||
*/
|
||||
public function resolveWeakTypesFromCalls(array $calls) : array
|
||||
{
|
||||
return $this->resolveTypesFromCalls($calls, \Rector\TypeDeclaration\ValueObject\TypeStrictness::STRICTNESS_DOCBLOCK);
|
||||
return $this->resolveTypesFromCalls($calls, \Rector\TypeDeclaration\Enum\TypeStrictness::STRICTNESS_DOCBLOCK());
|
||||
}
|
||||
/**
|
||||
* @param MethodCall[]|StaticCall[]|ArrayCallable[] $calls
|
||||
* @return Type[]
|
||||
*/
|
||||
private function resolveTypesFromCalls(array $calls, string $strictnessLevel) : array
|
||||
private function resolveTypesFromCalls(array $calls, \Rector\TypeDeclaration\Enum\TypeStrictness $typeStrictness) : array
|
||||
{
|
||||
$staticTypesByArgumentPosition = [];
|
||||
foreach ($calls as $call) {
|
||||
|
@ -58,16 +58,16 @@ final class CallTypesResolver
|
|||
continue;
|
||||
}
|
||||
foreach ($call->args as $position => $arg) {
|
||||
$argValueType = $this->resolveArgValueType($strictnessLevel, $arg);
|
||||
$argValueType = $this->resolveArgValueType($typeStrictness, $arg);
|
||||
$staticTypesByArgumentPosition[$position][] = $argValueType;
|
||||
}
|
||||
}
|
||||
// unite to single type
|
||||
return $this->unionToSingleType($staticTypesByArgumentPosition);
|
||||
}
|
||||
private function resolveArgValueType(string $strictnessLevel, \PhpParser\Node\Arg $arg) : \PHPStan\Type\Type
|
||||
private function resolveArgValueType(\Rector\TypeDeclaration\Enum\TypeStrictness $typeStrictness, \PhpParser\Node\Arg $arg) : \PHPStan\Type\Type
|
||||
{
|
||||
if ($strictnessLevel === \Rector\TypeDeclaration\ValueObject\TypeStrictness::STRICTNESS_TYPE_DECLARATION) {
|
||||
if ($typeStrictness->equals(\Rector\TypeDeclaration\Enum\TypeStrictness::STRICTNESS_TYPE_DECLARATION())) {
|
||||
$argValueType = $this->nodeTypeResolver->getNativeType($arg->value);
|
||||
} else {
|
||||
$argValueType = $this->nodeTypeResolver->resolve($arg->value);
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\ValueObject;
|
||||
|
||||
/**
|
||||
* @enum
|
||||
*/
|
||||
final class TypeStrictness
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const STRICTNESS_TYPE_DECLARATION = 'type_declaration';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const STRICTNESS_DOCBLOCK = 'docblock';
|
||||
}
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '62bbaa56d25f109fe648949592bb50d94d30055d';
|
||||
public const PACKAGE_VERSION = '52827931451cd2e3d289234ce2dac370b138eb88';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-28 18:56:55';
|
||||
public const RELEASE_DATE = '2021-06-28 23:07:40';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210628\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 ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7::getLoader();
|
||||
return ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988::getLoader();
|
||||
|
|
8
vendor/composer/autoload_classmap.php
vendored
8
vendor/composer/autoload_classmap.php
vendored
|
@ -449,6 +449,8 @@ return array(
|
|||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\EditorConfigFile' => $vendorDir . '/idiosyncratic/editorconfig/src/EditorConfigFile.php',
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\Exception\\InvalidValue' => $vendorDir . '/idiosyncratic/editorconfig/src/Exception/InvalidValue.php',
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\Section' => $vendorDir . '/idiosyncratic/editorconfig/src/Section.php',
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\Enum' => $vendorDir . '/myclabs/php-enum/src/Enum.php',
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\PHPUnit\\Comparator' => $vendorDir . '/myclabs/php-enum/src/PHPUnit/Comparator.php',
|
||||
'RectorPrefix20210628\\Nette\\ArgumentOutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210628\\Nette\\DeprecatedException' => $vendorDir . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210628\\Nette\\DirectoryNotFoundException' => $vendorDir . '/nette/utils/src/exceptions.php',
|
||||
|
@ -1696,6 +1698,7 @@ return array(
|
|||
'Rector\\CodingStyle\\ClassNameImport\\UseImportsTraverser' => $baseDir . '/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php',
|
||||
'Rector\\CodingStyle\\ClassNameImport\\UsedImportsResolver' => $baseDir . '/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php',
|
||||
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => $baseDir . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
|
||||
'Rector\\CodingStyle\\Enum\\PreferenceSelfThis' => $baseDir . '/rules/CodingStyle/Enum/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\Naming\\ClassNaming' => $baseDir . '/rules/CodingStyle/Naming/ClassNaming.php',
|
||||
'Rector\\CodingStyle\\Naming\\NameRenamer' => $baseDir . '/rules/CodingStyle/Naming/NameRenamer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\ImplodeAnalyzer' => $baseDir . '/rules/CodingStyle/NodeAnalyzer/ImplodeAnalyzer.php',
|
||||
|
@ -1753,7 +1756,6 @@ return array(
|
|||
'Rector\\CodingStyle\\ValueObject\\NameAndParent' => $baseDir . '/rules/CodingStyle/ValueObject/NameAndParent.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\NodeToRemoveAndConcatItem' => $baseDir . '/rules/CodingStyle/ValueObject/NodeToRemoveAndConcatItem.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\ObjectMagicMethods' => $baseDir . '/rules/CodingStyle/ValueObject/ObjectMagicMethods.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\PreferenceSelfThis' => $baseDir . '/rules/CodingStyle/ValueObject/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\ReturnArrayClassMethodToYield' => $baseDir . '/rules/CodingStyle/ValueObject/ReturnArrayClassMethodToYield.php',
|
||||
'Rector\\Comments\\CommentRemover' => $baseDir . '/packages/Comments/CommentRemover.php',
|
||||
'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => $baseDir . '/packages/Comments/NodeDocBlock/DocBlockUpdater.php',
|
||||
|
@ -2711,6 +2713,7 @@ return array(
|
|||
'Rector\\Php74\\Rector\\Property\\TypedPropertyRector' => $baseDir . '/rules/Php74/Rector/Property/TypedPropertyRector.php',
|
||||
'Rector\\Php74\\Rector\\StaticCall\\ExportToReflectionFunctionRector' => $baseDir . '/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php',
|
||||
'Rector\\Php80\\Contract\\StrStartWithMatchAndRefactorInterface' => $baseDir . '/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php',
|
||||
'Rector\\Php80\\Enum\\MatchKind' => $baseDir . '/rules/Php80/Enum/MatchKind.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\StrncmpMatchAndRefactor' => $baseDir . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\StrposMatchAndRefactor' => $baseDir . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\SubstrMatchAndRefactor' => $baseDir . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php',
|
||||
|
@ -2748,7 +2751,6 @@ return array(
|
|||
'Rector\\Php80\\ValueObject\\AnnotationToAttribute' => $baseDir . '/rules/Php80/ValueObject/AnnotationToAttribute.php',
|
||||
'Rector\\Php80\\ValueObject\\ArrayDimFetchAndConstFetch' => $baseDir . '/rules/Php80/ValueObject/ArrayDimFetchAndConstFetch.php',
|
||||
'Rector\\Php80\\ValueObject\\CondAndExpr' => $baseDir . '/rules/Php80/ValueObject/CondAndExpr.php',
|
||||
'Rector\\Php80\\ValueObject\\MatchKind' => $baseDir . '/rules/Php80/ValueObject/MatchKind.php',
|
||||
'Rector\\Php80\\ValueObject\\PropertyPromotionCandidate' => $baseDir . '/rules/Php80/ValueObject/PropertyPromotionCandidate.php',
|
||||
'Rector\\Php80\\ValueObject\\StrStartsWith' => $baseDir . '/rules/Php80/ValueObject/StrStartsWith.php',
|
||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => $baseDir . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||
|
@ -3104,6 +3106,7 @@ return array(
|
|||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface' => $baseDir . '/rules/TypeDeclaration/Contract/TypeInferer/PriorityAwareTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\PropertyTypeInfererInterface' => $baseDir . '/rules/TypeDeclaration/Contract/TypeInferer/PropertyTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface' => $baseDir . '/rules/TypeDeclaration/Contract/TypeInferer/ReturnTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Enum\\TypeStrictness' => $baseDir . '/rules/TypeDeclaration/Enum/TypeStrictness.php',
|
||||
'Rector\\TypeDeclaration\\Exception\\ConflictingPriorityException' => $baseDir . '/rules/TypeDeclaration/Exception/ConflictingPriorityException.php',
|
||||
'Rector\\TypeDeclaration\\FunctionLikeReturnTypeResolver' => $baseDir . '/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php',
|
||||
'Rector\\TypeDeclaration\\Matcher\\PropertyAssignMatcher' => $baseDir . '/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php',
|
||||
|
@ -3174,7 +3177,6 @@ return array(
|
|||
'Rector\\TypeDeclaration\\ValueObject\\AddReturnTypeDeclaration' => $baseDir . '/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\NestedArrayType' => $baseDir . '/rules/TypeDeclaration/ValueObject/NestedArrayType.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\NewType' => $baseDir . '/rules/TypeDeclaration/ValueObject/NewType.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\TypeStrictness' => $baseDir . '/rules/TypeDeclaration/ValueObject/TypeStrictness.php',
|
||||
'Rector\\VendorLocker\\Contract\\NodeVendorLockerInterface' => $baseDir . '/packages/VendorLocker/Contract/NodeVendorLockerInterface.php',
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodParamVendorLockResolver' => $baseDir . '/packages/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php',
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodReturnTypeOverrideGuard' => $baseDir . '/packages/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php',
|
||||
|
|
1
vendor/composer/autoload_psr4.php
vendored
1
vendor/composer/autoload_psr4.php
vendored
|
@ -60,6 +60,7 @@ return array(
|
|||
'RectorPrefix20210628\\Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
'RectorPrefix20210628\\Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
|
||||
'RectorPrefix20210628\\Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\' => array($vendorDir . '/idiosyncratic/editorconfig/src'),
|
||||
'RectorPrefix20210628\\Helmich\\TypoScriptParser\\' => array($vendorDir . '/helmich/typo3-typoscript-parser/src'),
|
||||
'RectorPrefix20210628\\Ergebnis\\Json\\Printer\\' => array($vendorDir . '/ergebnis/json-printer/src'),
|
||||
|
|
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 ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7
|
||||
class ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988', '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\ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire92899c2fe71c7ff99a7daca0252b51b7($fileIdentifier, $file);
|
||||
composerRequire17aa69144b9ef7ee6ca87e81037b6988($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire92899c2fe71c7ff99a7daca0252b51b7($fileIdentifier, $file)
|
||||
function composerRequire17aa69144b9ef7ee6ca87e81037b6988($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
21
vendor/composer/autoload_static.php
vendored
21
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
||||
class ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -84,6 +84,7 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'RectorPrefix20210628\\Psr\\Log\\' => 29,
|
||||
'RectorPrefix20210628\\Psr\\EventDispatcher\\' => 41,
|
||||
'RectorPrefix20210628\\Psr\\Container\\' => 35,
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\' => 34,
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\' => 48,
|
||||
'RectorPrefix20210628\\Helmich\\TypoScriptParser\\' => 46,
|
||||
'RectorPrefix20210628\\Ergebnis\\Json\\Printer\\' => 43,
|
||||
|
@ -317,6 +318,10 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/container/src',
|
||||
),
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
|
||||
),
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src',
|
||||
|
@ -799,6 +804,8 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\EditorConfigFile' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/EditorConfigFile.php',
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\Exception\\InvalidValue' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/Exception/InvalidValue.php',
|
||||
'RectorPrefix20210628\\Idiosyncratic\\EditorConfig\\Section' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/Section.php',
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\Enum' => __DIR__ . '/..' . '/myclabs/php-enum/src/Enum.php',
|
||||
'RectorPrefix20210628\\MyCLabs\\Enum\\PHPUnit\\Comparator' => __DIR__ . '/..' . '/myclabs/php-enum/src/PHPUnit/Comparator.php',
|
||||
'RectorPrefix20210628\\Nette\\ArgumentOutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210628\\Nette\\DeprecatedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210628\\Nette\\DirectoryNotFoundException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php',
|
||||
|
@ -2046,6 +2053,7 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\CodingStyle\\ClassNameImport\\UseImportsTraverser' => __DIR__ . '/../..' . '/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php',
|
||||
'Rector\\CodingStyle\\ClassNameImport\\UsedImportsResolver' => __DIR__ . '/../..' . '/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php',
|
||||
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => __DIR__ . '/../..' . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
|
||||
'Rector\\CodingStyle\\Enum\\PreferenceSelfThis' => __DIR__ . '/../..' . '/rules/CodingStyle/Enum/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\Naming\\ClassNaming' => __DIR__ . '/../..' . '/rules/CodingStyle/Naming/ClassNaming.php',
|
||||
'Rector\\CodingStyle\\Naming\\NameRenamer' => __DIR__ . '/../..' . '/rules/CodingStyle/Naming/NameRenamer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\ImplodeAnalyzer' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeAnalyzer/ImplodeAnalyzer.php',
|
||||
|
@ -2103,7 +2111,6 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\CodingStyle\\ValueObject\\NameAndParent' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/NameAndParent.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\NodeToRemoveAndConcatItem' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/NodeToRemoveAndConcatItem.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\ObjectMagicMethods' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/ObjectMagicMethods.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\PreferenceSelfThis' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\ValueObject\\ReturnArrayClassMethodToYield' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/ReturnArrayClassMethodToYield.php',
|
||||
'Rector\\Comments\\CommentRemover' => __DIR__ . '/../..' . '/packages/Comments/CommentRemover.php',
|
||||
'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => __DIR__ . '/../..' . '/packages/Comments/NodeDocBlock/DocBlockUpdater.php',
|
||||
|
@ -3061,6 +3068,7 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\Php74\\Rector\\Property\\TypedPropertyRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/Property/TypedPropertyRector.php',
|
||||
'Rector\\Php74\\Rector\\StaticCall\\ExportToReflectionFunctionRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php',
|
||||
'Rector\\Php80\\Contract\\StrStartWithMatchAndRefactorInterface' => __DIR__ . '/../..' . '/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php',
|
||||
'Rector\\Php80\\Enum\\MatchKind' => __DIR__ . '/../..' . '/rules/Php80/Enum/MatchKind.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\StrncmpMatchAndRefactor' => __DIR__ . '/../..' . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\StrposMatchAndRefactor' => __DIR__ . '/../..' . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php',
|
||||
'Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\SubstrMatchAndRefactor' => __DIR__ . '/../..' . '/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php',
|
||||
|
@ -3098,7 +3106,6 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\Php80\\ValueObject\\AnnotationToAttribute' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/AnnotationToAttribute.php',
|
||||
'Rector\\Php80\\ValueObject\\ArrayDimFetchAndConstFetch' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/ArrayDimFetchAndConstFetch.php',
|
||||
'Rector\\Php80\\ValueObject\\CondAndExpr' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/CondAndExpr.php',
|
||||
'Rector\\Php80\\ValueObject\\MatchKind' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/MatchKind.php',
|
||||
'Rector\\Php80\\ValueObject\\PropertyPromotionCandidate' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/PropertyPromotionCandidate.php',
|
||||
'Rector\\Php80\\ValueObject\\StrStartsWith' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/StrStartsWith.php',
|
||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => __DIR__ . '/../..' . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||
|
@ -3454,6 +3461,7 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/TypeInferer/PriorityAwareTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\PropertyTypeInfererInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/TypeInferer/PropertyTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Contract/TypeInferer/ReturnTypeInfererInterface.php',
|
||||
'Rector\\TypeDeclaration\\Enum\\TypeStrictness' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Enum/TypeStrictness.php',
|
||||
'Rector\\TypeDeclaration\\Exception\\ConflictingPriorityException' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Exception/ConflictingPriorityException.php',
|
||||
'Rector\\TypeDeclaration\\FunctionLikeReturnTypeResolver' => __DIR__ . '/../..' . '/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php',
|
||||
'Rector\\TypeDeclaration\\Matcher\\PropertyAssignMatcher' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php',
|
||||
|
@ -3524,7 +3532,6 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
'Rector\\TypeDeclaration\\ValueObject\\AddReturnTypeDeclaration' => __DIR__ . '/../..' . '/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\NestedArrayType' => __DIR__ . '/../..' . '/rules/TypeDeclaration/ValueObject/NestedArrayType.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\NewType' => __DIR__ . '/../..' . '/rules/TypeDeclaration/ValueObject/NewType.php',
|
||||
'Rector\\TypeDeclaration\\ValueObject\\TypeStrictness' => __DIR__ . '/../..' . '/rules/TypeDeclaration/ValueObject/TypeStrictness.php',
|
||||
'Rector\\VendorLocker\\Contract\\NodeVendorLockerInterface' => __DIR__ . '/../..' . '/packages/VendorLocker/Contract/NodeVendorLockerInterface.php',
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodParamVendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php',
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\ClassMethodReturnTypeOverrideGuard' => __DIR__ . '/../..' . '/packages/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php',
|
||||
|
@ -3831,9 +3838,9 @@ class ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit92899c2fe71c7ff99a7daca0252b51b7::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit17aa69144b9ef7ee6ca87e81037b6988::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
79
vendor/composer/installed.json
vendored
79
vendor/composer/installed.json
vendored
|
@ -500,6 +500,69 @@
|
|||
},
|
||||
"install-path": "..\/idiosyncratic\/editorconfig"
|
||||
},
|
||||
{
|
||||
"name": "myclabs\/php-enum",
|
||||
"version": "1.8.0",
|
||||
"version_normalized": "1.8.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/myclabs\/php-enum.git",
|
||||
"reference": "46cf3d8498b095bd33727b13fd5707263af99421"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/myclabs\/php-enum\/zipball\/46cf3d8498b095bd33727b13fd5707263af99421",
|
||||
"reference": "46cf3d8498b095bd33727b13fd5707263af99421",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": "^7.3 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"squizlabs\/php_codesniffer": "1.*",
|
||||
"vimeo\/psalm": "^4.5.1"
|
||||
},
|
||||
"time": "2021-02-15T16:11:48+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210628\\MyCLabs\\Enum\\": "src\/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP Enum contributors",
|
||||
"homepage": "https:\/\/github.com\/myclabs\/php-enum\/graphs\/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP Enum implementation",
|
||||
"homepage": "http:\/\/github.com\/myclabs\/php-enum",
|
||||
"keywords": [
|
||||
"enum"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/myclabs\/php-enum\/issues",
|
||||
"source": "https:\/\/github.com\/myclabs\/php-enum\/tree\/1.8.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https:\/\/github.com\/mnapoli",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https:\/\/tidelift.com\/funding\/github\/packagist\/myclabs\/php-enum",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "..\/myclabs\/php-enum"
|
||||
},
|
||||
{
|
||||
"name": "nette\/neon",
|
||||
"version": "v3.2.2",
|
||||
|
@ -1288,17 +1351,17 @@
|
|||
},
|
||||
{
|
||||
"name": "rector\/rector-nette",
|
||||
"version": "0.11.10",
|
||||
"version_normalized": "0.11.10.0",
|
||||
"version": "0.11.11",
|
||||
"version_normalized": "0.11.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||
"reference": "f014b55cf626a0257f70a3cf42913a002de59001"
|
||||
"reference": "7120e3e1db27d404fe4f169134980d598caaa49c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/f014b55cf626a0257f70a3cf42913a002de59001",
|
||||
"reference": "f014b55cf626a0257f70a3cf42913a002de59001",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/7120e3e1db27d404fe4f169134980d598caaa49c",
|
||||
"reference": "7120e3e1db27d404fe4f169134980d598caaa49c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1317,14 +1380,14 @@
|
|||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpstan\/phpstan-nette": "^0.12.16",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"rector\/rector-phpstan-rules": "^0.2.8",
|
||||
"rector\/rector-phpstan-rules": "^0.3.4",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"symplify\/easy-coding-standard": "^9.3",
|
||||
"symplify\/phpstan-extensions": "^9.3",
|
||||
"symplify\/phpstan-rules": "^9.3",
|
||||
"symplify\/rule-doc-generator": "^9.3"
|
||||
},
|
||||
"time": "2021-06-26T11:53:53+00:00",
|
||||
"time": "2021-06-28T18:53:07+00:00",
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -1349,7 +1412,7 @@
|
|||
"description": "Rector upgrades rules for Nette Framework",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.10"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.11"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-nette"
|
||||
},
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
18
vendor/myclabs/php-enum/LICENSE
vendored
Normal file
18
vendor/myclabs/php-enum/LICENSE
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 My C-Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
138
vendor/myclabs/php-enum/README.md
vendored
Normal file
138
vendor/myclabs/php-enum/README.md
vendored
Normal file
|
@ -0,0 +1,138 @@
|
|||
# PHP Enum implementation inspired from SplEnum
|
||||
|
||||
[![Build Status](https://travis-ci.org/myclabs/php-enum.png?branch=master)](https://travis-ci.org/myclabs/php-enum)
|
||||
[![Latest Stable Version](https://poser.pugx.org/myclabs/php-enum/version.png)](https://packagist.org/packages/myclabs/php-enum)
|
||||
[![Total Downloads](https://poser.pugx.org/myclabs/php-enum/downloads.png)](https://packagist.org/packages/myclabs/php-enum)
|
||||
[![psalm](https://shepherd.dev/github/myclabs/php-enum/coverage.svg)](https://shepherd.dev/github/myclabs/php-enum)
|
||||
|
||||
Maintenance for this project is [supported via Tidelift](https://tidelift.com/subscription/pkg/packagist-myclabs-php-enum?utm_source=packagist-myclabs-php-enum&utm_medium=referral&utm_campaign=readme).
|
||||
|
||||
## Why?
|
||||
|
||||
First, and mainly, `SplEnum` is not integrated to PHP, you have to install the extension separately.
|
||||
|
||||
Using an enum instead of class constants provides the following advantages:
|
||||
|
||||
- You can use an enum as a parameter type: `function setAction(Action $action) {`
|
||||
- You can use an enum as a return type: `function getAction() : Action {`
|
||||
- You can enrich the enum with methods (e.g. `format`, `parse`, …)
|
||||
- You can extend the enum to add new values (make your enum `final` to prevent it)
|
||||
- You can get a list of all the possible values (see below)
|
||||
|
||||
This Enum class is not intended to replace class constants, but only to be used when it makes sense.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
composer require myclabs/php-enum
|
||||
```
|
||||
|
||||
## Declaration
|
||||
|
||||
```php
|
||||
use MyCLabs\Enum\Enum;
|
||||
|
||||
/**
|
||||
* Action enum
|
||||
*/
|
||||
final class Action extends Enum
|
||||
{
|
||||
private const VIEW = 'view';
|
||||
private const EDIT = 'edit';
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
$action = Action::VIEW();
|
||||
|
||||
// or with a dynamic key:
|
||||
$action = Action::$key();
|
||||
// or with a dynamic value:
|
||||
$action = Action::from($value);
|
||||
// or
|
||||
$action = new Action($value);
|
||||
```
|
||||
|
||||
As you can see, static methods are automatically implemented to provide quick access to an enum value.
|
||||
|
||||
One advantage over using class constants is to be able to use an enum as a parameter type:
|
||||
|
||||
```php
|
||||
function setAction(Action $action) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- `__construct()` The constructor checks that the value exist in the enum
|
||||
- `__toString()` You can `echo $myValue`, it will display the enum value (value of the constant)
|
||||
- `getValue()` Returns the current value of the enum
|
||||
- `getKey()` Returns the key of the current value on Enum
|
||||
- `equals()` Tests whether enum instances are equal (returns `true` if enum values are equal, `false` otherwise)
|
||||
|
||||
Static methods:
|
||||
|
||||
- `from()` Creates an Enum instance, checking that the value exist in the enum
|
||||
- `toArray()` method Returns all possible values as an array (constant name in key, constant value in value)
|
||||
- `keys()` Returns the names (keys) of all constants in the Enum class
|
||||
- `values()` Returns instances of the Enum class of all Enum constants (constant name in key, Enum instance in value)
|
||||
- `isValid()` Check if tested value is valid on enum set
|
||||
- `isValidKey()` Check if tested key is valid on enum set
|
||||
- `assertValidValue()` Assert the value is valid on enum set, throwing exception otherwise
|
||||
- `search()` Return key for searched value
|
||||
|
||||
### Static methods
|
||||
|
||||
```php
|
||||
final class Action extends Enum
|
||||
{
|
||||
private const VIEW = 'view';
|
||||
private const EDIT = 'edit';
|
||||
}
|
||||
|
||||
// Static method:
|
||||
$action = Action::VIEW();
|
||||
$action = Action::EDIT();
|
||||
```
|
||||
|
||||
Static method helpers are implemented using [`__callStatic()`](http://www.php.net/manual/en/language.oop5.overloading.php#object.callstatic).
|
||||
|
||||
If you care about IDE autocompletion, you can either implement the static methods yourself:
|
||||
|
||||
```php
|
||||
final class Action extends Enum
|
||||
{
|
||||
private const VIEW = 'view';
|
||||
|
||||
/**
|
||||
* @return Action
|
||||
*/
|
||||
public static function VIEW() {
|
||||
return new Action(self::VIEW);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
or you can use phpdoc (this is supported in PhpStorm for example):
|
||||
|
||||
```php
|
||||
/**
|
||||
* @method static Action VIEW()
|
||||
* @method static Action EDIT()
|
||||
*/
|
||||
final class Action extends Enum
|
||||
{
|
||||
private const VIEW = 'view';
|
||||
private const EDIT = 'edit';
|
||||
}
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
- [Doctrine enum mapping](https://github.com/acelaya/doctrine-enum-type)
|
||||
- [Symfony ParamConverter integration](https://github.com/Ex3v/MyCLabsEnumParamConverter)
|
||||
- [PHPStan integration](https://github.com/timeweb/phpstan-enum)
|
||||
- [Yii2 enum mapping](https://github.com/KartaviK/yii2-enum)
|
11
vendor/myclabs/php-enum/SECURITY.md
vendored
Normal file
11
vendor/myclabs/php-enum/SECURITY.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Only the latest stable release is supported.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
|
||||
|
||||
Tidelift will coordinate the fix and disclosure.
|
35
vendor/myclabs/php-enum/composer.json
vendored
Normal file
35
vendor/myclabs/php-enum/composer.json
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "myclabs\/php-enum",
|
||||
"type": "library",
|
||||
"description": "PHP Enum implementation",
|
||||
"keywords": [
|
||||
"enum"
|
||||
],
|
||||
"homepage": "http:\/\/github.com\/myclabs\/php-enum",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP Enum contributors",
|
||||
"homepage": "https:\/\/github.com\/myclabs\/php-enum\/graphs\/contributors"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210628\\MyCLabs\\Enum\\": "src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210628\\MyCLabs\\Tests\\Enum\\": "tests\/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3 || ^8.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"squizlabs\/php_codesniffer": "1.*",
|
||||
"vimeo\/psalm": "^4.5.1"
|
||||
}
|
||||
}
|
35
vendor/myclabs/php-enum/psalm.xml
vendored
Normal file
35
vendor/myclabs/php-enum/psalm.xml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
totallyTyped="true"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<directory name="static-analysis" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
<directory name="src/PHPUnit" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
|
||||
<issueHandlers>
|
||||
<MixedAssignment errorLevel="info" />
|
||||
|
||||
<ImpureStaticProperty>
|
||||
<!-- self::$... usages in Enum are used to populate an internal cache, and cause no side-effects -->
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Enum.php"/>
|
||||
</errorLevel>
|
||||
</ImpureStaticProperty>
|
||||
|
||||
<ImpureVariable>
|
||||
<!-- $this usages in Enum point themselves to an immutable instance -->
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Enum.php"/>
|
||||
</errorLevel>
|
||||
</ImpureVariable>
|
||||
</issueHandlers>
|
||||
</psalm>
|
274
vendor/myclabs/php-enum/src/Enum.php
vendored
Normal file
274
vendor/myclabs/php-enum/src/Enum.php
vendored
Normal file
|
@ -0,0 +1,274 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @link http://github.com/myclabs/php-enum
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
|
||||
*/
|
||||
namespace RectorPrefix20210628\MyCLabs\Enum;
|
||||
|
||||
/**
|
||||
* Base Enum class
|
||||
*
|
||||
* Create an enum by implementing this class and adding class constants.
|
||||
*
|
||||
* @author Matthieu Napoli <matthieu@mnapoli.fr>
|
||||
* @author Daniel Costa <danielcosta@gmail.com>
|
||||
* @author Mirosław Filip <mirfilip@gmail.com>
|
||||
*
|
||||
* @psalm-template T
|
||||
* @psalm-immutable
|
||||
* @psalm-consistent-constructor
|
||||
*/
|
||||
abstract class Enum implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Enum value
|
||||
*
|
||||
* @var mixed
|
||||
* @psalm-var T
|
||||
*/
|
||||
protected $value;
|
||||
/**
|
||||
* Enum key, the constant name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $key;
|
||||
/**
|
||||
* Store existing constants in a static cache per object.
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @psalm-var array<class-string, array<string, mixed>>
|
||||
*/
|
||||
protected static $cache = [];
|
||||
/**
|
||||
* Cache of instances of the Enum class
|
||||
*
|
||||
* @var array
|
||||
* @psalm-var array<class-string, array<string, static>>
|
||||
*/
|
||||
protected static $instances = [];
|
||||
/**
|
||||
* Creates a new value of some type
|
||||
*
|
||||
* @psalm-pure
|
||||
* @param mixed $value
|
||||
*
|
||||
* @psalm-param T $value
|
||||
* @throws \UnexpectedValueException if incompatible type is given.
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
if ($value instanceof static) {
|
||||
/** @psalm-var T */
|
||||
$value = $value->getValue();
|
||||
}
|
||||
$this->key = static::assertValidValueReturningKey($value);
|
||||
/** @psalm-var T */
|
||||
$this->value = $value;
|
||||
}
|
||||
public function __wakeup()
|
||||
{
|
||||
if ($this->key === null) {
|
||||
$this->key = static::search($this->value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
* @psalm-return static<T>
|
||||
*/
|
||||
public static function from($value)
|
||||
{
|
||||
$key = static::assertValidValueReturningKey($value);
|
||||
return self::__callStatic($key, []);
|
||||
}
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @return mixed
|
||||
* @psalm-return T
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
/**
|
||||
* Returns the enum key (i.e. the constant name).
|
||||
*
|
||||
* @psalm-pure
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @psalm-suppress InvalidCast
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
/**
|
||||
* Determines if Enum should be considered equal with the variable passed as a parameter.
|
||||
* Returns false if an argument is an object of different class or not an object.
|
||||
*
|
||||
* This method is final, for more information read https://github.com/myclabs/php-enum/issues/4
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-param mixed $variable
|
||||
* @return bool
|
||||
*/
|
||||
public final function equals($variable = null) : bool
|
||||
{
|
||||
return $variable instanceof self && $this->getValue() === $variable->getValue() && static::class === \get_class($variable);
|
||||
}
|
||||
/**
|
||||
* Returns the names (keys) of all constants in the Enum class
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-return list<string>
|
||||
* @return array
|
||||
*/
|
||||
public static function keys()
|
||||
{
|
||||
return \array_keys(static::toArray());
|
||||
}
|
||||
/**
|
||||
* Returns instances of the Enum class of all Enum constants
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-return array<string, static>
|
||||
* @return static[] Constant name in key, Enum instance in value
|
||||
*/
|
||||
public static function values()
|
||||
{
|
||||
$values = array();
|
||||
/** @psalm-var T $value */
|
||||
foreach (static::toArray() as $key => $value) {
|
||||
$values[$key] = new static($value);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
/**
|
||||
* Returns all possible values as an array
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-suppress ImpureStaticProperty
|
||||
*
|
||||
* @psalm-return array<string, mixed>
|
||||
* @return array Constant name in key, constant value in value
|
||||
*/
|
||||
public static function toArray()
|
||||
{
|
||||
$class = static::class;
|
||||
if (!isset(static::$cache[$class])) {
|
||||
/** @psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here */
|
||||
$reflection = new \ReflectionClass($class);
|
||||
/** @psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here */
|
||||
static::$cache[$class] = $reflection->getConstants();
|
||||
}
|
||||
return static::$cache[$class];
|
||||
}
|
||||
/**
|
||||
* Check if is valid enum value
|
||||
*
|
||||
* @param $value
|
||||
* @psalm-param mixed $value
|
||||
* @psalm-pure
|
||||
* @psalm-assert-if-true T $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function isValid($value)
|
||||
{
|
||||
return \in_array($value, static::toArray(), \true);
|
||||
}
|
||||
/**
|
||||
* Asserts valid enum value
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-assert T $value
|
||||
*/
|
||||
public static function assertValidValue($value) : void
|
||||
{
|
||||
self::assertValidValueReturningKey($value);
|
||||
}
|
||||
/**
|
||||
* Asserts valid enum value
|
||||
*
|
||||
* @psalm-pure
|
||||
* @psalm-assert T $value
|
||||
*/
|
||||
private static function assertValidValueReturningKey($value) : string
|
||||
{
|
||||
if (\false === ($key = static::search($value))) {
|
||||
throw new \UnexpectedValueException("Value '{$value}' is not part of the enum " . static::class);
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
/**
|
||||
* Check if is valid enum key
|
||||
*
|
||||
* @param $key
|
||||
* @psalm-param string $key
|
||||
* @psalm-pure
|
||||
* @return bool
|
||||
*/
|
||||
public static function isValidKey($key)
|
||||
{
|
||||
$array = static::toArray();
|
||||
return isset($array[$key]) || \array_key_exists($key, $array);
|
||||
}
|
||||
/**
|
||||
* Return key for value
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @psalm-param mixed $value
|
||||
* @psalm-pure
|
||||
* @return string|false
|
||||
*/
|
||||
public static function search($value)
|
||||
{
|
||||
return \array_search($value, static::toArray(), \true);
|
||||
}
|
||||
/**
|
||||
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return static
|
||||
* @throws \BadMethodCallException
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
$class = static::class;
|
||||
if (!isset(self::$instances[$class][$name])) {
|
||||
$array = static::toArray();
|
||||
if (!isset($array[$name]) && !\array_key_exists($name, $array)) {
|
||||
$message = "No static method or enum constant '{$name}' in class " . static::class;
|
||||
throw new \BadMethodCallException($message);
|
||||
}
|
||||
return self::$instances[$class][$name] = new static($array[$name]);
|
||||
}
|
||||
return clone self::$instances[$class][$name];
|
||||
}
|
||||
/**
|
||||
* Specify data which should be serialized to JSON. This method returns data that can be serialized by json_encode()
|
||||
* natively.
|
||||
*
|
||||
* @return mixed
|
||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @psalm-pure
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
}
|
40
vendor/myclabs/php-enum/src/PHPUnit/Comparator.php
vendored
Normal file
40
vendor/myclabs/php-enum/src/PHPUnit/Comparator.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210628\MyCLabs\Enum\PHPUnit;
|
||||
|
||||
use RectorPrefix20210628\MyCLabs\Enum\Enum;
|
||||
use RectorPrefix20210628\SebastianBergmann\Comparator\ComparisonFailure;
|
||||
/**
|
||||
* Use this Comparator to get nice output when using PHPUnit assertEquals() with Enums.
|
||||
*
|
||||
* Add this to your PHPUnit bootstrap PHP file:
|
||||
*
|
||||
* \SebastianBergmann\Comparator\Factory::getInstance()->register(new \MyCLabs\Enum\PHPUnit\Comparator());
|
||||
*/
|
||||
final class Comparator extends \RectorPrefix20210628\SebastianBergmann\Comparator\Comparator
|
||||
{
|
||||
public function accepts($expected, $actual)
|
||||
{
|
||||
return $expected instanceof \RectorPrefix20210628\MyCLabs\Enum\Enum && ($actual instanceof \RectorPrefix20210628\MyCLabs\Enum\Enum || $actual === null);
|
||||
}
|
||||
/**
|
||||
* @param Enum $expected
|
||||
* @param Enum|null $actual
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false)
|
||||
{
|
||||
if ($expected->equals($actual)) {
|
||||
return;
|
||||
}
|
||||
throw new \RectorPrefix20210628\SebastianBergmann\Comparator\ComparisonFailure($expected, $actual, $this->formatEnum($expected), $this->formatEnum($actual), \false, 'Failed asserting that two Enums are equal.');
|
||||
}
|
||||
private function formatEnum(\RectorPrefix20210628\MyCLabs\Enum\Enum $enum = null)
|
||||
{
|
||||
if ($enum === null) {
|
||||
return "null";
|
||||
}
|
||||
return \get_class($enum) . "::{$enum->getKey()}()";
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.10'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.18'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.11'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.18'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
2
vendor/rector/rector-nette/composer.json
vendored
2
vendor/rector/rector-nette/composer.json
vendored
|
@ -21,7 +21,7 @@
|
|||
"nette\/forms": "3.0.*",
|
||||
"symplify\/rule-doc-generator": "^9.3",
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"rector\/rector-phpstan-rules": "^0.2.8"
|
||||
"rector\/rector-phpstan-rules": "^0.3.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
|
@ -11,8 +11,11 @@ use PhpParser\Node\Param;
|
|||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\ParameterReflection;
|
||||
use PHPStan\Reflection\ParametersAcceptorSelector;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Nette\NodeAnalyzer\StaticCallAnalyzer;
|
||||
use Rector\Nette\NodeFinder\ParamFinder;
|
||||
|
@ -52,11 +55,16 @@ final class RemoveParentAndNameFromComponentConstructorRector extends \Rector\Co
|
|||
* @var \Rector\NodeTypeResolver\MethodParameterTypeResolver
|
||||
*/
|
||||
private $methodParameterTypeResolver;
|
||||
public function __construct(\Rector\Nette\NodeFinder\ParamFinder $paramFinder, \Rector\Nette\NodeAnalyzer\StaticCallAnalyzer $staticCallAnalyzer, \Rector\NodeTypeResolver\MethodParameterTypeResolver $methodParameterTypeResolver)
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
public function __construct(\Rector\Nette\NodeFinder\ParamFinder $paramFinder, \Rector\Nette\NodeAnalyzer\StaticCallAnalyzer $staticCallAnalyzer, \Rector\NodeTypeResolver\MethodParameterTypeResolver $methodParameterTypeResolver, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver)
|
||||
{
|
||||
$this->paramFinder = $paramFinder;
|
||||
$this->staticCallAnalyzer = $staticCallAnalyzer;
|
||||
$this->methodParameterTypeResolver = $methodParameterTypeResolver;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->controlObjectType = new \PHPStan\Type\ObjectType('Nette\\Application\\UI\\Control');
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
|
@ -148,7 +156,16 @@ CODE_SAMPLE
|
|||
}
|
||||
private function refactorNew(\PhpParser\Node\Expr\New_ $new) : void
|
||||
{
|
||||
$parameterNames = $this->methodParameterTypeResolver->provideParameterNamesByNew($new);
|
||||
$methodReflection = $this->reflectionResolver->resolveMethodReflectionFromNew($new);
|
||||
if ($methodReflection === null) {
|
||||
return;
|
||||
}
|
||||
$parameterNames = [];
|
||||
$parametersAcceptor = \PHPStan\Reflection\ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
|
||||
foreach ($parametersAcceptor->getParameters() as $parameterReflection) {
|
||||
/** @var ParameterReflection $parameterReflection */
|
||||
$parameterNames[] = $parameterReflection->getName();
|
||||
}
|
||||
foreach ($new->args as $position => $arg) {
|
||||
// is on position of $parent or $name?
|
||||
if (!isset($parameterNames[$position])) {
|
||||
|
|
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('RectorPrefix20210628\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7', false) && !interface_exists('ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7', false) && !trait_exists('ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7', false)) {
|
||||
spl_autoload_call('RectorPrefix20210628\ComposerAutoloaderInit92899c2fe71c7ff99a7daca0252b51b7');
|
||||
if (!class_exists('ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988', false) && !interface_exists('ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988', false) && !trait_exists('ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988', false)) {
|
||||
spl_autoload_call('RectorPrefix20210628\ComposerAutoloaderInit17aa69144b9ef7ee6ca87e81037b6988');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210628\Doctrine\Inflector\Inflector');
|
||||
|
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210628\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire92899c2fe71c7ff99a7daca0252b51b7')) {
|
||||
function composerRequire92899c2fe71c7ff99a7daca0252b51b7() {
|
||||
return \RectorPrefix20210628\composerRequire92899c2fe71c7ff99a7daca0252b51b7(...func_get_args());
|
||||
if (!function_exists('composerRequire17aa69144b9ef7ee6ca87e81037b6988')) {
|
||||
function composerRequire17aa69144b9ef7ee6ca87e81037b6988() {
|
||||
return \RectorPrefix20210628\composerRequire17aa69144b9ef7ee6ca87e81037b6988(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user