Updated Rector to commit 4d4c73d5957cd03b26d4a7f6b6b3e209f4506cd3

4d4c73d595 [automated] Apply Coding Standard (#3998)
This commit is contained in:
Tomas Votruba 2023-05-28 00:32:17 +00:00
parent 23ab3fd50e
commit 9b4ae51505
14 changed files with 58 additions and 85 deletions

View File

@ -1,4 +1,4 @@
# 396 Rules Overview
# 394 Rules Overview
<br>
@ -56,7 +56,7 @@
- [RemovingStatic](#removingstatic) (1)
- [Renaming](#renaming) (11)
- [Renaming](#renaming) (10)
- [Strict](#strict) (6)
@ -4042,16 +4042,16 @@ Rename variable to match method return type
```diff
class SomeClass
{
public function run()
{
- $a = $this->getRunner();
+ $runner = $this->getRunner();
}
public function run()
{
- $a = $this->getRunner();
+ $runner = $this->getRunner();
}
public function getRunner(): Runner
{
return new Runner();
}
public function getRunner(): Runner
{
return new Runner();
}
}
```
@ -6980,38 +6980,6 @@ return static function (RectorConfig $rectorConfig): void {
<br>
### RenameNamespaceRector
Replaces old namespace by new one.
:wrench: **configure it!**
- class: [`Rector\Renaming\Rector\Namespace_\RenameNamespaceRector`](../rules/Renaming/Rector/Namespace_/RenameNamespaceRector.php)
```php
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\Namespace_\RenameNamespaceRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RenameNamespaceRector::class, [
'SomeOldNamespace' => 'SomeNewNamespace',
]);
};
```
```diff
-$someObject = new SomeOldNamespace\SomeClass;
+$someObject = new SomeNewNamespace\SomeClass;
```
<br>
### RenamePropertyRector
Replaces defined old properties by new ones.

View File

@ -3,10 +3,10 @@
declare (strict_types=1);
namespace Rector\Privatization\Rector\Property;
use PHPStan\Reflection\ClassReflection;
use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Property;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Privatization\Guard\ParentPropertyLookupGuard;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'fddbb6231342654d15bbaec2792f182881ef66fe';
public const PACKAGE_VERSION = '4d4c73d5957cd03b26d4a7f6b6b3e209f4506cd3';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-28 03:20:20';
public const RELEASE_DATE = '2023-05-28 00:28:22';
/**
* @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 ComposerAutoloaderInit0667aef7daecbbb23bdc11e9b16cfc99::getLoader();
return ComposerAutoloaderInitcd939f77cf16261a3ec92b7bf3fceff6::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0667aef7daecbbb23bdc11e9b16cfc99
class ComposerAutoloaderInitcd939f77cf16261a3ec92b7bf3fceff6
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0667aef7daecbbb23bdc11e9b16cfc99
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0667aef7daecbbb23bdc11e9b16cfc99', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitcd939f77cf16261a3ec92b7bf3fceff6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit0667aef7daecbbb23bdc11e9b16cfc99', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitcd939f77cf16261a3ec92b7bf3fceff6', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6::$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 ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99
class ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3089,9 +3089,9 @@ class ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0667aef7daecbbb23bdc11e9b16cfc99::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcd939f77cf16261a3ec92b7bf3fceff6::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2279,17 +2279,17 @@
},
{
"name": "symfony\/console",
"version": "v6.2.10",
"version_normalized": "6.2.10.0",
"version": "v6.2.11",
"version_normalized": "6.2.11.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "12288d9f4500f84a4d02254d4aa968b15488476f"
"reference": "5aa03db8ef0a5457c316ec580e69562d97734c77"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/12288d9f4500f84a4d02254d4aa968b15488476f",
"reference": "12288d9f4500f84a4d02254d4aa968b15488476f",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/5aa03db8ef0a5457c316ec580e69562d97734c77",
"reference": "5aa03db8ef0a5457c316ec580e69562d97734c77",
"shasum": ""
},
"require": {
@ -2324,7 +2324,7 @@
"symfony\/lock": "",
"symfony\/process": ""
},
"time": "2023-04-28T13:37:43+00:00",
"time": "2023-05-26T08:16:21+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2358,7 +2358,7 @@
"terminal"
],
"support": {
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.10"
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.11"
},
"funding": [
{
@ -2883,23 +2883,23 @@
},
{
"name": "symfony\/process",
"version": "v6.2.10",
"version_normalized": "6.2.10.0",
"version": "v6.2.11",
"version_normalized": "6.2.11.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/process.git",
"reference": "b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e"
"reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e",
"reference": "b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e",
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/97ae9721bead9d1a39b5650e2f4b7834b93b539c",
"reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2023-04-18T13:56:57+00:00",
"time": "2023-05-19T07:42:48+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2927,7 +2927,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.2.10"
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.2.11"
},
"funding": [
{

File diff suppressed because one or more lines are too long

View File

@ -118,9 +118,9 @@ final class CompleteCommand extends Command
if ($output->isDebug()) {
throw $e;
}
return self::FAILURE;
return 2;
}
return self::SUCCESS;
return 0;
}
private function createCompletionInput(InputInterface $input) : CompletionInput
{

View File

@ -89,7 +89,7 @@ EOH
$commandName = \basename($_SERVER['argv'][0]);
if ($input->getOption('debug')) {
$this->tailDebugLog($commandName, $output);
return self::SUCCESS;
return 0;
}
$shell = $input->getArgument('shell') ?? self::guessShell();
$completionFile = __DIR__ . '/../Resources/completion.' . $shell;
@ -103,10 +103,10 @@ EOH
} else {
$output->writeln(\sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', \implode('", "', $supportedShells)));
}
return self::INVALID;
return 2;
}
$output->write(\str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, CompleteCommand::COMPLETION_API_VERSION], \file_get_contents($completionFile)));
return self::SUCCESS;
return 0;
}
private static function guessShell() : string
{

View File

@ -112,7 +112,14 @@ class QuestionHelper extends Helper
}
}
if (\false === $ret) {
$isBlocked = \stream_get_meta_data($inputStream)['blocked'] ?? \true;
if (!$isBlocked) {
\stream_set_blocking($inputStream, \true);
}
$ret = $this->readInput($inputStream, $question);
if (!$isBlocked) {
\stream_set_blocking($inputStream, \false);
}
if (\false === $ret) {
throw new MissingInputException('Aborted.');
}
@ -415,11 +422,10 @@ class QuestionHelper extends Helper
if (\function_exists('posix_isatty')) {
return self::$stdinIsInteractive = @\posix_isatty(\fopen('php://stdin', 'r'));
}
if (!\function_exists('exec')) {
if (!\function_exists('shell_exec')) {
return self::$stdinIsInteractive = \true;
}
\exec('stty 2> /dev/null', $output, $status);
return self::$stdinIsInteractive = 1 !== $status;
return self::$stdinIsInteractive = (bool) \shell_exec('stty 2> ' . ('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
}
/**
* Reads one or more lines of input and returns what is read.

View File

@ -48,7 +48,7 @@ class InputArgument
private $description;
/**
* @param string $name The argument name
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
* @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY
* @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

@ -111,12 +111,11 @@ class Terminal
if (null !== self::$stty) {
return self::$stty;
}
// skip check if exec function is disabled
if (!\function_exists('exec')) {
// skip check if shell_exec function is disabled
if (!\function_exists('shell_exec')) {
return \false;
}
\exec('stty 2>&1', $output, $exitcode);
return self::$stty = 0 === $exitcode;
return self::$stty = (bool) \shell_exec('stty 2> ' . ('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
}
private static function initDimensions()
{

View File

@ -377,7 +377,7 @@ class Process implements \IteratorAggregate
}
do {
$this->checkTimeout();
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
$running = $this->isRunning() && ('\\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
} while ($running);
while ($this->isRunning()) {