Merge branch '4.3' into 4.4

* 4.3:
  fixed CS
  fixed CS
  fixed CS
  Do not log or call the proxy function when the locale is the same
  Added missing required dependencies on psr/cache and psr/container in symfony/cache-contracts and symfony/service-contracts respectively.
  [HttpClient] fix closing debug stream prematurely
  [Mailer] made code more robust
  Restore compatibility with php 5.5
  fixed sender/recipients in SMTP Envelope
  collect called listeners information only once
  [HttpKernel] Remove TestEventDispatcher.
This commit is contained in:
Fabien Potencier 2019-06-13 13:05:05 +02:00
commit 8787bbc94a
120 changed files with 250 additions and 280 deletions

View File

@ -15,7 +15,7 @@ return PhpCsFixer\Config::create()
'ordered_imports' => true,
'protected_to_private' => false,
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
])

View File

@ -61,7 +61,7 @@ class DoctrineTestHelper
$config = new Configuration();
$config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures']);
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(\sys_get_temp_dir());
$config->setProxyDir(sys_get_temp_dir());
$config->setProxyNamespace('SymfonyTests\Doctrine');
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
$config->setQueryCacheImpl(new ArrayCache());

View File

@ -186,7 +186,7 @@ class UniqueEntityValidator extends ConstraintValidator
return $this->formatValue($value, self::PRETTY_DATE);
}
if (\method_exists($value, '__toString')) {
if (method_exists($value, '__toString')) {
return (string) $value;
}

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

@ -30,17 +30,17 @@ class ClassExistsMock
public static function class_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \class_exists($name, $autoload));
return (bool) (self::$classes[ltrim($name, '\\')] ?? class_exists($name, $autoload));
}
public static function interface_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \interface_exists($name, $autoload));
return (bool) (self::$classes[ltrim($name, '\\')] ?? interface_exists($name, $autoload));
}
public static function trait_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \trait_exists($name, $autoload));
return (bool) (self::$classes[ltrim($name, '\\')] ?? trait_exists($name, $autoload));
}
public static function register($class)

View File

