Updated Rector to commit 7053e9acd1

7053e9acd1 [DX] Replace deprecated danielstjules/stringy with Symfony\String (#1425)
This commit is contained in:
Tomas Votruba 2021-12-08 09:09:46 +00:00
parent 6ee24b2d05
commit 4a64f24f19
22 changed files with 126 additions and 180 deletions

View File

@ -7,17 +7,8 @@ use RectorPrefix20211208\Nette\Utils\Strings;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Function_;
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
use RectorPrefix20211208\Stringy\Stringy;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ClassNaming
{
/**
* @see https://regex101.com/r/8BdrI3/1
* @var string
*/
private const INPUT_HASH_NAMING_REGEX = '#input_(.*?)_#';
/**
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name|string $name
*/
@ -52,31 +43,4 @@ final class ClassNaming
$fullyQualifiedName = \trim($fullyQualifiedName, '\\');
return \RectorPrefix20211208\Nette\Utils\Strings::before($fullyQualifiedName, '\\', -1);
}
public function getNameFromFileInfo(\Symplify\SmartFileSystem\SmartFileInfo $smartFileInfo) : string
{
$basenameWithoutSuffix = $smartFileInfo->getBasenameWithoutSuffix();
// remove PHPUnit fixture file prefix
if (\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun()) {
$basenameWithoutSuffix = \RectorPrefix20211208\Nette\Utils\Strings::replace($basenameWithoutSuffix, self::INPUT_HASH_NAMING_REGEX, '');
}
$stringy = new \RectorPrefix20211208\Stringy\Stringy($basenameWithoutSuffix);
return (string) $stringy->upperCamelize();
}
/**
* "some_function" "someFunction"
*/
public function createMethodNameFromFunction(\PhpParser\Node\Stmt\Function_ $function) : string
{
$functionName = (string) $function->name;
$stringy = new \RectorPrefix20211208\Stringy\Stringy($functionName);
return (string) $stringy->camelize();
}
public function replaceSuffix(string $content, string $oldSuffix, string $newSuffix) : string
{
if (\substr_compare($content, $oldSuffix, -\strlen($oldSuffix)) !== 0) {
return $content . $newSuffix;
}
$contentWithoutOldSuffix = \RectorPrefix20211208\Nette\Utils\Strings::substring($content, 0, -\RectorPrefix20211208\Nette\Utils\Strings::length($oldSuffix));
return $contentWithoutOldSuffix . $newSuffix;
}
}

View File

