This commit is contained in:
Fabien Potencier 2019-06-13 12:57:15 +02:00
parent 0f958aabfa
commit 37fa45bbd1
50 changed files with 96 additions and 96 deletions

View File

@ -67,7 +67,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
}
if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) {
if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) {
return $this->records[spl_object_hash($request)] ?? [];
}
@ -89,7 +89,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
}
if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) {
if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) {
return $this->errorCount[spl_object_hash($request)] ?? 0;
}

View File

@ -53,7 +53,7 @@ class SymfonyTestsListenerTrait
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2;
}
$enableDebugClassLoader = \class_exists('Symfony\Component\Debug\DebugClassLoader');
$enableDebugClassLoader = class_exists('Symfony\Component\Debug\DebugClassLoader');
foreach ($mockedNamespaces as $type => $namespaces) {
if (!\is_array($namespaces)) {

View File

@ -99,7 +99,7 @@ EOF;
private static function getProxyManagerVersion(): string
{
if (!\class_exists(Version::class)) {
if (!class_exists(Version::class)) {
return '0.0.1';
}

View File

@ -295,7 +295,7 @@ TXT
$tester = $this->createCommandTester([], [], null, null, false, ['message' => $message]);
$tester->execute([], ['decorated' => true]);
$display = $tester->getDisplay();
$this->assertContains(\json_encode($message), $display);
$this->assertContains(json_encode($message), $display);
}
public function testWithGlobalsJson()
@ -304,7 +304,7 @@ TXT
$tester = $this->createCommandTester([], [], null, null, false, $globals);
$tester->execute(['--format' => 'json'], ['decorated' => true]);
$display = $tester->getDisplay();
$display = \json_decode($display, true);
$display = json_decode($display, true);
$this->assertSame($globals, $display['globals']);
}
@ -313,10 +313,10 @@ TXT
$tester = $this->createCommandTester();
$tester->execute(['--format' => 'json'], ['decorated' => false]);
$display = $tester->getDisplay();
$display1 = \json_decode($display, true);
$display1 = json_decode($display, true);
$tester->execute(['--filter' => 'date', '--format' => 'json'], ['decorated' => false]);
$display = $tester->getDisplay();
$display2 = \json_decode($display, true);
$display2 = json_decode($display, true);
$this->assertNotSame($display1, $display2);
}

View File

@ -40,7 +40,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
if ($excludeRegexp instanceof CacheItemPoolInterface) {
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
$excludeRegexp = $debug;
$debug = 4 < \func_num_args() && \func_get_arg(4);
$debug = 4 < \func_num_args() && func_get_arg(4);
}
parent::__construct($phpArrayFile);
$this->annotationReader = $annotationReader;

View File

@ -36,7 +36,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
*/
public function __construct(array $loaders, string $phpArrayFile)
{
if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) {
if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) {
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
}
parent::__construct($phpArrayFile);

View File

@ -37,7 +37,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
*/
public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile)
{
if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) {
if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) {
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
}
parent::__construct($phpArrayFile);

View File

@ -52,9 +52,9 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
// Detect wrapped values that encode for their expiry and creation duration
// For compactness, these values are packed in the key of an array using
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = \key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
$item->value = $v[$k];
$v = \unpack('Ve/Nc', \substr($k, 1, -1));
$v = unpack('Ve/Nc', substr($k, 1, -1));
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;
$item->metadata[CacheItem::METADATA_CTIME] = $v['c'];
}

View File

