Updated Rector to commit fe3c6ff324a814101fdc2f489980ceb9fa219322

fe3c6ff324 [Privatization] Fix crash on assign inside Arg on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3423)
This commit is contained in:
Tomas Votruba 2023-02-28 15:26:15 +00:00
parent 4861972121
commit 88cbdce92d
43 changed files with 153 additions and 120 deletions

View File

@ -14,10 +14,12 @@ use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\NodeManipulator\ClassMethodAssignManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PostRector\Collector\PropertyToAddCollector;
use Rector\Privatization\Naming\ConstantNaming;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -189,6 +191,10 @@ CODE_SAMPLE
continue 2;
}
}
$parentAssign = $readOnlyVariableAssign->getAttribute(AttributeKey::PARENT_NODE);
if (!$parentAssign instanceof Expression) {
continue;
}
$this->removeNode($readOnlyVariableAssign);
$classConst = $this->createPrivateClassConst($variable, $readOnlyVariableAssign->expr);
// replace $variable usage in the code with constant

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'a85934ba03b62bf1c8f24d0a1e6d464866492d71';
public const PACKAGE_VERSION = 'fe3c6ff324a814101fdc2f489980ceb9fa219322';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-02-28 12:44:26';
public const RELEASE_DATE = '2023-02-28 15:21:40';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitc28701430d4a3e0056cc95d2271f3ebf::getLoader();
return ComposerAutoloaderInit01eb0ab2942b59a5140d572932ee6e66::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc28701430d4a3e0056cc95d2271f3ebf
class ComposerAutoloaderInit01eb0ab2942b59a5140d572932ee6e66
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitc28701430d4a3e0056cc95d2271f3ebf
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc28701430d4a3e0056cc95d2271f3ebf', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit01eb0ab2942b59a5140d572932ee6e66', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitc28701430d4a3e0056cc95d2271f3ebf', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit01eb0ab2942b59a5140d572932ee6e66', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf
class ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3125,9 +3125,9 @@ class ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc28701430d4a3e0056cc95d2271f3ebf::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit01eb0ab2942b59a5140d572932ee6e66::$classMap;
}, null, ClassLoader::class);
}

View File