@ -7,7 +7,6 @@ use RectorPrefix20211208\Nette\Utils\Strings;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
@ -17,16 +16,14 @@ use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar;
use PhpParser\Node\Scalar\String_;
use PHPStan\Analyser\Scope;
use PHPStan\Type\ThisType;
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\NodeTypeResolver;
use RectorPrefix20211208\Stringy\Stringy;
use RectorPrefix20211208\Symfony\Component\String\UnicodeString;
final class VariableNaming
{
/**
@ -34,36 +31,16 @@ final class VariableNaming
* @var \Rector\NodeNameResolver\NodeNameResolver
*/
private $nodeNameResolver;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
*/
private $valueResolver;
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeResolver
*/
private $nodeTypeResolver;
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\PhpParser\Node\Value\ValueResolver $valueResolver, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver)
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver)
{
$this->nodeNameResolver = $nodeNameResolver;
$this->valueResolver = $valueResolver;
$this->nodeTypeResolver = $nodeTypeResolver;
}
public function resolveFromNodeAndType(\PhpParser\Node $node, \PHPStan\Type\Type $type) : ?string
{
$variableName = $this->resolveBareFromNode($node);
if ($variableName === null) {
return null;
}
// adjust static to specific class
if ($variableName === 'this' && $type instanceof \PHPStan\Type\ThisType) {
$shortClassName = $this->nodeNameResolver->getShortName($type->getClassName());
$variableName = \lcfirst($shortClassName);
}
$stringy = new \RectorPrefix20211208\Stringy\Stringy($variableName);
return (string) $stringy->camelize();
}
public function resolveFromNodeWithScopeCountAndFallbackName(\PhpParser\Node\Expr $expr, ?\PHPStan\Analyser\Scope $scope, string $fallbackName) : string
{
$name = $this->resolveFromNode($expr);
@ -99,7 +76,23 @@ final class VariableNaming
$bareName = $this->resolveBareFuncCallArgumentName($funcCall, $fallbackName, $suffix);
return $this->createCountedValueName($bareName, $scope);
}
public function resolveFromNode(\PhpParser\Node $node) : ?string
public function resolveFromNodeAndType(\PhpParser\Node $node, \PHPStan\Type\Type $type) : ?string
{
$variableName = $this->resolveBareFromNode($node);
if ($variableName === null) {
return null;
}
// adjust static to specific class
if ($variableName === 'this' && $type instanceof \PHPStan\Type\ThisType) {
$shortClassName = $this->nodeNameResolver->getShortName($type->getClassName());
$variableName = \lcfirst($shortClassName);
} else {
$variableName = $this->nodeNameResolver->getShortName($variableName);
}
$variableNameUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($variableName);
return $variableNameUnicodeString->camel()->toString();
}
private function resolveFromNode(\PhpParser\Node $node) : ?string
{
$nodeType = $this->nodeTypeResolver->getType($node);
return $this->resolveFromNodeAndType($node, $nodeType);
@ -107,9 +100,6 @@ final class VariableNaming
private function resolveBareFromNode(\PhpParser\Node $node) : ?string
{
$node = $this->unwrapNode($node);
if ($node instanceof \PhpParser\Node\Expr\ArrayDimFetch) {
return $this->resolveParamNameFromArrayDimFetch($node);
}
if ($node instanceof \PhpParser\Node\Expr\PropertyFetch) {
return $this->resolveFromPropertyFetch($node);
}
@ -134,20 +124,6 @@ final class VariableNaming
}
return null;
}
private function resolveParamNameFromArrayDimFetch(\PhpParser\Node\Expr\ArrayDimFetch $arrayDimFetch) : ?string
{
while ($arrayDimFetch instanceof \PhpParser\Node\Expr\ArrayDimFetch) {
if ($arrayDimFetch->dim instanceof \PhpParser\Node\Scalar) {
$valueName = $this->nodeNameResolver->getName($arrayDimFetch->var);
$dimName = $this->valueResolver->getValue($arrayDimFetch->dim);
$stringy = new \RectorPrefix20211208\Stringy\Stringy($dimName);
$dimName = (string) $stringy->upperCamelize();
return $valueName . $dimName;
}
$arrayDimFetch = $arrayDimFetch->var;
}
return $this->resolveBareFromNode($arrayDimFetch);
}
private function resolveFromPropertyFetch(\PhpParser\Node\Expr\PropertyFetch $propertyFetch) : string
{
$varName = $this->nodeNameResolver->getName($propertyFetch->var);

View File

@ -3,9 +3,10 @@
declare (strict_types=1);
namespace Rector\Privatization\Naming;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt\PropertyProperty;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix20211208\Stringy\Stringy;
use RectorPrefix20211208\Symfony\Component\String\UnicodeString;
final class ConstantNaming
{
/**
@ -17,10 +18,29 @@ final class ConstantNaming
{
$this->nodeNameResolver = $nodeNameResolver;
}
public function createFromProperty(\PhpParser\Node\Stmt\PropertyProperty $propertyProperty) : string
/**
* @param \PhpParser\Node\Expr\Variable|\PhpParser\Node\Stmt\PropertyProperty $propertyProperty
*/
public function createFromProperty($propertyProperty) : string
{
/** @var string $propertyName */
$propertyName = $this->nodeNameResolver->getName($propertyProperty);
$stringy = new \RectorPrefix20211208\Stringy\Stringy($propertyName);
return (string) $stringy->underscored()->toUpperCase();
return $this->createUnderscoreUppercaseString($propertyName);
}
/**
* @return string|null
*/
public function createFromVariable(\PhpParser\Node\Expr\Variable $variable)
{
$variableName = $this->nodeNameResolver->getName($variable);
if ($variableName === null) {
return null;
}
return $this->createUnderscoreUppercaseString($variableName);
}
private function createUnderscoreUppercaseString(string $propertyName) : string
{
$propertyNameUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($propertyName);
return $propertyNameUnicodeString->snake()->upper()->toString();
}
}

View File

@ -19,7 +19,7 @@ use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\NodeManipulator\ClassMethodAssignManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\PostRector\Collector\PropertyToAddCollector;
use RectorPrefix20211208\Stringy\Stringy;
use Rector\Privatization\Naming\ConstantNaming;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -42,11 +42,17 @@ final class ChangeReadOnlyVariableWithDefaultValueToConstantRector extends \Rect
* @var \Rector\PostRector\Collector\PropertyToAddCollector
*/
private $propertyToAddCollector;
public function __construct(\Rector\Core\NodeManipulator\ClassMethodAssignManipulator $classMethodAssignManipulator, \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator $varAnnotationManipulator, \Rector\PostRector\Collector\PropertyToAddCollector $propertyToAddCollector)
/**
* @readonly
* @var \Rector\Privatization\Naming\ConstantNaming
*/
private $constantNaming;
public function __construct(\Rector\Core\NodeManipulator\ClassMethodAssignManipulator $classMethodAssignManipulator, \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator $varAnnotationManipulator, \Rector\PostRector\Collector\PropertyToAddCollector $propertyToAddCollector, \Rector\Privatization\Naming\ConstantNaming $constantNaming)
{
$this->classMethodAssignManipulator = $classMethodAssignManipulator;
$this->varAnnotationManipulator = $varAnnotationManipulator;
$this->propertyToAddCollector = $propertyToAddCollector;
$this->constantNaming = $constantNaming;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
@ -202,7 +208,10 @@ CODE_SAMPLE
}
private function createPrivateClassConst(\PhpParser\Node\Expr\Variable $variable, \PhpParser\Node\Expr $expr) : \PhpParser\Node\Stmt\ClassConst
{
$constantName = $this->createConstantNameFromVariable($variable);
$constantName = $this->constantNaming->createFromVariable($variable);
if ($constantName === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException();
}
$const = new \PhpParser\Node\Const_($constantName, $expr);
$classConst = new \PhpParser\Node\Stmt\ClassConst([$const]);
$classConst->flags = \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE;
@ -228,13 +237,4 @@ CODE_SAMPLE
return new \PhpParser\Node\Expr\ClassConstFetch(new \PhpParser\Node\Name('self'), new \PhpParser\Node\Identifier($constantName));
});
}
private function createConstantNameFromVariable(\PhpParser\Node\Expr\Variable $variable) : string
{
$variableName = $this->getName($variable);
if ($variableName === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException();
}
$stringy = new \RectorPrefix20211208\Stringy\Stringy($variableName);
return (string) $stringy->underscored()->toUpperCase();
}
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'b2947fd96f04e19f558bf0875a808e074bc56e03';
public const PACKAGE_VERSION = '7053e9acd1aacd2aeb9e936d67210095251a7af8';
/**
* @var string
*/
public const RELEASE_DATE = '2021-12-08 08:21:13';
public const RELEASE_DATE = '2021-12-08 11:52:21';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211208\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitfef361833e76868574315519dd140e11::getLoader();
return ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e::getLoader();