@ -58,9 +58,9 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
// Detect wrapped values that encode for their expiry and creation duration
// For compactness, these values are packed in the key of an array using
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = \key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
$item->value = $v[$k];
$v = \unpack('Ve/Nc', \substr($k, 1, -1));
$v = unpack('Ve/Nc', substr($k, 1, -1));
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;
$item->metadata[CacheItem::METADATA_CTIME] = $v['c'];
} elseif ($innerItem instanceof CacheItem) {

View File

@ -110,7 +110,7 @@ final class CacheItem implements ItemInterface
if (!$this->isTaggable) {
throw new LogicException(sprintf('Cache item "%s" comes from a non tag-aware pool: you cannot tag it.', $this->key));
}
if (!\is_iterable($tags)) {
if (!is_iterable($tags)) {
$tags = [$tags];
}
foreach ($tags as $tag) {

View File

@ -123,7 +123,7 @@ trait ArrayTrait
if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) {
return serialize($value);
}
} elseif (!\is_scalar($value)) {
} elseif (!is_scalar($value)) {
try {
$serialized = serialize($value);
} catch (\Exception $e) {

View File

@ -86,7 +86,7 @@ EOF;
$isStaticValue = false;
}
$value = var_export($value, true);
} elseif (!\is_scalar($value)) {
} elseif (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
} else {
$value = var_export($value, true);

View File

@ -182,7 +182,7 @@ trait PhpFilesTrait
$isStaticValue = false;
}
$value = var_export($value, true);
} elseif (!\is_scalar($value)) {
} elseif (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
} else {
$value = var_export($value, true);

View File

@ -779,7 +779,7 @@ class Application
if (false !== strpos($message, "class@anonymous\0")) {
$message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
}, $message);
}

View File