@ -931,17 +931,17 @@
},
{
"name": "phpstan\/phpstan-phpunit",
"version": "1.3.8",
"version_normalized": "1.3.8.0",
"version": "1.3.9",
"version_normalized": "1.3.9.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan-phpunit.git",
"reference": "4a19a3cb5b2d28b143f350e45e9f6e17e2cb81b5"
"reference": "34ee324a2b8fcab680fbb3f3f3d6c86389df35ba"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/4a19a3cb5b2d28b143f350e45e9f6e17e2cb81b5",
"reference": "4a19a3cb5b2d28b143f350e45e9f6e17e2cb81b5",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/34ee324a2b8fcab680fbb3f3f3d6c86389df35ba",
"reference": "34ee324a2b8fcab680fbb3f3f3d6c86389df35ba",
"shasum": ""
},
"require": {
@ -957,7 +957,7 @@
"phpstan\/phpstan-strict-rules": "^1.0",
"phpunit\/phpunit": "^9.5"
},
"time": "2023-02-25T15:14:31+00:00",
"time": "2023-02-28T13:04:23+00:00",
"type": "phpstan-extension",
"extra": {
"phpstan": {
@ -980,7 +980,7 @@
"description": "PHPUnit extensions and rules for PHPStan",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.8"
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.9"
},
"install-path": "..\/phpstan\/phpstan-phpunit"
},
@ -2259,17 +2259,17 @@
},
{
"name": "symfony\/config",
"version": "v6.2.5",
"version_normalized": "6.2.5.0",
"version": "v6.2.7",
"version_normalized": "6.2.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/config.git",
"reference": "f31b3c78a3650157188a240695e688d6a182aa91"
"reference": "249271da6f545d6579e0663374f8249a80be2893"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/f31b3c78a3650157188a240695e688d6a182aa91",
"reference": "f31b3c78a3650157188a240695e688d6a182aa91",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/249271da6f545d6579e0663374f8249a80be2893",
"reference": "249271da6f545d6579e0663374f8249a80be2893",
"shasum": ""
},
"require": {
@ -2291,7 +2291,7 @@
"suggest": {
"symfony\/yaml": "To use the yaml reference dumper"
},
"time": "2023-01-09T04:38:22+00:00",
"time": "2023-02-14T08:44:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2319,7 +2319,7 @@
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.2.5"
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.2.7"
},
"funding": [
{
@ -2339,17 +2339,17 @@
},
{
"name": "symfony\/console",
"version": "v6.2.5",
"version_normalized": "6.2.5.0",
"version": "v6.2.7",
"version_normalized": "6.2.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "3e294254f2191762c1d137aed4b94e966965e985"
"reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/3e294254f2191762c1d137aed4b94e966965e985",
"reference": "3e294254f2191762c1d137aed4b94e966965e985",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/cbad09eb8925b6ad4fb721c7a179344dc4a19d45",
"reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45",
"shasum": ""
},
"require": {
@ -2384,7 +2384,7 @@
"symfony\/lock": "",
"symfony\/process": ""
},
"time": "2023-01-01T08:38:09+00:00",
"time": "2023-02-25T17:00:03+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2418,7 +2418,7 @@
"terminal"
],
"support": {
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.5"
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.7"
},
"funding": [
{
@ -2438,17 +2438,17 @@
},
{
"name": "symfony\/contracts",
"version": "v3.2.0",
"version_normalized": "3.2.0.0",
"version": "v3.2.1",
"version_normalized": "3.2.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/contracts.git",
"reference": "c47da22960a1eb5e39c1ad84120734e680265610"
"reference": "949dfaa3a6531e45ae0f55e4ea298e417fed2d8c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/contracts\/zipball\/c47da22960a1eb5e39c1ad84120734e680265610",
"reference": "c47da22960a1eb5e39c1ad84120734e680265610",
"url": "https:\/\/api.github.com\/repos\/symfony\/contracts\/zipball\/949dfaa3a6531e45ae0f55e4ea298e417fed2d8c",
"reference": "949dfaa3a6531e45ae0f55e4ea298e417fed2d8c",
"shasum": ""
},
"require": {
@ -2478,7 +2478,7 @@
"symfony\/service-implementation": "",
"symfony\/translation-implementation": ""
},
"time": "2022-11-25T10:21:52+00:00",
"time": "2023-02-16T12:50:33+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -2522,7 +2522,7 @@
"standards"
],
"support": {
"source": "https:\/\/github.com\/symfony\/contracts\/tree\/v3.2.0"
"source": "https:\/\/github.com\/symfony\/contracts\/tree\/v3.2.1"
},
"funding": [
{
@ -2637,17 +2637,17 @@
},
{
"name": "symfony\/filesystem",
"version": "v6.2.5",
"version_normalized": "6.2.5.0",
"version": "v6.2.7",
"version_normalized": "6.2.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/filesystem.git",
"reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593"
"reference": "82b6c62b959f642d000456f08c6d219d749215b3"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/e59e8a4006afd7f5654786a83b4fcb8da98f4593",
"reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593",
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/82b6c62b959f642d000456f08c6d219d749215b3",
"reference": "82b6c62b959f642d000456f08c6d219d749215b3",
"shasum": ""
},
"require": {
@ -2655,7 +2655,7 @@
"symfony\/polyfill-ctype": "~1.8",
"symfony\/polyfill-mbstring": "~1.8"
},
"time": "2023-01-20T17:45:48+00:00",
"time": "2023-02-14T08:44:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2683,7 +2683,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.2.5"
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.2.7"
},
"funding": [
{
@ -2703,17 +2703,17 @@
},
{
"name": "symfony\/finder",
"version": "v6.2.5",
"version_normalized": "6.2.5.0",
"version": "v6.2.7",
"version_normalized": "6.2.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/finder.git",
"reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c"
"reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/c90dc446976a612e3312a97a6ec0069ab0c2099c",
"reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/20808dc6631aecafbe67c186af5dcb370be3a0eb",
"reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb",
"shasum": ""
},
"require": {
@ -2722,7 +2722,7 @@
"require-dev": {
"symfony\/filesystem": "^6.0"
},
"time": "2023-01-20T17:45:48+00:00",
"time": "2023-02-16T09:57:23+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2750,7 +2750,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.5"
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.7"
},
"funding": [
{
@ -2943,17 +2943,17 @@
},
{
"name": "symfony\/string",
"version": "v6.2.5",
"version_normalized": "6.2.5.0",
"version": "v6.2.7",
"version_normalized": "6.2.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/string.git",
"reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0"
"reference": "67b8c1eec78296b85dc1c7d9743830160218993d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0",
"reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/67b8c1eec78296b85dc1c7d9743830160218993d",
"reference": "67b8c1eec78296b85dc1c7d9743830160218993d",
"shasum": ""
},
"require": {
@ -2973,7 +2973,7 @@
"symfony\/translation-contracts": "^2.0|^3.0",
"symfony\/var-exporter": "^5.4|^6.0"
},
"time": "2023-01-01T08:38:09+00:00",
"time": "2023-02-24T10:42:00+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3012,7 +3012,7 @@
"utf8"
],
"support": {
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.5"
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.7"
},
"funding": [
{
@ -3165,17 +3165,17 @@
},
{
"name": "tracy\/tracy",
"version": "v2.9.6",
"version_normalized": "2.9.6.0",
"version": "v2.9.7",
"version_normalized": "2.9.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/nette\/tracy.git",
"reference": "80533f4bda19ce8138c0fc984743533e2a0e1c5c"
"reference": "1c6e9b5bad030fdf49194154c9674201fa6372bb"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/nette\/tracy\/zipball\/80533f4bda19ce8138c0fc984743533e2a0e1c5c",
"reference": "80533f4bda19ce8138c0fc984743533e2a0e1c5c",
"url": "https:\/\/api.github.com\/repos\/nette\/tracy\/zipball\/1c6e9b5bad030fdf49194154c9674201fa6372bb",
"reference": "1c6e9b5bad030fdf49194154c9674201fa6372bb",
"shasum": ""
},
"require": {
@ -3195,7 +3195,7 @@
"phpstan\/phpstan": "^1.0",
"psr\/log": "^1.0 || ^2.0 || ^3.0"
},
"time": "2023-02-06T15:31:40+00:00",
"time": "2023-02-28T13:01:54+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -3236,7 +3236,7 @@
],
"support": {
"issues": "https:\/\/github.com\/nette\/tracy\/issues",
"source": "https:\/\/github.com\/nette\/tracy\/tree\/v2.9.6"
"source": "https:\/\/github.com\/nette\/tracy\/tree\/v2.9.7"
},
"install-path": "..\/tracy\/tracy"
},