View File

@ -13,8 +13,8 @@ return array(
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'd507e002f7fce7f0c6dbf1f22edcb902' => $vendorDir . '/tracy/tracy/src/Tracy/functions.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'972fda704d680a3a53c68e34e193cb22' => $vendorDir . '/react/promise-timer/src/functions_include.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitfef361833e76868574315519dd140e11
class ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitfef361833e76868574315519dd140e11
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitfef361833e76868574315519dd140e11', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitfef361833e76868574315519dd140e11', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e', '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\ComposerStaticInitfef361833e76868574315519dd140e11::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit194254aa78c7df32b7ab98bf9107287e::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInitfef361833e76868574315519dd140e11
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitfef361833e76868574315519dd140e11::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit194254aa78c7df32b7ab98bf9107287e::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirefef361833e76868574315519dd140e11($fileIdentifier, $file);
composerRequire194254aa78c7df32b7ab98bf9107287e($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirefef361833e76868574315519dd140e11($fileIdentifier, $file)
function composerRequire194254aa78c7df32b7ab98bf9107287e($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitfef361833e76868574315519dd140e11
class ComposerStaticInit194254aa78c7df32b7ab98bf9107287e
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -14,8 +14,8 @@ class ComposerStaticInitfef361833e76868574315519dd140e11
'9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'd507e002f7fce7f0c6dbf1f22edcb902' => __DIR__ . '/..' . '/tracy/tracy/src/Tracy/functions.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'972fda704d680a3a53c68e34e193cb22' => __DIR__ . '/..' . '/react/promise-timer/src/functions_include.php',
@ -3787,9 +3787,9 @@ class ComposerStaticInitfef361833e76868574315519dd140e11
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitfef361833e76868574315519dd140e11::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitfef361833e76868574315519dd140e11::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitfef361833e76868574315519dd140e11::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit194254aa78c7df32b7ab98bf9107287e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit194254aa78c7df32b7ab98bf9107287e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit194254aa78c7df32b7ab98bf9107287e::$classMap;
}, null, ClassLoader::class);
}