@ -51,7 +51,7 @@ class ProcessHelper extends Helper
if (!\is_array($cmd)) {
@trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), E_USER_DEPRECATED);
$cmd = [\method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
$cmd = [method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
}
if (\is_string($cmd[0] ?? null)) {

View File

@ -50,7 +50,7 @@ class ConsoleSectionOutput extends StreamOutput
}
if ($lines) {
\array_splice($this->content, -($lines * 2)); // Multiply lines by 2 to cater for each new line added between content
array_splice($this->content, -($lines * 2)); // Multiply lines by 2 to cater for each new line added between content
} else {
$lines = $this->lines;
$this->content = [];

View File

@ -26,7 +26,7 @@ class ProcessHelperTest extends TestCase
public function testVariousProcessRuns($expected, $cmd, $verbosity, $error)
{
if (\is_string($cmd)) {
$cmd = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd);
$cmd = method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd);
}
$helper = new ProcessHelper();
@ -99,7 +99,7 @@ EOT;
$args = new Process(['php', '-r', 'echo 42;']);
$args = $args->getCommandLine();
$successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug);
$fromShellCommandline = \method_exists(Process::class, 'fromShellCommandline') ? [Process::class, 'fromShellCommandline'] : function ($cmd) { return new Process($cmd); };
$fromShellCommandline = method_exists(Process::class, 'fromShellCommandline') ? [Process::class, 'fromShellCommandline'] : function ($cmd) { return new Process($cmd); };
return [
['', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null],

View File

@ -171,7 +171,7 @@ class DebugClassLoader
private function checkClass($class, $file = null)
{
$exists = null === $file || \class_exists($class, false) || \interface_exists($class, false) || \trait_exists($class, false);
$exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
if (null !== $file && $class && '\\' === $class[0]) {
$class = substr($class, 1);
@ -189,7 +189,7 @@ class DebugClassLoader
}
$name = $refl->getName();
if ($name !== $class && 0 === \strcasecmp($name, $class)) {
if ($name !== $class && 0 === strcasecmp($name, $class)) {
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name));
}
@ -222,23 +222,23 @@ class DebugClassLoader
$deprecations = [];
// Don't trigger deprecations for classes in the same vendor
if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) {
if (2 > $len = 1 + (strpos($class, '\\') ?: strpos($class, '_'))) {
$len = 0;
$ns = '';
} else {
$ns = \str_replace('_', '\\', \substr($class, 0, $len));
$ns = str_replace('_', '\\', substr($class, 0, $len));
}
// Detect annotations on the class
if (false !== $doc = $refl->getDocComment()) {
foreach (['final', 'deprecated', 'internal'] as $annotation) {
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
}
}
}
$parent = \get_parent_class($class);
$parent = get_parent_class($class);
$parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent);
if ($parent) {
$parentAndOwnInterfaces[$parent] = $parent;
@ -253,22 +253,22 @@ class DebugClassLoader
}
// Detect if the parent is annotated
foreach ($parentAndOwnInterfaces + \class_uses($class, false) as $use) {
foreach ($parentAndOwnInterfaces + class_uses($class, false) as $use) {
if (!isset(self::$checkedClasses[$use])) {
$this->checkClass($use);
}
if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) {
if (isset(self::$deprecated[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) {
$type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait');
$verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
$deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]);
}
if (isset(self::$internal[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
if (isset(self::$internal[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len)) {
$deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class);
}
}
if (\trait_exists($class)) {
if (trait_exists($class)) {
return $deprecations;
}
@ -296,7 +296,7 @@ class DebugClassLoader
if (isset(self::$internalMethods[$class][$method->name])) {
list($declaringClass, $message) = self::$internalMethods[$class][$method->name];
if (\strncmp($ns, $declaringClass, $len)) {
if (strncmp($ns, $declaringClass, $len)) {
$deprecations[] = sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class);
}
}
@ -324,14 +324,14 @@ class DebugClassLoader
$finalOrInternal = false;
foreach (['final', 'internal'] as $annotation) {
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
$finalOrInternal = true;
}
}
if ($finalOrInternal || $method->isConstructor() || false === \strpos($doc, '@param') || StatelessInvocation::class === $class) {
if ($finalOrInternal || $method->isConstructor() || false === strpos($doc, '@param') || StatelessInvocation::class === $class) {
continue;
}
if (!preg_match_all('#\n\s+\* @param (.*?)(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, PREG_SET_ORDER)) {

View File

@ -172,7 +172,7 @@ class FlattenException
{
if (false !== strpos($message, "class@anonymous\0")) {
$message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
}, $message);
}

View File

@ -614,7 +614,7 @@ class XmlFileLoaderTest extends TestCase
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->assertContains((string) new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources);
$prototypeRealPath = \realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype');
$prototypeRealPath = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype');
$globResource = new GlobResource(
$fixturesDir.'Prototype',
'/*',

View File

@ -367,7 +367,7 @@ class YamlFileLoaderTest extends TestCase
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->assertContains((string) new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources);
$prototypeRealPath = \realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype');
$prototypeRealPath = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype');
$globResource = new GlobResource(
$fixturesDir.'Prototype',
'',

View File

@ -34,7 +34,7 @@ class TypedReference extends Reference
@trigger_error(sprintf('The $requiringClass argument of "%s()" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
$this->requiringClass = $invalidBehavior;
$invalidBehavior = 3 < \func_num_args() ? \func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$invalidBehavior = 3 < \func_num_args() ? func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
} else {
$this->name = $type === $id ? $name : null;
}

View File

@ -1165,7 +1165,7 @@ class Crawler implements \Countable, \IteratorAggregate
*/
private function createCssSelectorConverter(): CssSelectorConverter
{
if (!\class_exists(CssSelectorConverter::class)) {
if (!class_exists(CssSelectorConverter::class)) {
throw new \LogicException('To filter with a CSS selector, install the CssSelector component ("composer require symfony/css-selector"). Or use filterXpath instead.');
}

View File

@ -382,7 +382,7 @@ final class Dotenv
throw new \LogicException('Resolving commands requires the Symfony Process component.');
}
$process = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline('echo '.$matches[0]) : new Process('echo '.$matches[0]);
$process = method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline('echo '.$matches[0]) : new Process('echo '.$matches[0]);
$process->inheritEnvironmentVariables(true);
$process->setEnv($this->values);
try {

View File

@ -743,15 +743,15 @@ class Filesystem
private static function box($func)
{
self::$lastError = null;
\set_error_handler(__CLASS__.'::handleError');
set_error_handler(__CLASS__.'::handleError');
try {
$result = $func(...\array_slice(\func_get_args(), 1));
\restore_error_handler();
restore_error_handler();
return $result;
} catch (\Throwable $e) {
}
\restore_error_handler();
restore_error_handler();
throw $e;
}

View File

@ -172,7 +172,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function name($patterns)
{
$this->names = \array_merge($this->names, (array) $patterns);
$this->names = array_merge($this->names, (array) $patterns);
return $this;
}
@ -188,7 +188,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function notName($patterns)
{
$this->notNames = \array_merge($this->notNames, (array) $patterns);
$this->notNames = array_merge($this->notNames, (array) $patterns);
return $this;
}
@ -210,7 +210,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function contains($patterns)
{
$this->contains = \array_merge($this->contains, (array) $patterns);
$this->contains = array_merge($this->contains, (array) $patterns);
return $this;
}
@ -232,7 +232,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function notContains($patterns)
{
$this->notContains = \array_merge($this->notContains, (array) $patterns);
$this->notContains = array_merge($this->notContains, (array) $patterns);
return $this;
}
@ -256,7 +256,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function path($patterns)
{
$this->paths = \array_merge($this->paths, (array) $patterns);
$this->paths = array_merge($this->paths, (array) $patterns);
return $this;
}
@ -280,7 +280,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function notPath($patterns)
{
$this->notPaths = \array_merge($this->notPaths, (array) $patterns);
$this->notPaths = array_merge($this->notPaths, (array) $patterns);
return $this;
}

View File

@ -65,9 +65,9 @@ class LocaleDataGenerator extends AbstractDataGenerator
protected function preGenerate()
{
// Write parents locale file for the Translation component
\file_put_contents(
file_put_contents(
__DIR__.'/../../../Translation/Resources/data/parents.json',
\json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL
json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL
);
}

View File

@ -92,10 +92,10 @@ class LocaleScanner
$fallbacks = [];
foreach ($locales as $locale) {
$content = \file_get_contents($sourceDir.'/'.$locale.'.txt');
$content = file_get_contents($sourceDir.'/'.$locale.'.txt');
// Aliases contain the text "%%PARENT" followed by the aliased locale
if (\preg_match('/%%Parent{"([^"]+)"}/', $content, $matches)) {
if (preg_match('/%%Parent{"([^"]+)"}/', $content, $matches)) {
$fallbacks[$locale] = $matches[1];
}
}

View File

@ -127,8 +127,8 @@ class ZookeeperStore implements StoreInterface
// For example: foo/bar will become /foo-bar and /foo/bar will become /-foo-bar
$resource = (string) $key;
if (false !== \strpos($resource, '/')) {
$resource = \strtr($resource, ['/' => '-']).'-'.sha1($resource);
if (false !== strpos($resource, '/')) {
$resource = strtr($resource, ['/' => '-']).'-'.sha1($resource);
}
if ('' === $resource) {

View File

@ -32,7 +32,7 @@ $receiver = new AmqpReceiver($connection, $serializer);
$worker = new Worker($receiver, new class() implements MessageBusInterface {
public function dispatch($envelope): Envelope
{
echo 'Get envelope with message: '.\get_class($envelope->getMessage())."\n";
echo 'Get envelope with message: '.get_class($envelope->getMessage())."\n";
echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), JSON_PRETTY_PRINT));
sleep(30);

View File

@ -114,7 +114,7 @@ class Connection
continue;
}
if (!\is_numeric($arguments[$key])) {
if (!is_numeric($arguments[$key])) {
throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", %s given.', $key, \gettype($arguments[$key])));
}

View File

@ -32,7 +32,7 @@ class StopWhenMemoryUsageIsExceededReceiver implements ReceiverInterface
$this->memoryLimit = $memoryLimit;
$this->logger = $logger;
$this->memoryResolver = $memoryResolver ?: function () {
return \memory_get_usage(true);
return memory_get_usage(true);
};
}

View File

@ -797,7 +797,7 @@ class OptionsResolver implements Options
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
}
$triggerDeprecation = 1 === \func_num_args() || \func_get_arg(1);
$triggerDeprecation = 1 === \func_num_args() || func_get_arg(1);
// Shortcut for resolved options
if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) {

View File

@ -69,6 +69,6 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
*/
public function hasMetadataFor($value)
{
return \is_object($value) || (\is_string($value) && (\class_exists($value) || \interface_exists($value, false)));
return \is_object($value) || (\is_string($value) && (class_exists($value) || interface_exists($value, false)));
}
}

View File

@ -263,7 +263,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
*/
public function supportsDenormalization($data, $type, $format = null)
{
return \class_exists($type) || (\interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type));
return class_exists($type) || (interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type));
}
/**

View File

@ -65,7 +65,7 @@ class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, Se
*/
public function supportsDenormalization($data, $type, $format = null)
{
return \is_subclass_of($type, DenormalizableInterface::class);
return is_subclass_of($type, DenormalizableInterface::class);
}
/**

View File

@ -36,7 +36,7 @@ class ObjectNormalizer extends AbstractObjectNormalizer
public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, callable $objectClassResolver = null, array $defaultContext = [])
{
if (!\class_exists(PropertyAccess::class)) {
if (!class_exists(PropertyAccess::class)) {
throw new LogicException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.');
}

View File

@ -84,7 +84,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
}
if (!($normalizer instanceof NormalizerInterface || $normalizer instanceof DenormalizerInterface)) {
@trigger_error(\sprintf('Passing normalizers ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing normalizers ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class), E_USER_DEPRECATED);
// throw new \InvalidArgumentException(\sprintf('The class "%s" does not implement "%s" or "%s".', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class));
}
}
@ -104,7 +104,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
}
if (!($encoder instanceof EncoderInterface || $encoder instanceof DecoderInterface)) {
@trigger_error(\sprintf('Passing encoders ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($encoder), EncoderInterface::class, DecoderInterface::class), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing encoders ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($encoder), EncoderInterface::class, DecoderInterface::class), E_USER_DEPRECATED);
// throw new \InvalidArgumentException(\sprintf('The class "%s" does not implement "%s" or "%s".', \get_class($normalizer), EncoderInterface::class, DecoderInterface::class));
}
}

View File

@ -32,7 +32,7 @@ class PluralizationRules
*/
public static function get($number, $locale/*, bool $triggerDeprecation = true*/)
{
if (3 > \func_num_args() || \func_get_arg(2)) {
if (3 > \func_num_args() || func_get_arg(2)) {
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
}

View File

@ -430,7 +430,7 @@ EOF
protected function computeFallbackLocales($locale)
{
if (null === $this->parentLocales) {
$parentLocales = \json_decode(\file_get_contents(__DIR__.'/Resources/data/parents.json'), true);
$parentLocales = json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true);
}
$locales = [];

View File

@ -57,7 +57,7 @@ class ClassStub extends ConstStub
if (false !== strpos($identifier, "class@anonymous\0")) {
$this->value = $identifier = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
}, $identifier);
}

View File

@ -283,7 +283,7 @@ class ExceptionCaster
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "class@anonymous\0")) {
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
}, $a[Caster::PREFIX_PROTECTED.'message']);
}

View File

@ -21,7 +21,7 @@ class ProxyManagerCaster
{
public static function castProxy(ProxyInterface $c, array $a, Stub $stub, $isNested)
{
if ($parent = \get_parent_class($c)) {
if ($parent = get_parent_class($c)) {
$stub->class .= ' - '.$parent;
}
$stub->class .= '@proxy';

View File

@ -73,7 +73,7 @@ class VarCloner extends AbstractCloner
}
if ($gk !== $k) {
$fromObjCast = true;
$refs = $vals = \array_values($queue[$i]);
$refs = $vals = array_values($queue[$i]);
break;
}
}
@ -84,7 +84,7 @@ class VarCloner extends AbstractCloner
if ($zvalIsRef = $vals[$k] === $cookie) {
$vals[$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
if ($v instanceof Stub && isset($hardRefs[\spl_object_id($v)])) {
if ($v instanceof Stub && isset($hardRefs[spl_object_id($v)])) {
$vals[$k] = $refs[$k] = $v;
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
@ -94,7 +94,7 @@ class VarCloner extends AbstractCloner
}
$refs[$k] = $vals[$k] = new Stub();
$refs[$k]->value = $v;
$h = \spl_object_id($refs[$k]);
$h = spl_object_id($refs[$k]);
$hardRefs[$h] = &$refs[$k];
$values[$h] = $v;
$vals[$k]->handle = ++$refsCounter;
@ -112,22 +112,22 @@ class VarCloner extends AbstractCloner
if ('' === $v) {
continue 2;
}
if (!\preg_match('//u', $v)) {
if (!preg_match('//u', $v)) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) {
$stub->cut = $cut;
$stub->value = \substr($v, 0, -$cut);
$stub->value = substr($v, 0, -$cut);
} else {
$stub->value = $v;
}
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = \mb_strlen($v, 'UTF-8') - $maxString) {
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_UTF8;
$stub->cut = $cut;
$stub->value = \mb_substr($v, 0, $maxString, 'UTF-8');
$stub->value = mb_substr($v, 0, $maxString, 'UTF-8');
} else {
continue 2;
}
@ -173,7 +173,7 @@ class VarCloner extends AbstractCloner
case \is_object($v):
case $v instanceof \__PHP_Incomplete_Class:
if (empty($objRefs[$h = \spl_object_id($v)])) {
if (empty($objRefs[$h = spl_object_id($v)])) {
$stub = new Stub();
$stub->type = Stub::TYPE_OBJECT;
$stub->class = \get_class($v);
@ -184,7 +184,7 @@ class VarCloner extends AbstractCloner
if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) {
break;
}
$stub->handle = $h = \spl_object_id($stub->value);
$stub->handle = $h = spl_object_id($stub->value);
}
$stub->value = null;
if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
@ -206,7 +206,7 @@ class VarCloner extends AbstractCloner
if (empty($resRefs[$h = (int) $v])) {
$stub = new Stub();
$stub->type = Stub::TYPE_RESOURCE;
if ('Unknown' === $stub->class = @\get_resource_type($v)) {
if ('Unknown' === $stub->class = @get_resource_type($v)) {
$stub->class = 'Closed';
}
$stub->value = $v;

View File

@ -40,7 +40,7 @@ class Exporter
$refs = $values;
foreach ($values as $k => $value) {
if (\is_resource($value)) {
throw new NotInstantiableTypeException(\get_resource_type($value).' resource');
throw new NotInstantiableTypeException(get_resource_type($value).' resource');
}
$refs[$k] = $objectsPool;
@ -115,14 +115,14 @@ class Exporter
goto handle_value;
}
if (\method_exists($class, '__sleep')) {
if (method_exists($class, '__sleep')) {
if (!\is_array($sleep = $value->__sleep())) {
trigger_error('serialize(): __sleep should return an array only containing the names of instance-variables to serialize', E_USER_NOTICE);
$value = null;
goto handle_value;
}
foreach ($sleep as $name) {
if (\property_exists($value, $name) && !$reflector->hasProperty($name)) {
if (property_exists($value, $name) && !$reflector->hasProperty($name)) {
$arrayValue[$name] = $value->$name;
}
}
@ -171,7 +171,7 @@ class Exporter
$objectsPool[$value] = [$id = \count($objectsPool)];
$properties = self::prepare($properties, $objectsPool, $refsPool, $objectsCount, $valueIsStatic);
++$objectsCount;
$objectsPool[$value] = [$id, $class, $properties, \method_exists($class, '__unserialize') ? -$objectsCount : (\method_exists($class, '__wakeup') ? $objectsCount : 0)];
$objectsPool[$value] = [$id, $class, $properties, method_exists($class, '__unserialize') ? -$objectsCount : (method_exists($class, '__wakeup') ? $objectsCount : 0)];
$value = new Reference($id);

View File

@ -65,7 +65,7 @@ class Hydrator
};
}
if (!\class_exists($class) && !\interface_exists($class, false) && !\trait_exists($class, false)) {
if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) {
throw new ClassNotFoundException($class);
}
$classReflector = new \ReflectionClass($class);

View File

@ -65,7 +65,7 @@ class Registry
public static function getClassReflector($class, $instantiableWithoutConstructor = false, $cloneable = null)
{
if (!($isClass = \class_exists($class)) && !\interface_exists($class, false) && !\trait_exists($class, false)) {
if (!($isClass = class_exists($class)) && !interface_exists($class, false) && !trait_exists($class, false)) {
throw new ClassNotFoundException($class);
}
$reflector = new \ReflectionClass($class);
@ -86,14 +86,14 @@ class Registry
$proto = $reflector->newInstanceWithoutConstructor();
$instantiableWithoutConstructor = true;
} catch (\ReflectionException $e) {
$proto = $reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__unserialize')) ? 'C:' : 'O:';
$proto = $reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize')) ? 'C:' : 'O:';
if ('C:' === $proto && !$reflector->getMethod('unserialize')->isInternal()) {
$proto = null;
} elseif (false === $proto = @unserialize($proto.\strlen($class).':"'.$class.'":0:{}')) {
throw new NotInstantiableTypeException($class);
}
}
if (null !== $proto && !$proto instanceof \Throwable && !$proto instanceof \Serializable && !\method_exists($class, '__sleep') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__serialize'))) {
if (null !== $proto && !$proto instanceof \Throwable && !$proto instanceof \Serializable && !method_exists($class, '__sleep') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__serialize'))) {
try {
serialize($proto);
} catch (\Exception $e) {
@ -103,7 +103,7 @@ class Registry
}
if (null === $cloneable) {
if (($proto instanceof \Reflector || $proto instanceof \ReflectionGenerator || $proto instanceof \ReflectionType || $proto instanceof \IteratorIterator || $proto instanceof \RecursiveIteratorIterator) && (!$proto instanceof \Serializable && !\method_exists($proto, '__wakeup') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__unserialize')))) {
if (($proto instanceof \Reflector || $proto instanceof \ReflectionGenerator || $proto instanceof \ReflectionType || $proto instanceof \IteratorIterator || $proto instanceof \RecursiveIteratorIterator) && (!$proto instanceof \Serializable && !method_exists($proto, '__wakeup') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize')))) {
throw new NotInstantiableTypeException($class);
}

View File

@ -213,7 +213,7 @@ class GraphvizDumper implements DumperInterface
*/
protected function escape($value): string
{
return \is_bool($value) ? ($value ? '1' : '0') : \addslashes($value);
return \is_bool($value) ? ($value ? '1' : '0') : addslashes($value);
}
private function addAttributes(array $attributes): string

View File

@ -78,7 +78,7 @@ class StateMachineTest extends TestCase
$net = new StateMachine($definition, null, $dispatcher);
$dispatcher->addListener('workflow.guard', function (GuardEvent $event) {
$event->addTransitionBlocker(new TransitionBlocker(\sprintf('Transition blocker of place %s', $event->getTransition()->getFroms()[0]), 'blocker'));
$event->addTransitionBlocker(new TransitionBlocker(sprintf('Transition blocker of place %s', $event->getTransition()->getFroms()[0]), 'blocker'));
});
$subject = new \stdClass();

View File

@ -91,7 +91,7 @@ EOF;
}
} else {
$leftNumber = '-Inf' === $matches['left'] ? -INF : (float) $matches['left'];
$rightNumber = \is_numeric($matches['right']) ? (float) $matches['right'] : INF;
$rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : INF;
if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber)
&& (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber)
@ -117,7 +117,7 @@ EOF;
$message = sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $id, $locale, $number);
if (\class_exists(InvalidArgumentException::class)) {
if (class_exists(InvalidArgumentException::class)) {
throw new InvalidArgumentException($message);
}