Merge branch '4.3' into 4.4
* 4.3: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash Revert "bug #33092 [DependencyInjection] Improve an exception message (fabpot)"
This commit is contained in:
commit
225bf41e3b
@ -127,6 +127,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
||||
|
||||
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,6 +148,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,6 +163,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getMetadata($class)
|
||||
@ -180,6 +186,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
||||
// not an entity or mapped super class, using Doctrine ORM 2.2
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function getRealClass(string $class): string
|
||||
|
@ -160,6 +160,8 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
|
||||
return $doctrineChoiceLoader;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
$choiceName = function (Options $options) {
|
||||
@ -171,6 +173,7 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
}
|
||||
|
||||
// Otherwise, an incrementing integer is used as name automatically
|
||||
return null;
|
||||
};
|
||||
|
||||
// The choices are always indexed by ID (see "choices" normalizer
|
||||
@ -184,6 +187,7 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
}
|
||||
|
||||
// Otherwise, an incrementing integer is used as value automatically
|
||||
return null;
|
||||
};
|
||||
|
||||
$emNormalizer = function (Options $options, $em) {
|
||||
|
@ -168,6 +168,8 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
||||
return $builtinType ? [new Type($builtinType, $nullable)] : null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ class DoctrineFooType extends Type
|
||||
public function convertToDatabaseValue($value, AbstractPlatform $platform)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if (!$value instanceof Foo) {
|
||||
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
||||
@ -66,7 +66,7 @@ class DoctrineFooType extends Type
|
||||
public function convertToPHPValue($value, AbstractPlatform $platform)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if (!\is_string($value)) {
|
||||
throw ConversionException::conversionFailed($value, self::NAME);
|
||||
|
@ -26,6 +26,8 @@ class ClockMock
|
||||
}
|
||||
|
||||
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function time()
|
||||
@ -55,6 +57,8 @@ class ClockMock
|
||||
}
|
||||
|
||||
self::$now += $us / 1000000;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function microtime($asFloat = false)
|
||||
|
@ -104,6 +104,8 @@ class DeprecationErrorHandler
|
||||
}
|
||||
|
||||
$deprecations[] = [error_reporting(), $msg, $file];
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
register_shutdown_function(function () use ($outputFile, &$deprecations) {
|
||||
@ -122,7 +124,7 @@ class DeprecationErrorHandler
|
||||
|
||||
$deprecation = new Deprecation($msg, debug_backtrace(), $file);
|
||||
if ($deprecation->isMuted()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$group = 'other';
|
||||
|
||||
@ -161,6 +163,8 @@ class DeprecationErrorHandler
|
||||
}
|
||||
|
||||
++$this->deprecations[$group.'Count'];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,11 +91,7 @@ class CoverageListenerTrait
|
||||
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
|
||||
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
|
||||
|
||||
if (!class_exists($sutFqcn)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $sutFqcn;
|
||||
return class_exists($sutFqcn) ? $sutFqcn : null;
|
||||
}
|
||||
|
||||
public function __sleep()
|
||||
|
@ -320,6 +320,8 @@ class SymfonyTestsListenerTrait
|
||||
$msg = 'Unsilenced deprecation: '.$msg;
|
||||
}
|
||||
$this->gatheredDeprecations[] = $msg;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +187,7 @@ $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
|
||||
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
|
||||
|
||||
if ($PHPUNIT_VERSION < 8.0) {
|
||||
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
|
||||
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
|
||||
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
|
||||
$argv[] = '--do-not-cache-result';
|
||||
++$argc;
|
||||
|
@ -46,7 +46,7 @@ if (class_exists(Version::class) && version_compare(\defined(Version::class.'::V
|
||||
$functionLoader = $functionLoader[0];
|
||||
}
|
||||
if (!\is_object($functionLoader)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if ($functionLoader instanceof ClassLoader) {
|
||||
return $functionLoader;
|
||||
@ -57,6 +57,8 @@ if (class_exists(Version::class) && version_compare(\defined(Version::class.'::V
|
||||
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
|
||||
return $getComposerClassLoader($functionLoader->getClassLoader());
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
$classLoader = null;
|
||||
|
@ -83,9 +83,8 @@ class AppVariable
|
||||
}
|
||||
|
||||
$user = $token->getUser();
|
||||
if (\is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
return \is_object($user) ? $user : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,16 +308,16 @@ EOF
|
||||
return $entity;
|
||||
}
|
||||
if ('tests' === $type) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if ('functions' === $type || 'filters' === $type) {
|
||||
$cb = $entity->getCallable();
|
||||
if (null === $cb) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if (\is_array($cb)) {
|
||||
if (!method_exists($cb[0], $cb[1])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
||||
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
|
||||
@ -356,6 +356,8 @@ EOF
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getPrettyMetadata(string $type, $entity, bool $decorated)
|
||||
@ -390,6 +392,8 @@ EOF
|
||||
if ('filters' === $type) {
|
||||
return $meta ? '('.implode(', ', $meta).')' : '';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function findWrongBundleOverrides(): array
|
||||
|
@ -62,7 +62,7 @@ class DumpExtension extends AbstractExtension
|
||||
public function dump(Environment $env, $context)
|
||||
{
|
||||
if (!$env->isDebug()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (2 === \func_num_args()) {
|
||||
|
@ -72,6 +72,8 @@ class UndefinedCallableHandler
|
||||
}
|
||||
|
||||
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function onUndefinedFunction($name)
|
||||
@ -81,6 +83,8 @@ class UndefinedCallableHandler
|
||||
}
|
||||
|
||||
self::onUndefined($name, 'function', self::$functionComponents[$name]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function onUndefined($name, $type, $component)
|
||||
|
@ -86,7 +86,7 @@ EOF
|
||||
'For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>config:dump-reference FrameworkBundle profiler.matcher</comment> to dump the <comment>framework.profiler.matcher</comment> configuration)',
|
||||
]);
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$extension = $this->findExtension($name);
|
||||
@ -129,5 +129,7 @@ EOF
|
||||
}
|
||||
|
||||
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,8 @@ EOF
|
||||
}
|
||||
|
||||
$io->newLine();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getFileLink(string $class): string
|
||||
|
@ -113,5 +113,7 @@ EOF
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ EOF
|
||||
if (!\count($operation->getDomains())) {
|
||||
$errorIo->warning('No translation messages were found.');
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$resultMessage = 'Translation files were successfully updated';
|
||||
@ -301,6 +301,8 @@ EOF
|
||||
}
|
||||
|
||||
$errorIo->success($resultMessage.'.');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function filterCatalogue(MessageCatalogue $catalogue, string $domain): MessageCatalogue
|
||||
|
@ -143,7 +143,9 @@ class JsonDescriptor extends Descriptor
|
||||
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
|
||||
{
|
||||
if (!$builder) {
|
||||
return $this->writeData($this->getContainerAliasData($alias), $options);
|
||||
$this->writeData($this->getContainerAliasData($alias), $options);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->writeData(
|
||||
|
@ -253,7 +253,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
|
||||
|
||||
if (!isset($options['id'])) {
|
||||
return $this->write($output);
|
||||
$this->write($output);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));
|
||||
|
@ -387,7 +387,7 @@ class TextDescriptor extends Descriptor
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
|
||||
$this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,9 @@ class XmlDescriptor extends Descriptor
|
||||
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
|
||||
|
||||
if (!$builder) {
|
||||
return $this->writeDocument($dom);
|
||||
$this->writeDocument($dom);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
|
||||
|
@ -49,15 +49,12 @@ class GlobalVariables
|
||||
public function getUser()
|
||||
{
|
||||
if (!$token = $this->getToken()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = $token->getUser();
|
||||
if (!\is_object($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $user;
|
||||
return \is_object($user) ? $user : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,9 +62,7 @@ class GlobalVariables
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
if ($this->container->has('request_stack')) {
|
||||
return $this->container->get('request_stack')->getCurrentRequest();
|
||||
}
|
||||
return $this->container->has('request_stack') ? $this->container->get('request_stack')->getCurrentRequest() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ class CodeHelper extends Helper
|
||||
* @param string $file A file path
|
||||
* @param int $line The selected line number
|
||||
*
|
||||
* @return string An HTML string
|
||||
* @return string|null An HTML string
|
||||
*/
|
||||
public function fileExcerpt($file, $line)
|
||||
{
|
||||
@ -144,6 +144,8 @@ class CodeHelper extends Helper
|
||||
|
||||
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,12 +39,14 @@ class StopwatchHelper extends Helper
|
||||
|
||||
public function __call($method, $arguments = [])
|
||||
{
|
||||
if (null !== $this->stopwatch) {
|
||||
if (method_exists($this->stopwatch, $method)) {
|
||||
return $this->stopwatch->{$method}(...$arguments);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||
if (null === $this->stopwatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method_exists($this->stopwatch, $method)) {
|
||||
return $this->stopwatch->{$method}(...$arguments);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('property_accessor');
|
||||
|
||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
||||
return $this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
$this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = $container->getDefinition('cache.property_access');
|
||||
@ -112,7 +114,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
|
||||
|
||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
||||
return $this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
$this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = $container->getDefinition('cache.property_access');
|
||||
|
@ -162,6 +162,8 @@ EOF
|
||||
}
|
||||
|
||||
$errorIo->success('Password encoding succeeded');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,9 +98,7 @@ class ProfilerControllerTest extends TestCase
|
||||
->expects($this->exactly(2))
|
||||
->method('loadProfile')
|
||||
->willReturnCallback(function ($token) {
|
||||
if ('found' == $token) {
|
||||
return new Profile($token);
|
||||
}
|
||||
return 'found' == $token ? new Profile($token) : null;
|
||||
})
|
||||
;
|
||||
|
||||
|
@ -163,5 +163,7 @@ EOF
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -102,5 +102,7 @@ EOF
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -76,5 +76,7 @@ EOF
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class WebServerConfig
|
||||
return gethostbyname($localHostname).':'.$this->port;
|
||||
}
|
||||
|
||||
private function findFrontController(string $documentRoot, string $env)
|
||||
private function findFrontController(string $documentRoot, string $env): ?string
|
||||
{
|
||||
$fileNames = $this->getFrontControllerFileNames($env);
|
||||
|
||||
@ -128,14 +128,16 @@ class WebServerConfig
|
||||
return $fileName;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getFrontControllerFileNames(string $env)
|
||||
private function getFrontControllerFileNames(string $env): array
|
||||
{
|
||||
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
|
||||
}
|
||||
|
||||
private function findBestPort()
|
||||
private function findBestPort(): int
|
||||
{
|
||||
$port = 8000;
|
||||
while (false !== $fp = @fsockopen($this->hostname, $port, $errno, $errstr, 1)) {
|
||||
|
@ -60,6 +60,8 @@ class CookieJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,6 +183,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
||||
foreach ($this->getItems([$key]) as $item) {
|
||||
return $item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ trait ArrayTrait
|
||||
$message = sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage());
|
||||
CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]);
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
// Keep value serialized if it contains any objects or any internal references
|
||||
if ('C' === $serialized[0] || 'O' === $serialized[0] || preg_match('/;[OCRr]:[1-9]/', $serialized)) {
|
||||
|
@ -396,7 +396,12 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
||||
}
|
||||
|
||||
if (!isset($this->children[$k])) {
|
||||
throw new \RuntimeException('merge() expects a normalized config array.');
|
||||
if (!$this->ignoreExtraKeys || $this->removeExtraKeys) {
|
||||
throw new \RuntimeException('merge() expects a normalized config array.');
|
||||
}
|
||||
|
||||
$leftSide[$k] = $v;
|
||||
continue;
|
||||
}
|
||||
|
||||
$leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v);
|
||||
|
@ -296,5 +296,7 @@ class XmlReferenceDumper
|
||||
if (\is_array($value)) {
|
||||
return implode(',', $value);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -166,5 +166,7 @@ abstract class FileLoader extends Loader
|
||||
throw new LoaderLoadException($resource, $sourceResource, null, $e, $type);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -255,4 +255,66 @@ class ArrayNodeTest extends TestCase
|
||||
restore_error_handler();
|
||||
$this->assertTrue($deprecationTriggered, '->finalize() should trigger if the deprecated node is set');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataWithIncludedExtraKeys
|
||||
*/
|
||||
public function testMergeWithoutIgnoringExtraKeys($prenormalizeds, $merged)
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('merge() expects a normalized config array.');
|
||||
$node = new ArrayNode('root');
|
||||
$node->addChild(new ScalarNode('foo'));
|
||||
$node->addChild(new ScalarNode('bar'));
|
||||
$node->setIgnoreExtraKeys(false);
|
||||
|
||||
$r = new \ReflectionMethod($node, 'mergeValues');
|
||||
$r->setAccessible(true);
|
||||
|
||||
$r->invoke($node, ...$prenormalizeds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataWithIncludedExtraKeys
|
||||
*/
|
||||
public function testMergeWithIgnoringAndRemovingExtraKeys($prenormalizeds, $merged)
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('merge() expects a normalized config array.');
|
||||
$node = new ArrayNode('root');
|
||||
$node->addChild(new ScalarNode('foo'));
|
||||
$node->addChild(new ScalarNode('bar'));
|
||||
$node->setIgnoreExtraKeys(true);
|
||||
|
||||
$r = new \ReflectionMethod($node, 'mergeValues');
|
||||
$r->setAccessible(true);
|
||||
|
||||
$r->invoke($node, ...$prenormalizeds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataWithIncludedExtraKeys
|
||||
*/
|
||||
public function testMergeWithIgnoringExtraKeys($prenormalizeds, $merged)
|
||||
{
|
||||
$node = new ArrayNode('root');
|
||||
$node->addChild(new ScalarNode('foo'));
|
||||
$node->addChild(new ScalarNode('bar'));
|
||||
$node->setIgnoreExtraKeys(true, false);
|
||||
|
||||
$r = new \ReflectionMethod($node, 'mergeValues');
|
||||
$r->setAccessible(true);
|
||||
|
||||
$this->assertEquals($merged, $r->invoke($node, ...$prenormalizeds));
|
||||
}
|
||||
|
||||
public function getDataWithIncludedExtraKeys()
|
||||
{
|
||||
return [
|
||||
[
|
||||
[['foo' => 'bar', 'baz' => 'not foo'], ['bar' => 'baz', 'baz' => 'foo']],
|
||||
['foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,9 @@ class ErrorListener implements EventSubscriberInterface
|
||||
$error = $event->getError();
|
||||
|
||||
if (!$inputString = $this->getInputString($event)) {
|
||||
return $this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
|
||||
$this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
|
||||
@ -59,7 +61,9 @@ class ErrorListener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
if (!$inputString = $this->getInputString($event)) {
|
||||
return $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
|
||||
$this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
|
||||
|
@ -268,6 +268,8 @@ class ArgvInput extends Input
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,6 +46,8 @@ class ArrayInput extends Input
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,9 @@ class ConsoleSectionOutput extends StreamOutput
|
||||
protected function doWrite($message, $newline)
|
||||
{
|
||||
if (!$this->isDecorated()) {
|
||||
return parent::doWrite($message, $newline);
|
||||
parent::doWrite($message, $newline);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$erasedContent = $this->popStreamContentUntilCurrentSection();
|
||||
|
@ -58,6 +58,8 @@ class TokenizerEscaping
|
||||
if (0x10000 > $c) {
|
||||
return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
|
||||
}
|
||||
|
||||
return '';
|
||||
}, $value);
|
||||
}
|
||||
}
|
||||
|
@ -399,6 +399,12 @@ class DebugClassLoader
|
||||
return $deprecations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param string $class
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function checkCase(\ReflectionClass $refl, $file, $class)
|
||||
{
|
||||
$real = explode('\\', $class.strrchr($file, '.'));
|
||||
@ -415,7 +421,7 @@ class DebugClassLoader
|
||||
array_splice($tail, 0, $i + 1);
|
||||
|
||||
if (!$tail) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
|
||||
@ -431,6 +437,8 @@ class DebugClassLoader
|
||||
) {
|
||||
return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -579,7 +579,9 @@ class ErrorHandler
|
||||
$this->exceptionHandler = null;
|
||||
try {
|
||||
if (null !== $exceptionHandler) {
|
||||
return $exceptionHandler($exception);
|
||||
$exceptionHandler($exception);
|
||||
|
||||
return;
|
||||
}
|
||||
$handlerException = $handlerException ?: $exception;
|
||||
} catch (\Throwable $handlerException) {
|
||||
|
@ -75,6 +75,8 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
|
||||
|
||||
return new ClassNotFoundException($message, $exception);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,5 +441,7 @@ class ClassLoader
|
||||
eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtualMagicCall extends \\'.__NAMESPACE__.'\Fixtures\VirtualClassMagicCall implements \\'.__NAMESPACE__.'\Fixtures\VirtualInterface {
|
||||
}');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -81,5 +81,7 @@ class CheckArgumentsValidityPass extends AbstractRecursivePass
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,10 @@ class ResolveClassPass implements CompilerPassInterface
|
||||
if ($definition->isSynthetic() || null !== $definition->getClass()) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
|
||||
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
|
||||
if ($definition instanceof ChildDefinition && !class_exists($id)) {
|
||||
throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id));
|
||||
}
|
||||
if ('\\' === $id[0]) {
|
||||
throw new InvalidArgumentException(sprintf('Service definition "%s" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.', $id));
|
||||
}
|
||||
$definition->setClass($id);
|
||||
}
|
||||
}
|
||||
|
@ -282,6 +282,8 @@ class Container implements ResettableContainerInterface
|
||||
|
||||
throw new ServiceNotFoundException($id, null, null, $alternatives);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -601,7 +601,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$definition = $this->getDefinition($id);
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $invalidBehavior) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
|
@ -120,7 +120,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
|
||||
if (false !== $i || 'string' !== $prefix) {
|
||||
if (null === $env = $getEnv($name)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
} elseif (isset($_ENV[$name])) {
|
||||
$env = $_ENV[$name];
|
||||
@ -132,7 +132,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (null === $env = $this->container->getParameter("env($name)")) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
|
||||
return null;
|
||||
}
|
||||
|
||||
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
||||
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs): array
|
||||
{
|
||||
$processor = new Processor();
|
||||
|
||||
|
@ -50,8 +50,7 @@ class ProxyHelper
|
||||
if ('self' === $lcName) {
|
||||
return $prefix.$r->getDeclaringClass()->name;
|
||||
}
|
||||
if ($parent = $r->getDeclaringClass()->getParentClass()) {
|
||||
return $prefix.$parent->name;
|
||||
}
|
||||
|
||||
return ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
|
||||
|
||||
class ResolveClassPassTest extends TestCase
|
||||
@ -59,17 +58,6 @@ class ResolveClassPassTest extends TestCase
|
||||
yield ['\DateTime'];
|
||||
}
|
||||
|
||||
public function testWontResolveClassFromClassIdWithLeadingBackslash()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Service definition "\App\Some\Service" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('\App\Some\Service');
|
||||
|
||||
(new ResolveClassPass())->process($container);
|
||||
}
|
||||
|
||||
public function testNonFqcnChildDefinition()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
@ -1288,8 +1288,8 @@ class ContainerBuilderTest extends TestCase
|
||||
|
||||
public function testNoClassFromNamespaceClassIdWithLeadingSlash()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Service definition "\Symfony\Component\DependencyInjection\Tests\FooClass" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.');
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('The definition for "\Symfony\Component\DependencyInjection\Tests\FooClass" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "Symfony\Component\DependencyInjection\Tests\FooClass" to get rid of this error.');
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('\\'.FooClass::class);
|
||||
|
@ -1061,9 +1061,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
*/
|
||||
public function getNode($position)
|
||||
{
|
||||
if (isset($this->nodes[$position])) {
|
||||
return $this->nodes[$position];
|
||||
}
|
||||
return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1178,11 +1176,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
// ask for one namespace, otherwise we'd get a collection with an item for each node
|
||||
$namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix));
|
||||
|
||||
if ($node = $namespaces->item(0)) {
|
||||
return $node->nodeValue;
|
||||
}
|
||||
|
||||
return null;
|
||||
return ($node = $namespaces->item(0)) ? $node->nodeValue : null;
|
||||
}
|
||||
|
||||
private function findNamespacePrefixes(string $xpath): array
|
||||
|
@ -72,9 +72,8 @@ abstract class FormField
|
||||
}
|
||||
|
||||
$labels = $xpath->query('ancestor::label[1]', $this->node);
|
||||
if ($labels->length > 0) {
|
||||
return $labels->item(0);
|
||||
}
|
||||
|
||||
return $labels->length > 0 ? $labels->item(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,7 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
public function getListenerPriority($eventName, $listener)
|
||||
{
|
||||
if (empty($this->listeners[$eventName])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
@ -125,6 +125,8 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ class FilesystemTestCase extends TestCase
|
||||
protected $longPathNamesWindows = [];
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\Filesystem\Filesystem
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected $filesystem = null;
|
||||
|
||||
@ -110,9 +110,8 @@ class FilesystemTestCase extends TestCase
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$infos = stat($filepath);
|
||||
if ($datas = posix_getpwuid($infos['uid'])) {
|
||||
return $datas['name'];
|
||||
}
|
||||
|
||||
return ($datas = posix_getpwuid($infos['uid'])) ? $datas['name'] : null;
|
||||
}
|
||||
|
||||
protected function getFileGroup($filepath)
|
||||
|
@ -140,6 +140,7 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
*/
|
||||
protected function loadTypeGuesser()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,9 +78,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
// when such values are passed to
|
||||
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
||||
// so that the call to getValue() doesn't break.
|
||||
if (\is_object($choice) || \is_array($choice)) {
|
||||
return $accessor->getValue($choice, $value);
|
||||
}
|
||||
return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -108,9 +106,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
// when such values are passed to
|
||||
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
||||
// so that the call to getValue() doesn't break.
|
||||
if (\is_object($choice) || \is_array($choice)) {
|
||||
return $accessor->getValue($choice, $value);
|
||||
}
|
||||
return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -177,6 +173,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
return $accessor->getValue($choice, $groupBy);
|
||||
} catch (UnexpectedTypeException $e) {
|
||||
// Don't group if path is not readable
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
|
||||
if (\count($emptyKeys) > 0) {
|
||||
if (\count($emptyKeys) === \count($this->partMapping)) {
|
||||
// All parts empty
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)));
|
||||
|
@ -42,7 +42,7 @@ class ChoiceToValueTransformer implements DataTransformerInterface
|
||||
|
||||
if (1 !== \count($choices)) {
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
|
||||
|
@ -34,7 +34,7 @@ class DateTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
public function transform($dateTimeZone)
|
||||
{
|
||||
if (null === $dateTimeZone) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->multiple) {
|
||||
@ -58,7 +58,7 @@ class DateTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
public function reverseTransform($value)
|
||||
{
|
||||
if (null === $value) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->multiple) {
|
||||
|
@ -34,7 +34,7 @@ class IntlTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
public function transform($intlTimeZone)
|
||||
{
|
||||
if (null === $intlTimeZone) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->multiple) {
|
||||
|
@ -251,7 +251,7 @@ class ChoiceType extends AbstractType
|
||||
{
|
||||
$emptyData = function (Options $options) {
|
||||
if ($options['expanded'] && !$options['multiple']) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($options['multiple']) {
|
||||
@ -268,13 +268,13 @@ class ChoiceType extends AbstractType
|
||||
$placeholderNormalizer = function (Options $options, $placeholder) {
|
||||
if ($options['multiple']) {
|
||||
// never use an empty value for this case
|
||||
return;
|
||||
return null;
|
||||
} elseif ($options['required'] && ($options['expanded'] || isset($options['attr']['size']) && $options['attr']['size'] > 1)) {
|
||||
// placeholder for required radio buttons or a select with size > 1 does not make sense
|
||||
return;
|
||||
return null;
|
||||
} elseif (false === $placeholder) {
|
||||
// an empty value should be added but the user decided otherwise
|
||||
return;
|
||||
return null;
|
||||
} elseif ($options['expanded'] && '' === $placeholder) {
|
||||
// never use an empty label for radio buttons
|
||||
return 'None';
|
||||
@ -362,9 +362,6 @@ class ChoiceType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function addSubForm(FormBuilderInterface $builder, string $name, ChoiceView $choiceView, array $options)
|
||||
{
|
||||
$choiceOpts = [
|
||||
|
@ -36,7 +36,7 @@ abstract class BaseValidatorExtension extends AbstractTypeExtension
|
||||
}
|
||||
|
||||
if (empty($groups)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (\is_callable($groups)) {
|
||||
|
@ -158,6 +158,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
case 'Symfony\Component\Validator\Constraints\IsFalse':
|
||||
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,6 +175,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
case 'Symfony\Component\Validator\Constraints\IsTrue':
|
||||
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,6 +205,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,6 +243,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,9 +50,7 @@ class MappingRule
|
||||
*/
|
||||
public function match($propertyPath)
|
||||
{
|
||||
if ($propertyPath === $this->propertyPath) {
|
||||
return $this->getTarget();
|
||||
}
|
||||
return $propertyPath === $this->propertyPath ? $this->getTarget() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -761,9 +761,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->clickedButton;
|
||||
}
|
||||
|
||||
if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
|
||||
return $this->parent->getClickedButton();
|
||||
}
|
||||
return $this->parent && method_exists($this->parent, 'getClickedButton') ? $this->parent->getClickedButton() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,5 +53,7 @@ class StringUtil
|
||||
if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
|
||||
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1]));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,8 @@ final class CurlResponse implements ResponseInterface
|
||||
|
||||
return 1; // Abort the request
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -96,5 +96,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
|
||||
return $extension;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -132,5 +132,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
|
||||
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -69,49 +69,49 @@ class Request
|
||||
/**
|
||||
* Custom parameters.
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
||||
* @var ParameterBag
|
||||
*/
|
||||
public $attributes;
|
||||
|
||||
/**
|
||||
* Request body parameters ($_POST).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
||||
* @var ParameterBag
|
||||
*/
|
||||
public $request;
|
||||
|
||||
/**
|
||||
* Query string parameters ($_GET).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
||||
* @var ParameterBag
|
||||
*/
|
||||
public $query;
|
||||
|
||||
/**
|
||||
* Server and execution environment parameters ($_SERVER).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ServerBag
|
||||
* @var ServerBag
|
||||
*/
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Uploaded files ($_FILES).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\FileBag
|
||||
* @var FileBag
|
||||
*/
|
||||
public $files;
|
||||
|
||||
/**
|
||||
* Cookies ($_COOKIE).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
||||
* @var ParameterBag
|
||||
*/
|
||||
public $cookies;
|
||||
|
||||
/**
|
||||
* Headers (taken from the $_SERVER).
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\HeaderBag
|
||||
* @var HeaderBag
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
@ -171,7 +171,7 @@ class Request
|
||||
protected $format;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\HttpFoundation\Session\SessionInterface
|
||||
* @var SessionInterface
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
@ -1320,6 +1320,8 @@ class Request
|
||||
return $format;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ class Response
|
||||
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\HttpFoundation\ResponseHeaderBag
|
||||
* @var ResponseHeaderBag
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
|
@ -86,9 +86,7 @@ abstract class Bundle implements BundleInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->extension) {
|
||||
return $this->extension;
|
||||
}
|
||||
return $this->extension ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,9 +151,7 @@ abstract class Bundle implements BundleInterface
|
||||
*/
|
||||
protected function createContainerExtension()
|
||||
{
|
||||
if (class_exists($class = $this->getContainerExtensionClass())) {
|
||||
return new $class();
|
||||
}
|
||||
return class_exists($class = $this->getContainerExtensionClass()) ? new $class() : null;
|
||||
}
|
||||
|
||||
private function parseClassName()
|
||||
|
@ -60,7 +60,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
if (isset($collectedLogs[$message])) {
|
||||
++$collectedLogs[$message]['count'];
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
|
||||
@ -80,6 +80,8 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
'trace' => $backtrace,
|
||||
'count' => 1,
|
||||
];
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -101,5 +101,7 @@ class FileLinkFormatter
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -106,5 +106,7 @@ class FragmentHandler
|
||||
}
|
||||
|
||||
$response->sendContent();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,5 +111,7 @@ class Esi extends AbstractSurrogate
|
||||
|
||||
// remove ESI/1.0 from the Surrogate-Control header
|
||||
$this->removeFromControl($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
@ -94,5 +94,7 @@ class Ssi extends AbstractSurrogate
|
||||
|
||||
// remove SSI/1.0 from the Surrogate-Control header
|
||||
$this->removeFromControl($response);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
if (isset($collectedLogs[$message])) {
|
||||
++$collectedLogs[$message]['count'];
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5);
|
||||
@ -540,6 +540,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
'trace' => [$backtrace[0]],
|
||||
'count' => 1,
|
||||
];
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -242,16 +242,16 @@ class Profiler implements ResetInterface
|
||||
return $this->collectors[$name];
|
||||
}
|
||||
|
||||
private function getTimestamp(?string $value)
|
||||
private function getTimestamp(?string $value): ?int
|
||||
{
|
||||
if (null === $value || '' == $value) {
|
||||
return;
|
||||
if (null === $value || '' === $value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$value = new \DateTime(is_numeric($value) ? '@'.$value : $value);
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value->getTimestamp();
|
||||
|
@ -88,7 +88,7 @@ class EsiTest extends TestCase
|
||||
$request = Request::create('/');
|
||||
$response = new Response();
|
||||
$response->headers->set('Content-Type', 'text/plain');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertFalse($response->headers->has('x-body-eval'));
|
||||
}
|
||||
@ -99,7 +99,7 @@ class EsiTest extends TestCase
|
||||
|
||||
$request = Request::create('/');
|
||||
$response = new Response('<esi:remove> <a href="http://www.example.com">www.example.com</a> </esi:remove> Keep this'."<esi:remove>\n <a>www.example.com</a> </esi:remove> And this");
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals(' Keep this And this', $response->getContent());
|
||||
}
|
||||
@ -110,7 +110,7 @@ class EsiTest extends TestCase
|
||||
|
||||
$request = Request::create('/');
|
||||
$response = new Response('<esi:comment text="some comment >" /> Keep this');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals(' Keep this', $response->getContent());
|
||||
}
|
||||
@ -121,23 +121,23 @@ class EsiTest extends TestCase
|
||||
|
||||
$request = Request::create('/');
|
||||
$response = new Response('foo <esi:comment text="some comment" /><esi:include src="..." alt="alt" onerror="continue" />');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'alt\', true) ?>'."\n", $response->getContent());
|
||||
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
||||
|
||||
$response = new Response('foo <esi:comment text="some comment" /><esi:include src="foo\'" alt="bar\'" onerror="continue" />');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'foo\\\'\', \'bar\\\'\', true) ?>'."\n", $response->getContent());
|
||||
|
||||
$response = new Response('foo <esi:include src="..." />');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
|
||||
|
||||
$response = new Response('foo <esi:include src="..."></esi:include>');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
|
||||
}
|
||||
@ -148,7 +148,7 @@ class EsiTest extends TestCase
|
||||
|
||||
$request = Request::create('/');
|
||||
$response = new Response('<?php <? <% <script language=php>');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
|
||||
$this->assertEquals('<?php echo "<?"; ?>php <?php echo "<?"; ?> <?php echo "<%"; ?> <?php echo "<s"; ?>cript language=php>', $response->getContent());
|
||||
}
|
||||
@ -160,7 +160,7 @@ class EsiTest extends TestCase
|
||||
|
||||
$request = Request::create('/');
|
||||
$response = new Response('foo <esi:include />');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
}
|
||||
|
||||
public function testProcessRemoveSurrogateControlHeader()
|
||||
@ -170,16 +170,16 @@ class EsiTest extends TestCase
|
||||
$request = Request::create('/');
|
||||
$response = new Response('foo <esi:include src="..." />');
|
||||
$response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
||||
|
||||
$response->headers->set('Surrogate-Control', 'no-store, content="ESI/1.0"');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
||||
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
||||
|
||||
$response->headers->set('Surrogate-Control', 'content="ESI/1.0", no-store');
|
||||
$esi->process($request, $response);
|
||||
$this->assertSame($response, $esi->process($request, $response));
|
||||
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
||||
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
||||
}
|
||||
|
@ -90,6 +90,8 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,6 +141,8 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,6 +124,8 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +77,8 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,6 +106,8 @@ class FullTransformer
|
||||
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
|
||||
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,6 +178,8 @@ class FullTransformer
|
||||
|
||||
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
|
||||
}
|
||||
|
||||
return null;
|
||||
}, $escapedPattern);
|
||||
|
||||
return $reverseMatchingRegExp;
|
||||
|
@ -104,11 +104,7 @@ final class Locale extends \Locale
|
||||
|
||||
// Don't return default fallback for "root", "meta" or others
|
||||
// Normal locales have two or three letters
|
||||
if (\strlen($locale) < 4) {
|
||||
return self::$defaultFallback;
|
||||
}
|
||||
|
||||
return null;
|
||||
return \strlen($locale) < 4 ? self::$defaultFallback : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter
|
||||
try {
|
||||
return parent::getFractionDigits($currency);
|
||||
} catch (MissingResourceException $e) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter
|
||||
try {
|
||||
return parent::getRoundingIncrement($currency);
|
||||
} catch (MissingResourceException $e) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ function get_icu_version_from_genrb($genrb)
|
||||
}
|
||||
|
||||
if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
|
@ -88,12 +88,14 @@ abstract class AbstractPipes implements PipesInterface
|
||||
/**
|
||||
* Writes input to stdin.
|
||||
*
|
||||
* @return array|null
|
||||
*
|
||||
* @throws InvalidArgumentException When an input iterator yields a non supported value
|
||||
*/
|
||||
protected function write()
|
||||
{
|
||||
if (!isset($this->pipes[0])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$input = $this->input;
|
||||
|
||||
@ -122,7 +124,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
|
||||
// let's have a look if something changed in streams
|
||||
if (false === @stream_select($r, $w, $e, 0, 0)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($w as $stdin) {
|
||||
@ -166,6 +168,8 @@ abstract class AbstractPipes implements PipesInterface
|
||||
} elseif (!$w) {
|
||||
return [$this->pipes[0]];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1321,25 +1321,21 @@ class Process implements \IteratorAggregate
|
||||
protected function buildCallback(callable $callback = null)
|
||||
{
|
||||
if ($this->outputDisabled) {
|
||||
return function ($type, $data) use ($callback) {
|
||||
if (null !== $callback) {
|
||||
return $callback($type, $data);
|
||||
}
|
||||
return function ($type, $data) use ($callback): bool {
|
||||
return null !== $callback && $callback($type, $data);
|
||||
};
|
||||
}
|
||||
|
||||
$out = self::OUT;
|
||||
|
||||
return function ($type, $data) use ($callback, $out) {
|
||||
return function ($type, $data) use ($callback, $out): bool {
|
||||
if ($out == $type) {
|
||||
$this->addOutput($data);
|
||||
} else {
|
||||
$this->addErrorOutput($data);
|
||||
}
|
||||
|
||||
if (null !== $callback) {
|
||||
return $callback($type, $data);
|
||||
}
|
||||
return null !== $callback && $callback($type, $data);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1224,6 +1224,8 @@ class ProcessTest extends TestCase
|
||||
|
||||
return $stream;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
$input = new InputStream();
|
||||
|
@ -33,5 +33,7 @@ class TestClassMagicCall
|
||||
if ('setMagicCallProperty' === $method) {
|
||||
$this->magicCallProperty = reset($args);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user