View File

@ -293,11 +293,6 @@
},
"time": "2017-06-12T01:10:27+00:00",
"type": "library",
"extra": {
"patches_applied": [
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/danielstjules-stringy-src-stringy-php.patch"
]
},
"installation-source": "dist",
"autoload": {
"psr-4": {
@ -2088,23 +2083,23 @@
},
{
"name": "rector\/rector-cakephp",
"version": "0.11.8",
"version_normalized": "0.11.8.0",
"version": "0.11.9",
"version_normalized": "0.11.9.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-cakephp.git",
"reference": "b0d9a6b5256467a3d46310aa1e7b87b5de539f3a"
"reference": "584d84bb1a8357423858ab2347249e50b1ff4803"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-cakephp\/zipball\/b0d9a6b5256467a3d46310aa1e7b87b5de539f3a",
"reference": "b0d9a6b5256467a3d46310aa1e7b87b5de539f3a",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-cakephp\/zipball\/584d84bb1a8357423858ab2347249e50b1ff4803",
"reference": "584d84bb1a8357423858ab2347249e50b1ff4803",
"shasum": ""
},
"require": {
"danielstjules\/stringy": "^3.1",
"ext-xml": "*",
"php": ">=8.1"
"php": ">=8.1",
"symfony\/string": "^6.0"
},
"conflict": {
"rector\/rector": "<0.11"
@ -2124,7 +2119,7 @@
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2021-12-07T12:05:57+00:00",
"time": "2021-12-08T07:38:23+00:00",
"type": "rector-extension",
"extra": {
"enable-patching": true,
@ -2150,7 +2145,7 @@
"description": "Rector upgrades rules for CakePHP",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-cakephp\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-cakephp\/tree\/0.11.8"
"source": "https:\/\/github.com\/rectorphp\/rector-cakephp\/tree\/0.11.9"
},
"install-path": "..\/rector\/rector-cakephp"
},
@ -2290,25 +2285,25 @@
},
{
"name": "rector\/rector-nette",
"version": "0.11.56",
"version_normalized": "0.11.56.0",
"version": "0.11.57",
"version_normalized": "0.11.57.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
"reference": "3984915c40c1210d252286271dd95215428c4824"
"reference": "1e3b3ab4e1248623b020ce9c8e744ad89e942e74"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/3984915c40c1210d252286271dd95215428c4824",
"reference": "3984915c40c1210d252286271dd95215428c4824",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/1e3b3ab4e1248623b020ce9c8e744ad89e942e74",
"reference": "1e3b3ab4e1248623b020ce9c8e744ad89e942e74",
"shasum": ""
},
"require": {
"danielstjules\/stringy": "^3.1",
"ext-xml": "*",
"nette\/neon": "^3.3.2",
"php": ">=8.1",
"rector\/rector-phpunit": "^0.11.15",
"symfony\/string": "^6.0",
"symplify\/vendor-patches": "^10.0"
},
"conflict": {
@ -2332,7 +2327,7 @@
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2021-12-07T12:02:25+00:00",
"time": "2021-12-08T07:35:30+00:00",
"type": "rector-extension",
"extra": {
"enable-patching": true,
@ -2361,7 +2356,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.56"
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.57"
},
"install-path": "..\/rector\/rector-nette"
},
@ -2500,23 +2495,24 @@
},
{
"name": "rector\/rector-symfony",
"version": "0.11.47",
"version_normalized": "0.11.47.0",
"version": "0.11.48",
"version_normalized": "0.11.48.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "d4ccfa2f725ed7060bab76ce1e9278c611e700b1"
"reference": "5a24edfe3cf6f66766cbf2bc7eddc7340f06a800"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/d4ccfa2f725ed7060bab76ce1e9278c611e700b1",
"reference": "d4ccfa2f725ed7060bab76ce1e9278c611e700b1",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/5a24edfe3cf6f66766cbf2bc7eddc7340f06a800",
"reference": "5a24edfe3cf6f66766cbf2bc7eddc7340f06a800",
"shasum": ""
},
"require": {
"danielstjules\/stringy": "^3.1",
"ext-xml": "*",
"php": ">=8.1"
"php": ">=8.1",
"symfony\/string": "^6.0"
},
"conflict": {
"rector\/rector": "<0.11"
@ -2535,9 +2531,10 @@
"symplify\/monorepo-builder": "^10.0",
"symplify\/phpstan-extensions": "^10.0",
"symplify\/phpstan-rules": "^10.0",
"symplify\/rule-doc-generator": "^10.0"
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2021-12-07T12:04:04+00:00",
"time": "2021-12-08T07:34:28+00:00",
"type": "rector-extension",
"extra": {
"enable-patching": true,
@ -2563,7 +2560,7 @@
"description": "Rector upgrades rules for Symfony Framework",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-symfony\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.47"
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.48"
},
"install-path": "..\/rector\/rector-symfony"
},

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
Patches applied to this directory:
0
Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/danielstjules-stringy-src-stringy-php.patch