@ -90,9 +90,12 @@ class Configuration
*/
public function tolerates(array $deprecations)
{
$deprecationCounts = array_filter($deprecations, function ($key) {
return false !== strpos($key, 'Count') && false === strpos($key, 'legacy');
}, ARRAY_FILTER_USE_KEY);
$deprecationCounts = [];
foreach ($deprecations as $key => $deprecation) {
if (false !== strpos($key, 'Count') && false === strpos($key, 'legacy')) {
$deprecationCounts[$key] = $deprecation;
}
}
if (array_sum($deprecationCounts) > $this->thresholds['total']) {
return false;

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

@ -46,7 +46,7 @@ class HttpFoundationExtension extends AbstractExtension
$requestContext = null;
if (2 === \func_num_args()) {
$requestContext = \func_get_arg(1);
$requestContext = func_get_arg(1);
if (null !== $requestContext && !$requestContext instanceof RequestContext) {
throw new \TypeError(sprintf('The second argument must be an instance of "%s".', RequestContext::class));
}

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

@ -85,7 +85,7 @@ class UndefinedCallableHandler
private static function onUndefined($name, $type, $component)
{
if (\class_exists(FullStack::class) && isset(self::$fullStackEnable[$component])) {
if (class_exists(FullStack::class) && isset(self::$fullStackEnable[$component])) {
throw new SyntaxError(sprintf('Did you forget to %s? Unknown %s "%s".', self::$fullStackEnable[$component], $type, $name));
}

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

@ -1115,12 +1115,12 @@ class FrameworkExtension extends Extension
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
$rootDir = $container->getParameter('kernel.root_dir');
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
if (\is_dir($dir = $bundle['path'].'/Resources/translations')) {
if (is_dir($dir = $bundle['path'].'/Resources/translations')) {
$dirs[] = $dir;
} else {
$nonExistingDirs[] = $dir;
}
if (\is_dir($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
if (is_dir($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
$dirs[] = $dir;
} else {
@ -1129,7 +1129,7 @@ class FrameworkExtension extends Extension
}
foreach ($config['paths'] as $dir) {
if (\is_dir($dir)) {
if (is_dir($dir)) {
$dirs[] = $transPaths[] = $dir;
} else {
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
@ -1144,13 +1144,13 @@ class FrameworkExtension extends Extension
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
}
if (\is_dir($defaultDir)) {
if (is_dir($defaultDir)) {
$dirs[] = $defaultDir;
} else {
$nonExistingDirs[] = $defaultDir;
}
if (\is_dir($dir = $rootDir.'/Resources/translations')) {
if (is_dir($dir = $rootDir.'/Resources/translations')) {
if ($dir !== $defaultDir) {
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
}
@ -1187,7 +1187,7 @@ class FrameworkExtension extends Extension
$translator->getArgument(4),
[
'resource_files' => $files,
'scanned_directories' => \array_merge($dirs, $nonExistingDirs),
'scanned_directories' => array_merge($dirs, $nonExistingDirs),
]
);

View File

@ -195,7 +195,7 @@ trait WebTestAssertionsTrait
}
if (!$client instanceof KernelBrowser) {
static::fail(\sprintf('A client must be set to make assertions on it. Did you forget to call "%s::createClient()"?', __CLASS__));
static::fail(sprintf('A client must be set to make assertions on it. Did you forget to call "%s::createClient()"?', __CLASS__));
}
return $client;

View File

@ -48,9 +48,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

@ -60,7 +60,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
$item->metadata[CacheItem::METADATA_TAGS] = $value['tags'] ?? [];
if (isset($value['meta'])) {
// For compactness these values are packed, & expiry is offset to reduce size
$v = \unpack('Ve/Nc', $value['meta']);
$v = unpack('Ve/Nc', $value['meta']);
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;
$item->metadata[CacheItem::METADATA_CTIME] = $v['c'];
}
@ -96,16 +96,16 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
if ($metadata) {
// For compactness, expiry and creation duration are packed, using magic numbers as separators
$value['meta'] = \pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME]);
$value['meta'] = pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME]);
}
// Extract tag changes, these should be removed from values in doSave()
$value['tag-operations'] = ['add' => [], 'remove' => []];
$oldTags = $item->metadata[CacheItem::METADATA_TAGS] ?? [];
foreach (\array_diff($value['tags'], $oldTags) as $addedTag) {
foreach (array_diff($value['tags'], $oldTags) as $addedTag) {
$value['tag-operations']['add'][] = $getId($tagPrefix.$addedTag);
}
foreach (\array_diff($oldTags, $value['tags']) as $removedTag) {
foreach (array_diff($oldTags, $value['tags']) as $removedTag) {
$value['tag-operations']['remove'][] = $getId($tagPrefix.$removedTag);
}
@ -236,7 +236,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
}
try {
if ($this->doDelete(\array_values($ids), $tagData)) {
if ($this->doDelete(array_values($ids), $tagData)) {
return true;
}
} catch (\Exception $e) {
@ -271,7 +271,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
}
$tagIds = [];
foreach (\array_unique($tags) as $tag) {
foreach (array_unique($tags) as $tag) {
$tagIds[] = $this->getId(self::TAGS_PREFIX.$tag);
}

View File

@ -126,7 +126,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
}
$valueFile = $itemLink->getRealPath();
if ($valueFile && \file_exists($valueFile)) {
if ($valueFile && file_exists($valueFile)) {
@unlink($valueFile);
}

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

@ -82,7 +82,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
$this->init($redisClient, $namespace, $defaultLifetime, $marshaller);
// Make sure php-redis is 3.1.3 or higher configured for Redis classes
if (!$this->redis instanceof Predis\Client && \version_compare(\phpversion('redis'), '3.1.3', '<')) {
if (!$this->redis instanceof Predis\Client && version_compare(phpversion('redis'), '3.1.3', '<')) {
throw new LogicException('RedisTagAwareAdapter requires php-redis 3.1.3 or higher, alternatively use predis/predis');
}
}
@ -120,7 +120,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
foreach ($results as $id => $result) {
// Skip results of SADD/SREM operations, they'll be 1 or 0 depending on if set value already existed or not
if (\is_numeric($result)) {
if (is_numeric($result)) {
continue;
}
// setEx results
@ -152,7 +152,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
}
foreach ($tagData as $tagId => $idList) {
yield 'sRem' => \array_merge([$tagId], $idList);
yield 'sRem' => array_merge([$tagId], $idList);
}
})->rewind();
@ -178,10 +178,10 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
});
// Flatten generator result from pipeline, ignore keys (tag ids)
$ids = \array_unique(\array_merge(...\iterator_to_array($tagIdSets, false)));
$ids = array_unique(array_merge(...iterator_to_array($tagIdSets, false)));
// Delete cache in chunks to avoid overloading the connection
foreach (\array_chunk($ids, self::BULK_DELETE_LIMIT) as $chunkIds) {
foreach (array_chunk($ids, self::BULK_DELETE_LIMIT) as $chunkIds) {
$this->doDelete($chunkIds);
}

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

@ -786,7 +786,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

@ -250,7 +250,7 @@ final class ProgressBar
*/
public function iterate(iterable $iterable, ?int $max = null): iterable
{
$this->start($max ?? (\is_countable($iterable) ? \count($iterable) : 0));
$this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
foreach ($iterable as $key => $value) {
yield $key => $value;

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

@ -884,7 +884,7 @@ class ProgressBarTest extends TestCase
{
$bar = new ProgressBar($output = $this->getOutputStream());
$this->assertEquals([1, 2], \iterator_to_array($bar->iterate([1, 2])));
$this->assertEquals([1, 2], iterator_to_array($bar->iterate([1, 2])));
rewind($output->getStream());
$this->assertEquals(
@ -900,7 +900,7 @@ class ProgressBarTest extends TestCase
{
$bar = new ProgressBar($output = $this->getOutputStream());
$this->assertEquals([1, 2], \iterator_to_array($bar->iterate((function () {
$this->assertEquals([1, 2], iterator_to_array($bar->iterate((function () {
yield 1;
yield 2;
})())));

View File

@ -172,7 +172,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);
@ -190,7 +190,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));
}
@ -223,22 +223,22 @@ 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]) : '';
}
}
if ($refl->isInterface() && false !== \strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
if ($refl->isInterface() && false !== strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
foreach ($notice as $method) {
$static = '' !== $method[1];
$name = $method[2];
@ -257,7 +257,7 @@ class DebugClassLoader
}
}
$parent = \get_parent_class($class);
$parent = get_parent_class($class);
$parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent);
if ($parent) {
$parentAndOwnInterfaces[$parent] = $parent;
@ -272,17 +272,17 @@ 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 (isset(self::$method[$use])) {
@ -309,7 +309,7 @@ class DebugClassLoader
}
}
if (\trait_exists($class)) {
if (trait_exists($class)) {
return $deprecations;
}
@ -337,7 +337,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);
}
}
@ -365,14 +365,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 +((?(?!callable *\().*?|callable *\(.*\).*?))(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, PREG_SET_ORDER)) {

View File

@ -173,7 +173,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

@ -457,10 +457,10 @@ EOF;
private function addElementToGhost()
{
if (!isset(self::GHOST_ADDONS[\date('m-d')])) {
if (!isset(self::GHOST_ADDONS[date('m-d')])) {
return '';
}
return '<path d="'.self::GHOST_ADDONS[\date('m-d')].'" fill="#fff" fill-opacity="0.6"></path>';
return '<path d="'.self::GHOST_ADDONS[date('m-d')].'" fill="#fff" fill-opacity="0.6"></path>';
}
}

View File

@ -354,7 +354,7 @@ class Definition
if (empty($method)) {
throw new InvalidArgumentException('Method name cannot be empty.');
}
$this->calls[] = 2 < \func_num_args() && \func_get_arg(2) ? [$method, $arguments, true] : [$method, $arguments];
$this->calls[] = 2 < \func_num_args() && func_get_arg(2) ? [$method, $arguments, true] : [$method, $arguments];
return $this;
}

View File

@ -649,7 +649,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

@ -415,7 +415,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

@ -566,7 +566,7 @@ class Crawler implements \Countable, \IteratorAggregate
{
if (!$this->nodes) {
if (0 < \func_num_args()) {
return \func_get_arg(0);
return func_get_arg(0);
}
throw new \InvalidArgumentException('The current node list is empty.');
@ -588,7 +588,7 @@ class Crawler implements \Countable, \IteratorAggregate
{
if (!$this->nodes) {
if (0 < \func_num_args()) {
return \func_get_arg(0);
return func_get_arg(0);
}
throw new \InvalidArgumentException('The current node list is empty.');
@ -1220,7 +1220,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

@ -45,7 +45,7 @@ final class CrawlerSelectorTextContains extends Constraint
return false;
}
return false !== \mb_strpos($crawler->text(), $this->expectedText);
return false !== mb_strpos($crawler->text(), $this->expectedText);
}
/**

View File

@ -401,7 +401,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

@ -140,7 +140,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
}
$currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
$eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
$eventName = 1 < \func_num_args() ? func_get_arg(1) : null;
if (\is_object($event)) {
$eventName = $eventName ?? \get_class($event);
@ -193,7 +193,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
return [];
}
$hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
$hash = 1 <= \func_num_args() && null !== ($request = func_get_arg(0)) ? spl_object_hash($request) : null;
$called = [];
foreach ($this->callStack as $listener) {
list($eventName, $requestHash) = $this->callStack->getInfo();
@ -223,23 +223,23 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
return [];
}
$hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
$hash = 1 <= \func_num_args() && null !== ($request = func_get_arg(0)) ? spl_object_hash($request) : null;
$calledListeners = [];
if (null !== $this->callStack) {
foreach ($this->callStack as $calledListener) {
list(, $requestHash) = $this->callStack->getInfo();
if (null === $hash || $hash === $requestHash) {
$calledListeners[] = $calledListener->getWrappedListener();
}
}
}
$notCalled = [];
foreach ($allListeners as $eventName => $listeners) {
foreach ($listeners as $listener) {
$called = false;
if (null !== $this->callStack) {
foreach ($this->callStack as $calledListener) {
list(, $requestHash) = $this->callStack->getInfo();
if ((null === $hash || $hash === $requestHash) && $calledListener->getWrappedListener() === $listener) {
$called = true;
break;
}
}
}
if (!$called) {
if (!\in_array($listener, $calledListeners, true)) {
if (!$listener instanceof WrappedListener) {
$listener = new WrappedListener($listener, null, $this->stopwatch, $this);
}
@ -258,7 +258,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
*/
public function getOrphanedEvents(/* Request $request = null */): array
{
if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) {
if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) {
return $this->orphanedEvents[spl_object_hash($request)] ?? [];
}

View File

@ -50,7 +50,7 @@ class EventDispatcher implements EventDispatcherInterface
*/
public function dispatch($event/*, string $eventName = null*/)
{
$eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
$eventName = 1 < \func_num_args() ? func_get_arg(1) : null;
if (\is_object($event)) {
$eventName = $eventName ?? \get_class($event);

View File

@ -32,9 +32,9 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
*/
public function dispatch($event/*, string $eventName = null*/)
{
$eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
$eventName = 1 < \func_num_args() ? func_get_arg(1) : null;
if (\is_scalar($event)) {
if (is_scalar($event)) {
// deprecated
$swap = $event;
$event = $eventName ?? new Event();

View File

@ -53,7 +53,7 @@ final class LegacyEventDispatcherProxy implements EventDispatcherInterface
*/
public function dispatch($event/*, string $eventName = null*/)
{
$eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
$eventName = 1 < \func_num_args() ? func_get_arg(1) : null;
if (\is_object($event)) {
$eventName = $eventName ?? \get_class($event);

View File

@ -744,15 +744,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

@ -174,7 +174,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;
}
@ -190,7 +190,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;
}
@ -212,7 +212,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;
}
@ -234,7 +234,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;
}
@ -258,7 +258,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;
}
@ -282,7 +282,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

@ -61,7 +61,7 @@ class SplFileInfo extends \SplFileInfo
{
$filename = $this->getFilename();
return \pathinfo($filename, PATHINFO_FILENAME);
return pathinfo($filename, PATHINFO_FILENAME);
}
/**

View File

@ -61,7 +61,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
$this->name = $name;
$this->options = $options;
if (\preg_match('/^([^a-z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (preg_match('/^([^a-z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (isset($matches[1])) {
@trigger_error(sprintf('Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), E_USER_DEPRECATED);
}

View File

@ -236,7 +236,7 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
return;
}
$groupLabels = \is_array($groupLabels) ? \array_map('strval', $groupLabels) : [(string) $groupLabels];
$groupLabels = \is_array($groupLabels) ? array_map('strval', $groupLabels) : [(string) $groupLabels];
foreach ($groupLabels as $groupLabel) {
// Initialize the group views if necessary. Unnecessarily built group

View File

@ -109,7 +109,7 @@ class CachingHttpClient implements HttpClientInterface
{
if ($responses instanceof ResponseInterface) {
$responses = [$responses];
} elseif (!\is_iterable($responses)) {
} elseif (!is_iterable($responses)) {
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of ResponseInterface objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
}

View File

@ -284,7 +284,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
{
if ($responses instanceof CurlResponse) {
$responses = [$responses];
} elseif (!\is_iterable($responses)) {
} elseif (!is_iterable($responses)) {
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of CurlResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
}

View File

@ -200,7 +200,7 @@ trait HttpClientTrait
if (\is_int($name)) {
[$name, $values] = explode(':', $values, 2);
$values = [ltrim($values)];
} elseif (!\is_iterable($values)) {
} elseif (!is_iterable($values)) {
$values = (array) $values;
}

View File

@ -78,7 +78,7 @@ class MockHttpClient implements HttpClientInterface
{
if ($responses instanceof ResponseInterface) {
$responses = [$responses];
} elseif (!\is_iterable($responses)) {
} elseif (!is_iterable($responses)) {
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of MockResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
}

View File

@ -220,7 +220,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
{
if ($responses instanceof NativeResponse) {
$responses = [$responses];
} elseif (!\is_iterable($responses)) {
} elseif (!is_iterable($responses)) {
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of NativeResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
}

View File

@ -168,8 +168,8 @@ final class CurlResponse implements ResponseInterface
rewind($this->debugBuffer);
$info['debug'] = stream_get_contents($this->debugBuffer);
curl_setopt($this->handle, CURLOPT_VERBOSE, false);
fclose($this->debugBuffer);
$this->debugBuffer = null;
rewind($this->debugBuffer);
ftruncate($this->debugBuffer, 0);
$this->finalInfo = $info;
}
}

View File

@ -44,7 +44,7 @@ class MockResponse implements ResponseInterface
*/
public function __construct($body = '', array $info = [])
{
$this->body = \is_iterable($body) ? $body : (string) $body;
$this->body = is_iterable($body) ? $body : (string) $body;
$this->info = $info + $this->info;
if (!isset($info['response_headers'])) {

View File

@ -232,7 +232,7 @@ class HttpClientTraitTest extends TestCase
public function provideFingerprints()
{
foreach (['md5', 'sha1', 'sha256'] as $algo) {
$hash = \hash($algo, $algo);
$hash = hash($algo, $algo);
yield [$hash, [$algo => $hash]];
}

View File

@ -681,7 +681,7 @@ class PdoSessionHandler extends AbstractSessionHandler
switch ($this->driver) {
case 'mysql':
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
$lockId = \substr($sessionId, 0, 64);
$lockId = substr($sessionId, 0, 64);
// should we handle the return value? 0 on timeout, null on error
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');

View File

@ -47,7 +47,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
'token' => $response->headers->get('X-Debug-Token'),
'start_time' => $startTime * 1000,
'events' => [],
'stopwatch_installed' => \class_exists(Stopwatch::class, false),
'stopwatch_installed' => class_exists(Stopwatch::class, false),
];
}

View File

@ -132,12 +132,12 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
$maxAge = null;
$sMaxage = null;
if (\is_numeric($this->ageDirectives['max-age'])) {
if (is_numeric($this->ageDirectives['max-age'])) {
$maxAge = $this->ageDirectives['max-age'] + $this->age;
$response->headers->addCacheControlDirective('max-age', $maxAge);
}
if (\is_numeric($this->ageDirectives['s-maxage'])) {
if (is_numeric($this->ageDirectives['s-maxage'])) {
$sMaxage = $this->ageDirectives['s-maxage'] + $this->age;
if ($maxAge !== $sMaxage) {
@ -145,7 +145,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
}
}
if (\is_numeric($this->ageDirectives['expires'])) {
if (is_numeric($this->ageDirectives['expires'])) {
$date = clone $response->getDate();
$date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
$response->setExpires($date);

View File

@ -52,6 +52,6 @@ class TimeDataCollectorTest extends TestCase
$c->collect($request, new Response());
$this->assertEquals(123456000, $c->getStartTime());
$this->assertSame(\class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
$this->assertSame(class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
}
}

View File

@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Fixtures;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
class TestEventDispatcher extends TraceableEventDispatcher
{
public function getCalledListeners()
{
return ['foo'];
}
public function getNotCalledListeners()
{
return ['bar'];
}
public function reset()
{
}
public function getOrphanedEvents()
{
return [];
}
}

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

@ -58,7 +58,7 @@ class StoreFactory
return new FlockStore(substr($connection, 8));
case 'semaphore' === $connection:
return new SemaphoreStore();
case \class_exists(AbstractAdapter::class) && preg_match('#^[a-z]++://#', $connection):
case class_exists(AbstractAdapter::class) && preg_match('#^[a-z]++://#', $connection):
return static::createStore(AbstractAdapter::createConnection($connection));
default:
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', $connection));

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

@ -38,23 +38,23 @@ class StoreFactoryTest extends TestCase
public function validConnections()
{
if (\class_exists(\Redis::class)) {
if (class_exists(\Redis::class)) {
yield [$this->createMock(\Redis::class), RedisStore::class];
}
if (\class_exists(RedisProxy::class)) {
if (class_exists(RedisProxy::class)) {
yield [$this->createMock(RedisProxy::class), RedisStore::class];
}
yield [new \Predis\Client(), RedisStore::class];
if (\class_exists(\Memcached::class)) {
if (class_exists(\Memcached::class)) {
yield [new \Memcached(), MemcachedStore::class];
}
if (\class_exists(\Zookeeper::class)) {
if (class_exists(\Zookeeper::class)) {
yield [$this->createMock(\Zookeeper::class), ZookeeperStore::class];
}
if (\extension_loaded('sysvsem')) {
yield ['semaphore', SemaphoreStore::class];
}
if (\class_exists(\Memcached::class) && \class_exists(AbstractAdapter::class)) {
if (class_exists(\Memcached::class) && class_exists(AbstractAdapter::class)) {
yield ['memcached://server.com', MemcachedStore::class];
}

View File

@ -76,7 +76,7 @@ class SesTransport extends AbstractApiTransport
if ($email->getAttachments()) {
return [
'Action' => 'SendRawEmail',
'RawMessage.Data' => \base64_encode($email->toString()),
'RawMessage.Data' => base64_encode($email->toString()),
];
}

View File

@ -56,7 +56,7 @@ class SesTransport extends AbstractHttpTransport
],
'body' => [
'Action' => 'SendRawEmail',
'RawMessage.Data' => \base64_encode($message->toString()),
'RawMessage.Data' => base64_encode($message->toString()),
],
]);

View File

@ -27,7 +27,7 @@ class SesTransport extends EsmtpTransport
*/
public function __construct(string $username, string $password, string $region = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{
parent::__construct(\sprintf('email-smtp.%s.amazonaws.com', $region ?: 'eu-west-1'), 587, 'tls', null, $dispatcher, $logger);
parent::__construct(sprintf('email-smtp.%s.amazonaws.com', $region ?: 'eu-west-1'), 587, 'tls', null, $dispatcher, $logger);
$this->setUsername($username);
$this->setPassword($password);

View File

@ -67,7 +67,7 @@ class SendgridTransport extends AbstractApiTransport
}
$personalization = [
'to' => \array_map($addressStringifier, $this->getRecipients($email, $envelope)),
'to' => array_map($addressStringifier, $this->getRecipients($email, $envelope)),
'subject' => $email->getSubject(),
];
if ($emails = array_map($addressStringifier, $email->getCc())) {

View File

@ -47,7 +47,7 @@ final class DelayedSmtpEnvelope extends SmtpEnvelope
return parent::getSender();
}
return self::getSenderFromHeaders($this->message->getHeaders());
return new Address(self::getSenderFromHeaders($this->message->getHeaders())->getAddress());
}
public function setRecipients(array $recipients): void
@ -74,7 +74,9 @@ final class DelayedSmtpEnvelope extends SmtpEnvelope
$recipients = [];
foreach (['to', 'cc', 'bcc'] as $name) {
foreach ($headers->getAll($name) as $header) {
$recipients = array_merge($recipients, $header->getAddresses());
foreach ($header->getAddresses() as $address) {
$recipients[] = new Address($address->getAddress());
}
}
}

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Mailer;
use Symfony\Component\Mailer\Exception\InvalidArgumentException;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\NamedAddress;
use Symfony\Component\Mime\RawMessage;
/**
@ -42,7 +41,7 @@ class SmtpEnvelope
public function setSender(Address $sender): void
{
$this->sender = $sender instanceof NamedAddress ? new Address($sender->getAddress()) : $sender;
$this->sender = new Address($sender->getAddress());
}
public function getSender(): Address
@ -50,6 +49,9 @@ class SmtpEnvelope
return $this->sender;
}
/**
* @param Address[] $recipients
*/
public function setRecipients(array $recipients): void
{
if (!$recipients) {
@ -58,12 +60,10 @@ class SmtpEnvelope
$this->recipients = [];
foreach ($recipients as $recipient) {
if ($recipient instanceof NamedAddress) {
$recipient = new Address($recipient->getAddress());
} elseif (!$recipient instanceof Address) {
if (!$recipient instanceof Address) {
throw new InvalidArgumentException(sprintf('A recipient must be an instance of "%s" (got "%s").', Address::class, \is_object($recipient) ? \get_class($recipient) : \gettype($recipient)));
}
$this->recipients[] = $recipient;
$this->recipients[] = new Address($recipient->getAddress());
}
}

View File

@ -17,7 +17,6 @@ use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Header\Headers;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\NamedAddress;
use Symfony\Component\Mime\RawMessage;
class SmtpEnvelopeTest extends TestCase
{
@ -54,19 +53,19 @@ class SmtpEnvelopeTest extends TestCase
public function testSenderFromHeaders()
{
$headers = new Headers();
$headers->addPathHeader('Return-Path', 'return@symfony.com');
$headers->addPathHeader('Return-Path', new NamedAddress('return@symfony.com', 'return'));
$headers->addMailboxListHeader('To', ['from@symfony.com']);
$e = SmtpEnvelope::create(new Message($headers));
$this->assertEquals('return@symfony.com', $e->getSender()->getAddress());
$headers = new Headers();
$headers->addMailboxHeader('Sender', 'sender@symfony.com');
$headers->addMailboxHeader('Sender', new NamedAddress('sender@symfony.com', 'sender'));
$headers->addMailboxListHeader('To', ['from@symfony.com']);
$e = SmtpEnvelope::create(new Message($headers));
$this->assertEquals('sender@symfony.com', $e->getSender()->getAddress());
$headers = new Headers();
$headers->addMailboxListHeader('From', ['from@symfony.com', 'some@symfony.com']);
$headers->addMailboxListHeader('From', [new NamedAddress('from@symfony.com', 'from'), 'some@symfony.com']);
$headers->addMailboxListHeader('To', ['from@symfony.com']);
$e = SmtpEnvelope::create(new Message($headers));
$this->assertEquals('from@symfony.com', $e->getSender()->getAddress());
@ -77,7 +76,7 @@ class SmtpEnvelopeTest extends TestCase
$headers = new Headers();
$headers->addMailboxListHeader('To', ['from@symfony.com']);
$e = SmtpEnvelope::create($message = new Message($headers));
$message->getHeaders()->addMailboxListHeader('From', ['from@symfony.com']);
$message->getHeaders()->addMailboxListHeader('From', [new NamedAddress('from@symfony.com', 'from')]);
$this->assertEquals('from@symfony.com', $e->getSender()->getAddress());
}
@ -85,9 +84,9 @@ class SmtpEnvelopeTest extends TestCase
{
$headers = new Headers();
$headers->addPathHeader('Return-Path', 'return@symfony.com');
$headers->addMailboxListHeader('To', ['to@symfony.com']);
$headers->addMailboxListHeader('Cc', ['cc@symfony.com']);
$headers->addMailboxListHeader('Bcc', ['bcc@symfony.com']);
$headers->addMailboxListHeader('To', [new NamedAddress('to@symfony.com', 'to')]);
$headers->addMailboxListHeader('Cc', [new NamedAddress('cc@symfony.com', 'cc')]);
$headers->addMailboxListHeader('Bcc', [new NamedAddress('bcc@symfony.com', 'bcc')]);
$e = SmtpEnvelope::create(new Message($headers));
$this->assertEquals([new Address('to@symfony.com'), new Address('cc@symfony.com'), new Address('bcc@symfony.com')], $e->getRecipients());
}

View File

@ -68,9 +68,9 @@ class Transport
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a mailer name.', $dsn));
}
$user = \urldecode($parsedDsn['user'] ?? '');
$pass = \urldecode($parsedDsn['pass'] ?? '');
\parse_str($parsedDsn['query'] ?? '', $query);
$user = urldecode($parsedDsn['user'] ?? '');
$pass = urldecode($parsedDsn['pass'] ?? '');
parse_str($parsedDsn['query'] ?? '', $query);
switch ($parsedDsn['host']) {
case 'null':

View File

@ -93,7 +93,7 @@ abstract class AbstractTransport implements TransportInterface
*/
protected function stringifyAddresses(array $addresses): array
{
return \array_map(function (Address $a) {
return array_map(function (Address $a) {
return $a->toString();
}, $addresses);
}

View File

@ -61,8 +61,8 @@ abstract class AbstractApiTransport extends AbstractTransport
protected function getRecipients(Email $email, SmtpEnvelope $envelope): array
{
return \array_filter($envelope->getRecipients(), function (Address $address) use ($email) {
return false === \in_array($address, \array_merge($email->getCc(), $email->getBcc()), true);
return array_filter($envelope->getRecipients(), function (Address $address) use ($email) {
return false === \in_array($address, array_merge($email->getCc(), $email->getBcc()), true);
});
}
}

View File

@ -88,7 +88,7 @@ final class Envelope
$cloned = clone $this;
foreach ($cloned->stamps as $class => $stamps) {
if ($class === $type || \is_subclass_of($class, $type)) {
if ($class === $type || is_subclass_of($class, $type)) {
unset($cloned->stamps[$class]);
}
}

View File

@ -61,7 +61,7 @@ class SendFailedMessageToFailureTransportListener implements EventSubscriberInte
$throwable = $throwable->getNestedExceptions()[0];
}
$flattenedException = \class_exists(FlattenException::class) ? FlattenException::createFromThrowable($throwable) : null;
$flattenedException = class_exists(FlattenException::class) ? FlattenException::createFromThrowable($throwable) : null;
$envelope = $envelope->withoutAll(ReceivedStamp::class)
->withoutAll(TransportMessageIdStamp::class)
->with(new SentToFailureTransportStamp($event->getReceiverName()))

View File

@ -38,7 +38,7 @@ class StackMiddleware implements MiddlewareInterface, StackInterface
$this->stack->iterator = $middlewareIterator;
} elseif ($middlewareIterator instanceof MiddlewareInterface) {
$this->stack->stack[] = $middlewareIterator;
} elseif (!\is_iterable($middlewareIterator)) {
} elseif (!is_iterable($middlewareIterator)) {
throw new \TypeError(sprintf('Argument 1 passed to %s() must be iterable of %s, %s given.', __METHOD__, MiddlewareInterface::class, \is_object($middlewareIterator) ? \get_class($middlewareIterator) : \gettype($middlewareIterator)));
} else {
$this->stack->iterator = (function () use ($middlewareIterator) {

View File

@ -35,7 +35,7 @@ $retryStrategy = new MultiplierRetryStrategy(3, 0);
$worker = new Worker(['the_receiver' => $receiver], new class() implements MessageBusInterface {
public function dispatch($envelope, array $stamps = []): 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

@ -30,7 +30,7 @@ class ConnectionTest extends TestCase
$stmt = $this->getStatementMock([
'id' => 1,
'body' => '{"message":"Hi"}',
'headers' => \json_encode(['type' => DummyMessage::class]),
'headers' => json_encode(['type' => DummyMessage::class]),
]);
$driverConnection

View File

@ -80,7 +80,7 @@ class DoctrineReceiverTest extends TestCase
$connection->method('findAll')->with(50)->willReturn([$doctrineEnvelope1, $doctrineEnvelope2]);
$receiver = new DoctrineReceiver($connection, $serializer);
$actualEnvelopes = \iterator_to_array($receiver->all(50));
$actualEnvelopes = iterator_to_array($receiver->all(50));
$this->assertCount(2, $actualEnvelopes);
$this->assertEquals(new DummyMessage('Hi'), $actualEnvelopes[0]->getMessage());
}

View File

@ -156,7 +156,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

@ -123,7 +123,7 @@ class Connection
$this->executeQuery($queryBuilder->getSQL(), [
':body' => $body,
':headers' => \json_encode($headers),
':headers' => json_encode($headers),
':queue_name' => $this->configuration['queue_name'],
':created_at' => self::formatDateTime($now),
':available_at' => self::formatDateTime($availableAt),
@ -155,7 +155,7 @@ class Connection
return null;
}
$doctrineEnvelope['headers'] = \json_decode($doctrineEnvelope['headers'], true);
$doctrineEnvelope['headers'] = json_decode($doctrineEnvelope['headers'], true);
$queryBuilder = $this->driverConnection->createQueryBuilder()
->update($this->configuration['table_name'])

View File

@ -124,7 +124,7 @@ class Connection
}
foreach ($messages[$this->stream] ?? [] as $key => $message) {
$redisEnvelope = \json_decode($message['message'], true);
$redisEnvelope = json_decode($message['message'], true);
return [
'id' => $key,

View File

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

View File

@ -846,7 +846,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

@ -110,7 +110,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
}
// Calling rawurlencode escapes special characters not allowed in PSR-6's keys
$encodedMethod = \rawurlencode($method);
$encodedMethod = rawurlencode($method);
if (\array_key_exists($encodedMethod, $this->arrayCache) && \array_key_exists($serializedArguments, $this->arrayCache[$encodedMethod])) {
return $this->arrayCache[$encodedMethod][$serializedArguments];
}

View File

@ -173,7 +173,7 @@ abstract class AbstractToken implements TokenInterface
{
$serialized = $this->__serialize();
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
if (null === $isCalledFromOverridingMethod = \func_num_args() ? func_get_arg(0) : null) {
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
}

View File

@ -51,7 +51,7 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
return true;
}
if (\class_exists('ParagonIE_Sodium_Compat') && \method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
}
@ -91,8 +91,8 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded);
}
if (\function_exists('sodium_crypto_pwhash_str_verify')) {
$valid = !$this->isPasswordTooLong($raw) && \sodium_crypto_pwhash_str_verify($encoded, $raw);
\sodium_memzero($raw);
$valid = !$this->isPasswordTooLong($raw) && sodium_crypto_pwhash_str_verify($encoded, $raw);
sodium_memzero($raw);
return $valid;
}
@ -113,12 +113,12 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
private function encodePasswordSodiumFunction($raw)
{
$hash = \sodium_crypto_pwhash_str(
$hash = sodium_crypto_pwhash_str(
$raw,
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
);
\sodium_memzero($raw);
sodium_memzero($raw);
return $hash;
}

View File

@ -48,7 +48,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti
public static function isSupported(): bool
{
if (\class_exists('ParagonIE_Sodium_Compat') && \method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
}
@ -65,7 +65,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti
}
if (\function_exists('sodium_crypto_pwhash_str')) {
return \sodium_crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit);
return sodium_crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit);
}
if (\extension_loaded('libsodium')) {
@ -90,7 +90,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti
}
if (\function_exists('sodium_crypto_pwhash_str_verify')) {
return \sodium_crypto_pwhash_str_verify($encoded, $raw);
return sodium_crypto_pwhash_str_verify($encoded, $raw);
}
if (\extension_loaded('libsodium')) {

View File

@ -69,7 +69,7 @@ class AuthenticationException extends RuntimeException
{
$serialized = $this->__serialize();
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
if (null === $isCalledFromOverridingMethod = \func_num_args() ? func_get_arg(0) : null) {
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
}

View File

@ -97,7 +97,7 @@ class SimpleFormAuthenticationListener extends AbstractAuthenticationListener
$password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']);
}
if (!\is_string($username) && (!\is_object($username) || !\method_exists($username, '__toString'))) {
if (!\is_string($username) && (!\is_object($username) || !method_exists($username, '__toString'))) {
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username)));
}

View File

@ -85,7 +85,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL
$password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']);
}
if (!\is_string($username) && (!\is_object($username) || !\method_exists($username, '__toString'))) {
if (!\is_string($username) && (!\is_object($username) || !method_exists($username, '__toString'))) {
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username)));
}

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

@ -312,7 +312,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));
}
/**
@ -567,7 +567,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
protected function createChildContext(array $parentContext, $attribute/*, ?string $format */)
{
if (\func_num_args() >= 3) {
$format = \func_get_arg(2);
$format = func_get_arg(2);
} else {
@trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
$format = null;

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));
}
}

Some files were not shown because too many files have changed in this diff Show More