Updated Rector to commit 278cd56de5

278cd56de5 Bump min to PHP 7.2 (#1955)
This commit is contained in:
Tomas Votruba 2022-03-24 21:23:19 +00:00
parent 4c436243fb
commit c770707831
55 changed files with 89 additions and 210 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
commands:
-
name: 'Composer Dependency'

View File

@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- uses: actions/checkout@v2

View File

@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
directory:
- 'e2e/attributes'
- 'e2e/define-constant'

View File

@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
directory:
- 'e2e/global-install'

View File

@ -6,8 +6,8 @@
"bin/rector"
],
"require": {
"php": "^7.1|^8.0",
"phpstan/phpstan": "^1.4.8"
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.5"
},
"autoload": {
"files": [

View File

@ -43,9 +43,9 @@ abstract class AbstractTestCase extends \PHPUnit\Framework\TestCase
*
* @template T of object
* @param class-string<T> $type
* @return object
* @return T
*/
protected function getService(string $type)
protected function getService(string $type) : object
{
if (self::$currentContainer === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException('First, create container with "bootWithConfigFileInfos([...])"');

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '6ebf140ee5855bc9909976e95c3aaa487711fba2';
public const PACKAGE_VERSION = '278cd56de5cb1b18ee7162dee6340a6c72689dc1';
/**
* @var string
*/
public const RELEASE_DATE = '2022-03-24 04:48:51';
public const RELEASE_DATE = '2022-03-24 22:17:08';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220324\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -24,9 +24,8 @@ final class ValueObjectInliner
/**
* @param ReflectionClass<object> $reflectionClass
* @return mixed[]
* @param object $object
*/
public static function resolveArgumentValues(\ReflectionClass $reflectionClass, $object) : array
public static function resolveArgumentValues(\ReflectionClass $reflectionClass, object $object) : array
{
$argumentValues = [];
$constructorReflectionMethod = $reflectionClass->getConstructor();
@ -56,10 +55,7 @@ final class ValueObjectInliner
}
return $inlineServices;
}
/**
* @param object $object
*/
private static function inlineSingle($object) : \RectorPrefix20220324\Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator
private static function inlineSingle(object $object) : \RectorPrefix20220324\Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator
{
$reflectionClass = new \ReflectionClass($object);
$className = $reflectionClass->getName();

View File

@ -55,8 +55,8 @@ final class WorkerCommand extends \Rector\Core\Console\Command\AbstractProcessCo
$tcpConnector = new \RectorPrefix20220324\React\Socket\TcpConnector($streamSelectLoop);
$promise = $tcpConnector->connect('127.0.0.1:' . $configuration->getParallelPort());
$promise->then(function (\RectorPrefix20220324\React\Socket\ConnectionInterface $connection) use($parallelIdentifier, $configuration) : void {
$inDecoder = new \RectorPrefix20220324\Clue\React\NDJson\Decoder($connection, \true, 512, 0);
$outEncoder = new \RectorPrefix20220324\Clue\React\NDJson\Encoder($connection, 0);
$inDecoder = new \RectorPrefix20220324\Clue\React\NDJson\Decoder($connection, \true, 512, \JSON_INVALID_UTF8_IGNORE);
$outEncoder = new \RectorPrefix20220324\Clue\React\NDJson\Encoder($connection, \JSON_INVALID_UTF8_IGNORE);
// handshake?
$outEncoder->write([\RectorPrefix20220324\Symplify\EasyParallel\Enum\ReactCommand::ACTION => \RectorPrefix20220324\Symplify\EasyParallel\Enum\Action::HELLO, \RectorPrefix20220324\Symplify\EasyParallel\Enum\ReactCommand::IDENTIFIER => $parallelIdentifier]);
$this->workerRunner->run($outEncoder, $inDecoder, $configuration);

View File

@ -26,9 +26,8 @@ final class ConfigurableCallValuesCollectingPhpFileLoader extends \RectorPrefix2
/**
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
// this call collects root values
$this->collectConfigureCallsFromJustImportedConfigurableRectorDefinitions();
@ -40,10 +39,8 @@ final class ConfigurableCallValuesCollectingPhpFileLoader extends \RectorPrefix2
* @param bool|string $ignoreErrors
* @param mixed $resource
* @return mixed
* @param string|null $type
* @param string|null $sourceResource
*/
public function import($resource, $type = null, $ignoreErrors = \false, $sourceResource = null, $exclude = null)
public function import($resource, string $type = null, $ignoreErrors = \false, string $sourceResource = null, $exclude = null)
{
// this call collects root values
$this->collectConfigureCallsFromJustImportedConfigurableRectorDefinitions();

View File

@ -40,9 +40,6 @@ final class PHPStanStubLoader
if ($vendorPath === \false) {
continue;
}
if ($vendorPath === '') {
continue;
}
foreach (self::STUBS as $stub) {
$path = $this->getStubPath($vendorPath, $stub);
if ($path === null) {

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit32293de578306aa4b39efa946b01d613
class ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit32293de578306aa4b39efa946b01d613
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit32293de578306aa4b39efa946b01d613', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit32293de578306aa4b39efa946b01d613', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', '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\ComposerStaticInit32293de578306aa4b39efa946b01d613::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitb8170b96e54ee553c1466953a0caec75::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit32293de578306aa4b39efa946b01d613
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit32293de578306aa4b39efa946b01d613::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire32293de578306aa4b39efa946b01d613($fileIdentifier, $file);
composerRequireb8170b96e54ee553c1466953a0caec75($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit32293de578306aa4b39efa946b01d613
* @param string $file
* @return void
*/
function composerRequire32293de578306aa4b39efa946b01d613($fileIdentifier, $file)
function composerRequireb8170b96e54ee553c1466953a0caec75($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 ComposerStaticInit32293de578306aa4b39efa946b01d613
class ComposerStaticInitb8170b96e54ee553c1466953a0caec75
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3838,9 +3838,9 @@ class ComposerStaticInit32293de578306aa4b39efa946b01d613
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit32293de578306aa4b39efa946b01d613::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit32293de578306aa4b39efa946b01d613::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit32293de578306aa4b39efa946b01d613::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$classMap;
}, null, ClassLoader::class);
}

View File

@ -27,12 +27,7 @@ class Preg
if (($flags & \PREG_OFFSET_CAPTURE) !== 0) {
throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use matchWithOffsets() instead');
}
$result = \preg_match($pattern, $subject, $matches, $flags, $offset);
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
$result = \preg_match($pattern, $subject, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset);
if ($result === \false) {
throw \RectorPrefix20220324\Composer\Pcre\PcreException::fromFunction('preg_match', $pattern);
}
@ -50,12 +45,7 @@ class Preg
*/
public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0) : int
{
$result = \preg_match($pattern, $subject, $matches, $flags | \PREG_OFFSET_CAPTURE, $offset);
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
$result = \preg_match($pattern, $subject, $matches, $flags | \PREG_UNMATCHED_AS_NULL | \PREG_OFFSET_CAPTURE, $offset);
if ($result === \false) {
throw \RectorPrefix20220324\Composer\Pcre\PcreException::fromFunction('preg_match', $pattern);
}
@ -75,12 +65,7 @@ class Preg
if (($flags & \PREG_SET_ORDER) !== 0) {
throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
}
$result = \preg_match_all($pattern, $subject, $matches, $flags, $offset);
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
$result = \preg_match_all($pattern, $subject, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset);
if ($result === \false || $result === null) {
throw \RectorPrefix20220324\Composer\Pcre\PcreException::fromFunction('preg_match_all', $pattern);
}
@ -98,12 +83,7 @@ class Preg
*/
public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0) : int
{
$result = \preg_match_all($pattern, $subject, $matches, $flags | \PREG_OFFSET_CAPTURE, $offset);
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
$result = \preg_match_all($pattern, $subject, $matches, $flags | \PREG_UNMATCHED_AS_NULL | \PREG_OFFSET_CAPTURE, $offset);
if ($result === \false || $result === null) {
throw \RectorPrefix20220324\Composer\Pcre\PcreException::fromFunction('preg_match_all', $pattern);
}

View File

@ -40,7 +40,7 @@ final class Json
*/
public static function decode(string $json, int $flags = 0)
{
$value = \json_decode($json, \true, 512, $flags | \JSON_BIGINT_AS_STRING);
$value = \json_decode($json, null, 512, $flags | \JSON_BIGINT_AS_STRING);
if ($error = \json_last_error()) {
throw new \RectorPrefix20220324\Nette\Utils\JsonException(\json_last_error_msg(), $error);
}

View File

@ -17,5 +17,5 @@ interface EventDispatcherInterface
* @return object
* The Event that was passed, now modified by listeners.
*/
public function dispatch($event);
public function dispatch(object $event);
}

View File

@ -15,5 +15,5 @@ interface ListenerProviderInterface
* An iterable (array, iterator, or generator) of callables. Each
* callable MUST be type-compatible with $event.
*/
public function getListenersForEvent($event) : iterable;
public function getListenersForEvent(object $event) : iterable;
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220324\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit32293de578306aa4b39efa946b01d613', false) && !interface_exists('ComposerAutoloaderInit32293de578306aa4b39efa946b01d613', false) && !trait_exists('ComposerAutoloaderInit32293de578306aa4b39efa946b01d613', false)) {
spl_autoload_call('RectorPrefix20220324\ComposerAutoloaderInit32293de578306aa4b39efa946b01d613');
if (!class_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false) && !interface_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false) && !trait_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false)) {
spl_autoload_call('RectorPrefix20220324\ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75');
}
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('RectorPrefix20220324\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220324\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire32293de578306aa4b39efa946b01d613')) {
function composerRequire32293de578306aa4b39efa946b01d613() {
return \RectorPrefix20220324\composerRequire32293de578306aa4b39efa946b01d613(...func_get_args());
if (!function_exists('composerRequireb8170b96e54ee553c1466953a0caec75')) {
function composerRequireb8170b96e54ee553c1466953a0caec75() {
return \RectorPrefix20220324\composerRequireb8170b96e54ee553c1466953a0caec75(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -29,9 +29,8 @@ class DelegatingLoader extends \RectorPrefix20220324\Symfony\Component\Config\Lo
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
if (\false === ($loader = $this->resolver->resolve($resource, $type))) {
throw new \RectorPrefix20220324\Symfony\Component\Config\Exception\LoaderLoadException($resource, null, 0, null, $type);

View File

@ -63,7 +63,7 @@ abstract class FileLoader extends \RectorPrefix20220324\Symfony\Component\Config
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
public function import($resource, $type = null, $ignoreErrors = \false, $sourceResource = null, $exclude = null)
public function import($resource, string $type = null, bool $ignoreErrors = \false, string $sourceResource = null, $exclude = null)
{
if (\is_string($resource) && \strlen($resource) !== ($i = \strcspn($resource, '*?{[')) && \strpos($resource, "\n") === \false) {
$excluded = [];

View File

@ -21,9 +21,8 @@ class GlobFileLoader extends \RectorPrefix20220324\Symfony\Component\Config\Load
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
return $this->import($resource);
}

View File

@ -43,9 +43,8 @@ abstract class Loader implements \RectorPrefix20220324\Symfony\Component\Config\
*
* @return mixed
* @param mixed $resource
* @param string|null $type
*/
public function import($resource, $type = null)
public function import($resource, string $type = null)
{
return $this->resolve($resource, $type)->load($resource, $type);
}

View File

@ -24,9 +24,8 @@ interface LoaderInterface
*
* @throws \Exception If something went wrong
* @param mixed $resource
* @param string|null $type
*/
public function load($resource, $type = null);
public function load($resource, string $type = null);
/**
* Returns whether this class supports the given resource.
*

View File

@ -30,9 +30,8 @@ abstract class Descriptor implements \RectorPrefix20220324\Symfony\Component\Con
protected $output;
/**
* {@inheritdoc}
* @param object $object
*/
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, $object, array $options = [])
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, object $object, array $options = [])
{
$this->output = $output;
switch (\true) {

View File

@ -18,8 +18,5 @@ use RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface;
*/
interface DescriptorInterface
{
/**
* @param object $object
*/
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, $object, array $options = []);
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, object $object, array $options = []);
}

View File

@ -28,9 +28,8 @@ class MarkdownDescriptor extends \RectorPrefix20220324\Symfony\Component\Console
{
/**
* {@inheritdoc}
* @param object $object
*/
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, $object, array $options = [])
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, object $object, array $options = [])
{
$decorated = $output->isDecorated();
$output->setDecorated(\false);

View File

@ -40,9 +40,8 @@ class DescriptorHelper extends \RectorPrefix20220324\Symfony\Component\Console\H
* * raw_text: boolean, sets output type as raw
*
* @throws InvalidArgumentException when the given format is not supported
* @param object|null $object
*/
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, $object, array $options = [])
public function describe(\RectorPrefix20220324\Symfony\Component\Console\Output\OutputInterface $output, ?object $object, array $options = [])
{
$options = \array_merge(['raw_text' => \false, 'format' => 'txt'], $options);
if (!isset($this->descriptors[$options['format']])) {

View File

@ -92,21 +92,6 @@ class StreamOutput extends \RectorPrefix20220324\Symfony\Component\Console\Outpu
if (\DIRECTORY_SEPARATOR === '\\') {
return \function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($this->stream) || \false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM');
}
$streamIsatty = function ($stream) {
if (\function_exists('stream_isatty')) {
return \stream_isatty($stream);
}
if (!\is_resource($stream)) {
\trigger_error('stream_isatty() expects parameter 1 to be resource, ' . \gettype($stream) . ' given', \E_USER_WARNING);
return \false;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$stat = @\fstat($stream);
// Check if formatted mode is S_IFCHR
return $stat ? 020000 === ($stat['mode'] & 0170000) : \false;
}
return \function_exists('posix_isatty') && @\posix_isatty($stream);
};
return $streamIsatty($this->stream);
return \stream_isatty($this->stream);
}
}

View File

@ -25,5 +25,5 @@ interface EventDispatcherInterface extends \RectorPrefix20220324\Psr\EventDispat
*
* @return object The passed $event MUST be returned
*/
public function dispatch($event, string $eventName = null);
public function dispatch(object $event, string $eventName = null) : object;
}

View File

@ -125,9 +125,8 @@ class Container implements \RectorPrefix20220324\Symfony\Component\DependencyInj
*
* Setting a synthetic service to null resets it: has() returns false and get()
* behaves in the same way as if the service was never created.
* @param object|null $service
*/
public function set(string $id, $service)
public function set(string $id, ?object $service)
{
// Runs the internal initializer; used by the dumped container to include always-needed files
if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof \Closure) {
@ -179,9 +178,8 @@ class Container implements \RectorPrefix20220324\Symfony\Component\DependencyInj
* @throws \Exception if an exception has been thrown when the service has been resolved
*
* @see Reference
* @return object|null
*/
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) : ?object
{
return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior));
}

View File

@ -392,9 +392,8 @@ class ContainerBuilder extends \RectorPrefix20220324\Symfony\Component\Dependenc
* Sets a service.
*
* @throws BadMethodCallException When this ContainerBuilder is compiled
* @param object|null $service
*/
public function set(string $id, $service)
public function set(string $id, ?object $service)
{
if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) {
// setting a synthetic service on a compiled container is alright
@ -424,9 +423,8 @@ class ContainerBuilder extends \RectorPrefix20220324\Symfony\Component\Dependenc
* @throws \Exception
*
* @see Reference
* @return object|null
*/
public function get(string $id, int $invalidBehavior = \RectorPrefix20220324\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
public function get(string $id, int $invalidBehavior = \RectorPrefix20220324\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) : ?object
{
if ($this->isCompiled() && isset($this->removedIds[$id]) && \RectorPrefix20220324\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
return parent::get($id);
@ -1338,9 +1336,8 @@ class ContainerBuilder extends \RectorPrefix20220324\Symfony\Component\Dependenc
}
/**
* @return mixed
* @param object $service
*/
private function callMethod($service, array $call, array &$inlineServices)
private function callMethod(object $service, array $call, array &$inlineServices)
{
foreach (self::getServiceConditionals($call[1]) as $s) {
if (!$this->has($s)) {

View File

@ -27,18 +27,14 @@ interface ContainerInterface extends \RectorPrefix20220324\Psr\Container\Contain
public const NULL_ON_INVALID_REFERENCE = 2;
public const IGNORE_ON_INVALID_REFERENCE = 3;
public const IGNORE_ON_UNINITIALIZED_REFERENCE = 4;
/**
* @param object|null $service
*/
public function set(string $id, $service);
public function set(string $id, ?object $service);
/**
* @throws ServiceCircularReferenceException When a circular reference is detected
* @throws ServiceNotFoundException When the service is not defined
*
* @see Reference
* @return object|null
*/
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) : ?object;
public function has(string $id) : bool;
/**
* Check for whether or not a service has been initialized.

View File

@ -23,9 +23,8 @@ class RealServiceInstantiator implements \RectorPrefix20220324\Symfony\Component
{
/**
* {@inheritdoc}
* @return object
*/
public function instantiateProxy(\RectorPrefix20220324\Symfony\Component\DependencyInjection\ContainerInterface $container, \RectorPrefix20220324\Symfony\Component\DependencyInjection\Definition $definition, string $id, callable $realInstantiator)
public function instantiateProxy(\RectorPrefix20220324\Symfony\Component\DependencyInjection\ContainerInterface $container, \RectorPrefix20220324\Symfony\Component\DependencyInjection\Definition $definition, string $id, callable $realInstantiator) : object
{
return $realInstantiator();
}

View File

@ -31,9 +31,8 @@ class ClosureLoader extends \RectorPrefix20220324\Symfony\Component\Config\Loade
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
return $resource($this->container, $this->env);
}

View File

@ -21,9 +21,8 @@ class DirectoryLoader extends \RectorPrefix20220324\Symfony\Component\Dependency
* {@inheritdoc}
* @param mixed $file
* @return mixed
* @param string|null $type
*/
public function load($file, $type = null)
public function load($file, string $type = null)
{
$file = \rtrim($file, '/');
$path = $this->locator->locate($file);

View File

@ -47,10 +47,8 @@ abstract class FileLoader extends \RectorPrefix20220324\Symfony\Component\Config
* @param bool|string $ignoreErrors Whether errors should be ignored; pass "not_found" to ignore only when the loaded resource is not found
* @param mixed $resource
* @return mixed
* @param string|null $type
* @param string|null $sourceResource
*/
public function import($resource, $type = null, $ignoreErrors = \false, $sourceResource = null, $exclude = null)
public function import($resource, string $type = null, $ignoreErrors = \false, string $sourceResource = null, $exclude = null)
{
$args = \func_get_args();
if ($ignoreNotFound = 'not_found' === $ignoreErrors) {

View File

@ -21,9 +21,8 @@ class GlobFileLoader extends \RectorPrefix20220324\Symfony\Component\DependencyI
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
foreach ($this->glob($resource, \false, $globResource) as $path => $info) {
$this->import($path);

View File

@ -23,9 +23,8 @@ class IniFileLoader extends \RectorPrefix20220324\Symfony\Component\DependencyIn
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
$path = $this->locator->locate($resource);
$this->container->fileExists($path);

View File

@ -42,9 +42,8 @@ class PhpFileLoader extends \RectorPrefix20220324\Symfony\Component\DependencyIn
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
// the container and loader variables are exposed to the included file below
$container = $this->container;

View File

@ -40,9 +40,8 @@ class XmlFileLoader extends \RectorPrefix20220324\Symfony\Component\DependencyIn
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
$path = $this->locator->locate($resource);
$xml = $this->parseFileToDOM($path);

View File

@ -55,9 +55,8 @@ class YamlFileLoader extends \RectorPrefix20220324\Symfony\Component\DependencyI
* {@inheritdoc}
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
$path = $this->locator->locate($resource);
$content = $this->loadFile($path);

View File

@ -34,7 +34,7 @@ final class ReverseContainer
$this->serviceContainer = $serviceContainer;
$this->reversibleLocator = $reversibleLocator;
$this->tagName = $tagName;
$this->getServiceId = \Closure::bind(function ($service) : ?string {
$this->getServiceId = \Closure::bind(function (object $service) : ?string {
return (\array_search($service, $this->services, \true) ?: \array_search($service, $this->privates, \true)) ?: null;
}, $serviceContainer, \RectorPrefix20220324\Symfony\Component\DependencyInjection\Container::class);
}
@ -42,9 +42,8 @@ final class ReverseContainer
* Returns the id of the passed object when it exists as a service.
*
* To be reversible, services need to be either public or be tagged with "container.reversible".
* @param object $service
*/
public function getId($service) : ?string
public function getId(object $service) : ?string
{
if ($this->serviceContainer === $service) {
return 'service_container';
@ -59,9 +58,8 @@ final class ReverseContainer
}
/**
* @throws ServiceNotFoundException When the service is not reversible
* @return object
*/
public function getService(string $id)
public function getService(string $id) : object
{
if ($this->serviceContainer->has($id)) {
return $this->serviceContainer->get($id);

View File

@ -30,7 +30,7 @@ abstract class AbstractString implements \JsonSerializable
public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
public const PREG_SET_ORDER = \PREG_SET_ORDER;
public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
public const PREG_UNMATCHED_AS_NULL = 512;
public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
public const PREG_SPLIT = 0;
public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;

View File

@ -207,7 +207,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20220324\Symfony\Compo
throw new \RectorPrefix20220324\Symfony\Component\String\Exception\InvalidArgumentException($m);
});
try {
if (\false === $match($regexp . 'u', $this->string, $matches, $flags, $offset)) {
if (\false === $match($regexp . 'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
$lastError = \preg_last_error();
foreach (\get_defined_constants(\true)['pcre'] as $k => $v) {
if ($lastError === $v && '_ERROR' === \substr($k, -6)) {
@ -216,11 +216,6 @@ abstract class AbstractUnicodeString extends \RectorPrefix20220324\Symfony\Compo
}
throw new \RectorPrefix20220324\Symfony\Component\String\Exception\RuntimeException('Matching failed with unknown error code.');
}
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
} finally {
\restore_error_handler();
}

View File

@ -219,7 +219,7 @@ class ByteString extends \RectorPrefix20220324\Symfony\Component\String\Abstract
throw new \RectorPrefix20220324\Symfony\Component\String\Exception\InvalidArgumentException($m);
});
try {
if (\false === $match($regexp, $this->string, $matches, $flags, $offset)) {
if (\false === $match($regexp, $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
$lastError = \preg_last_error();
foreach (\get_defined_constants(\true)['pcre'] as $k => $v) {
if ($lastError === $v && '_ERROR' === \substr($k, -6)) {
@ -228,11 +228,6 @@ class ByteString extends \RectorPrefix20220324\Symfony\Component\String\Abstract
}
throw new \RectorPrefix20220324\Symfony\Component\String\Exception\RuntimeException('Matching failed with unknown error code.');
}
\array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
}
});
} finally {
\restore_error_handler();
}

View File

@ -33,9 +33,8 @@ final class ParameterMergingPhpFileLoader extends \RectorPrefix20220324\Symfony\
* @see https://github.com/symplify/symplify/pull/697
* @param mixed $resource
* @return mixed
* @param string|null $type
*/
public function load($resource, $type = null)
public function load($resource, string $type = null)
{
// get old parameters
$parameterBag = $this->container->getParameterBag();

View File

@ -16,10 +16,9 @@ final class PrivatesAccessor
* @template T of object
*
* @param class-string<T> $valueClassName
* @return object
* @param object $object
* @return T
*/
public function getPrivatePropertyOfClass($object, string $propertyName, string $valueClassName)
public function getPrivatePropertyOfClass(object $object, string $propertyName, string $valueClassName) : object
{
$value = $this->getPrivateProperty($object, $propertyName);
if ($value instanceof $valueClassName) {
@ -30,9 +29,8 @@ final class PrivatesAccessor
}
/**
* @return mixed
* @param object $object
*/
public function getPrivateProperty($object, string $propertyName)
public function getPrivateProperty(object $object, string $propertyName)
{
$propertyReflection = $this->resolvePropertyReflection($object, $propertyName);
$propertyReflection->setAccessible(\true);
@ -43,9 +41,8 @@ final class PrivatesAccessor
*
* @param class-string<T> $valueClassName
* @param mixed $value
* @param object $object
*/
public function setPrivatePropertyOfClass($object, string $propertyName, $value, string $valueClassName) : void
public function setPrivatePropertyOfClass(object $object, string $propertyName, $value, string $valueClassName) : void
{
if ($value instanceof $valueClassName) {
$this->setPrivateProperty($object, $propertyName, $value);
@ -56,18 +53,14 @@ final class PrivatesAccessor
}
/**
* @param mixed $value
* @param object $object
*/
public function setPrivateProperty($object, string $propertyName, $value) : void
public function setPrivateProperty(object $object, string $propertyName, $value) : void
{
$propertyReflection = $this->resolvePropertyReflection($object, $propertyName);
$propertyReflection->setAccessible(\true);
$propertyReflection->setValue($object, $value);
}
/**
* @param object $object
*/
private function resolvePropertyReflection($object, string $propertyName) : \ReflectionProperty
private function resolvePropertyReflection(object $object, string $propertyName) : \ReflectionProperty
{
if (\property_exists($object, $propertyName)) {
return new \ReflectionProperty($object, $propertyName);

View File

@ -39,10 +39,7 @@ final class PrivatesCaller
$methodReflection->invokeArgs($object, [&$argument]);
return $argument;
}
/**
* @param object $object
*/
private function createAccessibleMethodReflection($object, string $methodName) : \ReflectionMethod
private function createAccessibleMethodReflection(object $object, string $methodName) : \ReflectionMethod
{
$reflectionMethod = new \ReflectionMethod(\get_class($object), $methodName);
$reflectionMethod->setAccessible(\true);

View File

@ -51,9 +51,9 @@ abstract class AbstractKernelTestCase extends \RectorPrefix20220324\PHPUnit\Fram
*
* @template T of object
* @param class-string<T> $type
* @return object
* @return T
*/
protected function getService(string $type)
protected function getService(string $type) : object
{
if (self::$container === null) {
throw new \RectorPrefix20220324\Symplify\SymplifyKernel\Exception\ShouldNotHappenException('First, create container with booKernel(KernelClass::class)');

View File

@ -39,7 +39,7 @@ final class DeferredContent
}
public function addSetup(string $method, $argument) : void
{
$argument = \json_encode($argument, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
$argument = \json_encode($argument, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_INVALID_UTF8_SUBSTITUTE);
$item =& $this->getItems('setup')[$this->requestId];
$item['code'] = ($item['code'] ?? '') . "{$method}({$argument});\n";
$item['time'] = \time();

View File

@ -134,10 +134,7 @@ final class Describer
}
return $res ?? $items;
}
/**
* @param object $obj
*/
private function describeObject($obj, int $depth = 0) : \RectorPrefix20220324\Tracy\Dumper\Value
private function describeObject(object $obj, int $depth = 0) : \RectorPrefix20220324\Tracy\Dumper\Value
{
$id = \spl_object_id($obj);
$value =& $this->snapshot[$id];
@ -205,10 +202,7 @@ final class Describer
$class = $class ?? $value->value;
$value->items[] = [$this->describeKey($k), $type !== \RectorPrefix20220324\Tracy\Dumper\Value::PROP_VIRTUAL && $this->isSensitive($k, $v, $class) ? new \RectorPrefix20220324\Tracy\Dumper\Value(\RectorPrefix20220324\Tracy\Dumper\Value::TYPE_TEXT, self::hideValue($v)) : $this->describeVar($v, $value->depth + 1, $refId), $type === \RectorPrefix20220324\Tracy\Dumper\Value::PROP_PRIVATE ? $class : $type] + ($refId ? [3 => $refId] : []);
}
/**
* @param object $obj
*/
private function exposeObject($obj, \RectorPrefix20220324\Tracy\Dumper\Value $value) : ?array
private function exposeObject(object $obj, \RectorPrefix20220324\Tracy\Dumper\Value $value) : ?array
{
foreach ($this->objectExposers as $type => $dumper) {
if (!$type || $obj instanceof $type) {

View File

@ -14,10 +14,7 @@ use RectorPrefix20220324\Ds;
*/
final class Exposer
{
/**
* @param object $obj
*/
public static function exposeObject($obj, \RectorPrefix20220324\Tracy\Dumper\Value $value, \RectorPrefix20220324\Tracy\Dumper\Describer $describer) : void
public static function exposeObject(object $obj, \RectorPrefix20220324\Tracy\Dumper\Value $value, \RectorPrefix20220324\Tracy\Dumper\Describer $describer) : void
{
$tmp = (array) $obj;
$values = $tmp;

View File

@ -391,22 +391,7 @@ XX
}
public static function detectColors() : bool
{
$streamIsatty = function ($stream) {
if (\function_exists('stream_isatty')) {
return \stream_isatty($stream);
}
if (!\is_resource($stream)) {
\trigger_error('stream_isatty() expects parameter 1 to be resource, ' . \gettype($stream) . ' given', \E_USER_WARNING);
return \false;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$stat = @\fstat($stream);
// Check if formatted mode is S_IFCHR
return $stat ? 020000 === ($stat['mode'] & 0170000) : \false;
}
return \function_exists('posix_isatty') && @\posix_isatty($stream);
};
return self::isCli() && \getenv('NO_COLOR') === \false && (\getenv('FORCE_COLOR') || @$streamIsatty(\STDOUT) || (\defined('PHP_WINDOWS_VERSION_BUILD') && (\function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\STDOUT)) || \getenv('ConEmuANSI') === 'ON' || \getenv('ANSICON') !== \false || \getenv('term') === 'xterm' || \getenv('term') === 'xterm-256color'));
return self::isCli() && \getenv('NO_COLOR') === \false && (\getenv('FORCE_COLOR') || @\stream_isatty(\STDOUT) || (\defined('PHP_WINDOWS_VERSION_BUILD') && (\function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\STDOUT)) || \getenv('ConEmuANSI') === 'ON' || \getenv('ANSICON') !== \false || \getenv('term') === 'xterm' || \getenv('term') === 'xterm-256color'));
}
public static function getExceptionChain(\Throwable $ex) : array
{

View File

@ -70,7 +70,7 @@ class FireLogger implements \RectorPrefix20220324\Tracy\ILogger
}
$item['args'] = $args;
$this->payload['logs'][] = $this->jsonDump($item, -1);
foreach (\str_split(\base64_encode(\json_encode($this->payload, 0)), 4990) as $k => $v) {
foreach (\str_split(\base64_encode(\json_encode($this->payload, \JSON_INVALID_UTF8_SUBSTITUTE)), 4990) as $k => $v) {
\header("FireLogger-de11e-{$k}: {$v}");
}
return \true;