View File

@ -226,7 +226,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
*
* @return int The number of characters in the string, given the encoding
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->length();
@ -383,7 +382,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
*
* @return \ArrayIterator An iterator for the characters in the string
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->chars());
@ -724,7 +722,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
* @param mixed $offset The index to check
* @return boolean Whether or not the index exists
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$length = $this->length();
@ -745,7 +742,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
* @throws \OutOfBoundsException If the positive or negative offset does
* not exist
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$offset = (int) $offset;
@ -763,7 +759,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
* @param mixed $value Value to set
* @throws \Exception When called
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
// Stringy is immutable, cannot directly set char
@ -776,7 +771,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
* @param mixed $offset The index of the character
* @throws \Exception When called
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
// Don't allow directly modifying the string

View File

@ -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.8'), '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.41'), '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.15'), '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.56'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.8'), '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.24'), '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.47'), '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.31'));
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.9'), '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.41'), '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.15'), '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.57'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.8'), '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.24'), '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.48'), '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.31'));
private function __construct()
{
}

View File

@ -6,7 +6,7 @@
"require": {
"php": ">=8.1",
"ext-xml": "*",
"danielstjules\/stringy": "^3.1"
"symfony\/string": "^6.0"
},
"require-dev": {
"phpstan\/phpstan": "^1.2",

View File

@ -11,7 +11,7 @@ use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\PropertyProperty;
use Rector\Core\Rector\AbstractRector;
use RectorPrefix20211208\Stringy\Stringy;
use RectorPrefix20211208\Symfony\Component\String\UnicodeString;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -89,8 +89,8 @@ CODE_SAMPLE
[$prefix, $table] = \explode('.', $string->value);
$tableParts = \explode('/', $table);
$pascalCaseTableParts = \array_map(function (string $token) : string {
$stringy = new \RectorPrefix20211208\Stringy\Stringy($token);
return (string) $stringy->upperCamelize();
$tokenUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($token);
return \ucfirst($tokenUnicodeString->camel()->toString());
}, $tableParts);
$table = \implode('/', $pascalCaseTableParts);
$string->value = \sprintf('%s.%s', $prefix, $table);

View File

@ -7,9 +7,9 @@
"php": ">=8.1",
"ext-xml": "*",
"nette\/neon": "^3.3.2",
"danielstjules\/stringy": "^3.1",
"rector\/rector-phpunit": "^0.11.15",
"symplify\/vendor-patches": "^10.0"
"symplify\/vendor-patches": "^10.0",
"symfony\/string": "^6.0"
},
"require-dev": {
"rector\/rector-src": "dev-main",

View File

@ -3,13 +3,13 @@
declare (strict_types=1);
namespace Rector\Nette\Naming;
use RectorPrefix20211208\Stringy\Stringy;
use RectorPrefix20211208\Symfony\Component\String\UnicodeString;
final class NetteControlNaming
{
public function createVariableName(string $shortName) : string
{
$stringy = new \RectorPrefix20211208\Stringy\Stringy($shortName);
$variableName = (string) $stringy->camelize();
$variableNameUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($shortName);
$variableName = $variableNameUnicodeString->camel()->toString();
if (\substr_compare($variableName, 'Form', -\strlen('Form')) === 0) {
return $variableName;
}
@ -17,8 +17,8 @@ final class NetteControlNaming
}
public function createCreateComponentClassMethodName(string $shortName) : string
{
$stringy = new \RectorPrefix20211208\Stringy\Stringy($shortName);
$componentName = (string) $stringy->upperCamelize();
$shortNameUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($shortName);
$componentName = $shortNameUnicodeString->upper()->camel()->toString();
return 'createComponent' . $componentName;
}
}

View File

@ -6,7 +6,8 @@
"require": {
"php": ">=8.1",
"ext-xml": "*",
"danielstjules\/stringy": "^3.1"
"danielstjules\/stringy": "^3.1",
"symfony\/string": "^6.0"
},
"require-dev": {
"phpunit\/phpunit": "^9.5",
@ -22,7 +23,8 @@
"phpstan\/extension-installer": "^1.1",
"rector\/phpstan-rules": "^0.4.4",
"phpstan\/phpstan-strict-rules": "^1.1",
"phpstan\/phpstan-webmozart-assert": "^1.0"
"phpstan\/phpstan-webmozart-assert": "^1.0",
"symplify\/vendor-patches": "^10.0"
},
"autoload": {
"psr-4": {

View File

@ -13,7 +13,7 @@ use PhpParser\Node\Stmt\Return_;
use PHPStan\Type\ObjectType;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\Rector\AbstractRector;
use RectorPrefix20211208\Stringy\Stringy;
use RectorPrefix20211208\Symfony\Component\String\UnicodeString;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -77,8 +77,8 @@ CODE_SAMPLE
if (\substr_compare($shortClassName, 'Type', -\strlen('Type')) === 0) {
$shortClassName = (string) \RectorPrefix20211208\Nette\Utils\Strings::before($shortClassName, 'Type');
}
$stringy = new \RectorPrefix20211208\Stringy\Stringy($shortClassName);
$underscoredClassShortName = (string) $stringy->underscored();
$shortClassNameUnicodeString = new \RectorPrefix20211208\Symfony\Component\String\UnicodeString($shortClassName);
$underscoredClassShortName = $shortClassNameUnicodeString->snake()->toString();
if ($underscoredClassShortName !== $returnedValue) {
return null;
}

View File

@ -61,10 +61,10 @@ final class JMSDITypeResolver
return $varType;
}
// the @var is missing and service name was not found → report it
$this->reportServiceNotFound($serviceName, $property);
$this->reportServiceNotFound($serviceName);
return new \PHPStan\Type\MixedType();
}
private function reportServiceNotFound(?string $serviceName, \PhpParser\Node\Stmt\Property $property) : void
private function reportServiceNotFound(?string $serviceName) : void
{
if ($serviceName !== null) {
return;

View File

@ -12,8 +12,8 @@ if (!class_exists('GenerateChangelogCommand', false) && !interface_exists('Gener
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211208\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitfef361833e76868574315519dd140e11', false) && !interface_exists('ComposerAutoloaderInitfef361833e76868574315519dd140e11', false) && !trait_exists('ComposerAutoloaderInitfef361833e76868574315519dd140e11', false)) {
spl_autoload_call('RectorPrefix20211208\ComposerAutoloaderInitfef361833e76868574315519dd140e11');
if (!class_exists('ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e', false) && !interface_exists('ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e', false) && !trait_exists('ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e', false)) {
spl_autoload_call('RectorPrefix20211208\ComposerAutoloaderInit194254aa78c7df32b7ab98bf9107287e');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20211208\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -81,9 +81,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211208\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirefef361833e76868574315519dd140e11')) {
function composerRequirefef361833e76868574315519dd140e11() {
return \RectorPrefix20211208\composerRequirefef361833e76868574315519dd140e11(...func_get_args());
if (!function_exists('composerRequire194254aa78c7df32b7ab98bf9107287e')) {
function composerRequire194254aa78c7df32b7ab98bf9107287e() {
return \RectorPrefix20211208\composerRequire194254aa78c7df32b7ab98bf9107287e(...func_get_args());
}
}
if (!function_exists('scanPath')) {