File diff suppressed because one or more lines are too long

View File

@ -52,6 +52,10 @@ class CoversHelper
{
$errors = [];
$covers = (string) $phpDocTag->value;
if ($covers === '') {
$errors[] = RuleErrorBuilder::message('@covers value does not specify anything.')->build();
return $errors;
}
$isMethod = strpos($covers, '::') !== \false;
$fullName = $covers;
if ($isMethod) {
@ -68,14 +72,11 @@ class CoversHelper
if (isset($method) && $method !== '' && !$class->hasMethod($method)) {
$errors[] = RuleErrorBuilder::message(sprintf('@covers value %s references an invalid method.', $fullName))->build();
}
} elseif (isset($method) && $this->reflectionProvider->hasFunction(new Name($method, []), null)) {
return $errors;
} elseif (!isset($method) && $this->reflectionProvider->hasFunction(new Name($className, []), null)) {
return $errors;
} else {
if ($covers === '') {
$errors[] = RuleErrorBuilder::message('@covers value does not specify anything.')->build();
return $errors;
}
if (!isset($method) && $this->reflectionProvider->hasFunction(new Name($covers, []), null)) {
return $errors;
}
$error = RuleErrorBuilder::message(sprintf('@covers value %s references an invalid %s.', $fullName, $isMethod ? 'method' : 'class or function'));
if (strpos($className, '\\') === \false) {
$error->tip('The @covers annotation requires a fully qualified name.');

View File

@ -59,9 +59,9 @@ class Processor
*
* extensions: ['twig.extension.foo', 'twig.extension.bar']
*
* @param array $config A config array
* @param string $key The key to normalize
* @param string $plural The plural form of the key if it is irregular
* @param array $config A config array
* @param string $key The key to normalize
* @param string|null $plural The plural form of the key if it is irregular
*/
public static function normalizeConfig(array $config, string $key, string $plural = null) : array
{

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2023 Fabien Potencier
Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -44,7 +44,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
private static $existsCache = [];
/**
* @param string $resource The fully-qualified class name
* @param bool|null $exists Boolean when the existency check has already been done
* @param bool|null $exists Boolean when the existence check has already been done
*/
public function __construct(string $resource, bool $exists = null)
{

View File

@ -131,7 +131,7 @@ class Application implements ResetInterface
*/
private $initialized = \false;
/**
* @var \Symfony\Component\Console\SignalRegistry\SignalRegistry
* @var \Symfony\Component\Console\SignalRegistry\SignalRegistry|null
*/
private $signalRegistry;
/**

View File

@ -121,8 +121,6 @@ class ProgressIndicator
}
/**
* Finish the indicator with message.
*
* @param $message
*/
public function finish(string $message)
{

View File

@ -47,9 +47,9 @@ class InputArgument
*/
private $description;
/**
* @param string $name The argument name
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
* @param string $description A description text
* @param string $name The argument name
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
* @param string $description A description text
* @param string|bool|int|float|mixed[] $default The default value (for self::OPTIONAL mode only)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*

View File

@ -69,7 +69,7 @@ class InputOption
private $description;
/**
* @param string|mixed[] $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param int|null $mode The option mode: One of the VALUE_* constants
* @param int|null $mode The option mode: One of the VALUE_* constants
* @param string|bool|int|float|mixed[] $default The default value (must be null for self::VALUE_NONE)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2023 Fabien Potencier
Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -116,7 +116,8 @@ class ConsoleSectionOutput extends StreamOutput
// re-add the line break (that has been removed in the above `explode()` for
// - every line that is not the last line
// - if $newline is required, also add it to the last line
if ($i < $count || $newline) {
// - if it's not new line, but input ending with `\PHP_EOL`
if ($i < $count || $newline || \substr_compare($input, \PHP_EOL, -\strlen(\PHP_EOL)) === 0) {
$lineContent .= \PHP_EOL;
}
// skip line if there is no text (or newline for that matter)
@ -141,6 +142,14 @@ class ConsoleSectionOutput extends StreamOutput
$this->lines += $linesAdded;
return $linesAdded;
}
/**
* @internal
*/
public function addNewLineOfInputSubmit()
{
$this->content[] = \PHP_EOL;
++$this->lines;
}
protected function doWrite(string $message, bool $newline)
{
if (!$this->isDecorated()) {

View File

@ -22,6 +22,7 @@ use RectorPrefix202302\Symfony\Component\Console\Helper\TableCell;
use RectorPrefix202302\Symfony\Component\Console\Helper\TableSeparator;
use RectorPrefix202302\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202302\Symfony\Component\Console\Output\ConsoleOutputInterface;
use RectorPrefix202302\Symfony\Component\Console\Output\ConsoleSectionOutput;
use RectorPrefix202302\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202302\Symfony\Component\Console\Output\TrimmedBufferOutput;
use RectorPrefix202302\Symfony\Component\Console\Question\ChoiceQuestion;
@ -291,6 +292,11 @@ class SymfonyStyle extends OutputStyle
$this->questionHelper = $this->questionHelper ?? new SymfonyQuestionHelper();
$answer = $this->questionHelper->ask($this->input, $this, $question);
if ($this->input->isInteractive()) {
if ($this->output instanceof ConsoleSectionOutput) {
// add the new line of the `return` to submit the input to ConsoleSectionOutput, because ConsoleSectionOutput is holding all it's lines.
// this is relevant when a `ConsoleSectionOutput::clear` is called.
$this->output->addNewLineOfInputSubmit();
}
$this->newLine();
$this->bufferedOutput->write("\n");
}

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2020-2022 Fabien Potencier
Copyright (c) 2020-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -25,5 +25,8 @@ namespace RectorPrefix202302\Symfony\Contracts\Service;
*/
interface ResetInterface
{
/**
* @return void
*/
public function reset();
}

View File

@ -17,7 +17,7 @@ use RectorPrefix202302\Psr\Container\ContainerInterface;
* @author Nicolas Grekas <p@tchwork.com>
* @author Mateusz Sip <mateusz.sip@gmail.com>
*
* @template T of mixed
* @template-covariant T of mixed
*/
interface ServiceProviderInterface extends ContainerInterface
{

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022 Fabien Potencier
Copyright (c) 2018-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -15,6 +15,8 @@ interface LocaleAwareInterface
/**
* Sets the current locale.
*
* @return void
*
* @throws \InvalidArgumentException If the locale contains invalid characters
*/
public function setLocale(string $locale);

View File

@ -96,11 +96,11 @@ class TranslatorTest extends TestCase
\Locale::setDefault('en');
$this->assertEquals('en', $translator->getLocale());
}
public function getTransTests()
public static function getTransTests()
{
return [['Symfony is great!', 'Symfony is great!', []], ['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']]];
}
public function getTransChoiceTests()
public static function getTransChoiceTests()
{
return [
['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0],
@ -114,14 +114,14 @@ class TranslatorTest extends TestCase
];
}
/**
* @dataProvider getInternal
* @dataProvider getInterval
*/
public function testInterval($expected, $number, $interval)
{
$translator = $this->getTranslator();
$this->assertEquals($expected, $translator->trans($interval . ' foo|[1,Inf[ bar', ['%count%' => $number]));
}
public function getInternal()
public static function getInterval()
{
return [['foo', 3, '{1,2, 3 ,4}'], ['bar', 10, '{1,2, 3 ,4}'], ['bar', 3, '[1,2]'], ['foo', 1, '[1,2]'], ['foo', 2, '[1,2]'], ['bar', 1, ']1,2['], ['bar', 2, ']1,2['], ['foo', \log(0), '[-Inf,2['], ['foo', -\log(0), '[-2,+Inf]']];
}
@ -147,11 +147,11 @@ class TranslatorTest extends TestCase
$translator = $this->getTranslator();
$translator->trans($id, ['%count%' => $number]);
}
public function getNonMatchingMessages()
public static function getNonMatchingMessages()
{
return [['{0} There are no apples|{1} There is one apple', 2], ['{1} There is one apple|]1,Inf] There are %count% apples', 0], ['{1} There is one apple|]2,Inf] There are %count% apples', 2], ['{0} There are no apples|There is one apple', 2]];
}
public function getChooseTests()
public static function getChooseTests()
{
return [
['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0],
@ -253,7 +253,7 @@ class TranslatorTest extends TestCase
*
* As it is impossible to have this ever complete we should try as hard as possible to have it almost complete.
*/
public function successLangcodes() : array
public static function successLangcodes() : array
{
return [['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], ['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']], ['3', ['be', 'bs', 'cs', 'hr']], ['4', ['cy', 'mt', 'sl']], ['6', ['ar']]];
}
@ -265,7 +265,7 @@ class TranslatorTest extends TestCase
*
* @return array with nplural together with langcodes
*/
public function failingLangcodes() : array
public static function failingLangcodes() : array
{
return [['1', ['fa']], ['2', ['jbo']], ['3', ['cbs']], ['4', ['gd', 'kw']], ['5', ['ga']]];
}

View File

@ -22,6 +22,9 @@ trait TranslatorTrait
* @var string|null
*/
private $locale;
/**
* @return void
*/
public function setLocale(string $locale)
{
$this->locale = $locale;

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2023 Fabien Potencier
Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -34,7 +34,7 @@ namespace RectorPrefix202302\Symfony\Component\Finder\Comparator;
class NumberComparator extends Comparator
{
/**
* @param string|int $test A comparison string or an integer
* @param string|null $test A comparison string or null
*
* @throws \InvalidArgumentException If the test is not understood
*/

View File

@ -17,6 +17,7 @@ use RectorPrefix202302\Symfony\Component\Finder\SplFileInfo;
* @author Fabien Potencier <fabien@symfony.com>
*
* @extends \FilterIterator<string, SplFileInfo>
*
* @implements \RecursiveIterator<string, SplFileInfo>
*/
class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator

View File

@ -16,6 +16,7 @@ use RectorPrefix202302\Symfony\Component\Finder\SplFileInfo;
* Extends the \RecursiveDirectoryIterator to support relative paths.
*
* @author Victor Berchet <victor@suumit.com>
*
* @extends \RecursiveDirectoryIterator<string, SplFileInfo>
*/
class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2023 Fabien Potencier
Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -33,8 +33,8 @@ abstract class AbstractUnicodeString extends AbstractString
// all ASCII letters sorted by typical frequency of occurrence
private const ASCII = " eiasntrolud][cmp'\ng|hv.fb,:=-q10C2*yx)(L9AS/P\"EjMIk3>5T<D4}B{8FwR67UGN;JzV#HOW_&!K?XQ%Y\\\tZ+~^\$@`\x00\x01\x02\x03\x04\x05\x06\x07\x08\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f";
// the subset of folded case mappings that is not in lower case mappings
private const FOLD_FROM = ['İ', 'µ', 'ſ', "ͅ", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
private const FOLD_FROM = ['İ', 'µ', 'ſ', "ͅ", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "", 'ß', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
// the subset of upper case mappings that map one code point to many code points
private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];

View File

@ -1,4 +1,4 @@
Copyright (c) 2019-2023 Fabien Potencier
Copyright (c) 2019-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -26,7 +26,7 @@ class BlueScreen
/** @var callable|null a callable returning true for sensitive data; fn(string $key, mixed $val): bool */
public $scrubber;
/** @var string[] */
public $keysToHide = ['password', 'passwd', 'pass', 'pwd', 'creditcard', 'credit card', 'cc', 'pin', self::class . '::$snapshot'];
public $keysToHide = ['password', 'passwd', 'pass', 'pwd', 'creditcard', 'credit card', 'cc', 'pin', 'authorization', self::class . '::$snapshot'];
/** @var bool */
public $showEnvironment = \true;
/** @var callable[] */

View File

@ -13,7 +13,7 @@ use ErrorException;
*/
class Debugger
{
public const VERSION = '2.9.6';
public const VERSION = '2.9.7';
/** server modes for Debugger::enable() */
public const Development = \false, Production = \true, Detect = null;
public const DEVELOPMENT = self::Development, PRODUCTION = self::Production, DETECT = self::Detect;

View File

@ -217,11 +217,14 @@ final class Describer
}
private function isSensitive(string $key, $val, ?string $class = null) : bool
{
return $this->scrubber !== null && ($this->scrubber)($key, $val, $class) || isset($this->keysToHide[\strtolower($key)]) || isset($this->keysToHide[\strtolower($class . '::$' . $key)]);
return $val instanceof \SensitiveParameterValue || $this->scrubber !== null && ($this->scrubber)($key, $val, $class) || isset($this->keysToHide[\strtolower($key)]) || isset($this->keysToHide[\strtolower($class . '::$' . $key)]);
}
private static function hideValue($var) : string
private static function hideValue($val) : string
{
return self::HiddenValue . ' (' . (\is_object($var) ? Helpers::getClass($var) : \gettype($var)) . ')';
if ($val instanceof \SensitiveParameterValue) {
$val = $val->getValue();
}
return self::HiddenValue . ' (' . (\is_object($val) ? Helpers::getClass($val) : \gettype($val)) . ')';
}
public function getReferenceId($arr, $key) : ?int
{

View File

@ -111,7 +111,7 @@ class Dumper
let el;
if (e.target.matches('.tracy-dump-hash') && (el = e.target.closest('.tracy-dump'))) {
if (e.target.matches('.tracy-dump-hash') && (el = e.target.closest('tracy-div'))) {
el.querySelectorAll('.tracy-dump-hash').forEach((el) => {
if (el.textContent === e.target.textContent) {
el.classList.add('tracy-dump-highlight');

View File

@ -51,7 +51,7 @@ if [ "${url:0:9}" != "editor://" ]; then
fi
# Parse action and essential data from the URI.
regex='editor\:\/\/(open|create|fix)\/\?(.*)'
regex='editor\:\/\/(open|create|fix)\/?\?(.*)'
action=`echo $url | sed -r "s/$regex/\1/i"`
uri_params=`echo $url | sed -r "s/$regex/\2/i"`

View File

@ -41,7 +41,7 @@ if (!settings.editor) {
}
var url = WScript.Arguments(0);
var match = /^editor:\/\/(open|create|fix)\/\?file=([^&]+)&line=(\d+)(?:&search=([^&]*)&replace=([^&]*))?/.exec(url);
var match = /^editor:\/\/(open|create|fix)\/?\?file=([^&]+)&line=(\d+)(?:&search=([^&]*)&replace=([^&]*))?/.exec(url);
if (!match) {
WScript.Echo('Unexpected URI ' + url);
WScript.Quit();