minor #33252 Fix inconsistent return points (derrabus)
This PR was merged into the 3.4 branch.
Discussion
----------
Fix inconsistent return points
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #17201 in preparation for #33228
| License | MIT
| Doc PR | N/A
Inconsistent return points in methods prevent adding return types. I thought, I'll give it a try and fix them. After this PR, PhpStorm's inspection still finds 39 issues, but as far as I can tell, they're either false positives or fixture code.
Commits
-------
f5b6ee9de1
Fix inconsistent return points.
This commit is contained in:
commit
8069b58299
@ -37,7 +37,7 @@ class DoctrineParserCache implements ParserCacheInterface
|
|||||||
public function fetch($key)
|
public function fetch($key)
|
||||||
{
|
{
|
||||||
if (false === $value = $this->cache->fetch($key)) {
|
if (false === $value = $this->cache->fetch($key)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -118,6 +118,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
|
|
||||||
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
|
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,6 +139,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,6 +154,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getMetadata($class)
|
protected function getMetadata($class)
|
||||||
@ -171,5 +177,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
// not an entity or mapped super class, using Doctrine ORM 2.2
|
// not an entity or mapped super class, using Doctrine ORM 2.2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,8 @@ abstract class DoctrineType extends AbstractType
|
|||||||
|
|
||||||
return $doctrineChoiceLoader;
|
return $doctrineChoiceLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$choiceName = function (Options $options) {
|
$choiceName = function (Options $options) {
|
||||||
@ -171,6 +173,7 @@ abstract class DoctrineType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, an incrementing integer is used as name automatically
|
// Otherwise, an incrementing integer is used as name automatically
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The choices are always indexed by ID (see "choices" normalizer
|
// The choices are always indexed by ID (see "choices" normalizer
|
||||||
@ -187,6 +190,7 @@ abstract class DoctrineType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, an incrementing integer is used as value automatically
|
// Otherwise, an incrementing integer is used as value automatically
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$emNormalizer = function (Options $options, $em) {
|
$emNormalizer = function (Options $options, $em) {
|
||||||
|
@ -248,6 +248,8 @@ class DbalSessionHandler implements \SessionHandlerInterface
|
|||||||
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
|
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
|
||||||
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
|
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getServerVersion()
|
private function getServerVersion()
|
||||||
|
@ -42,9 +42,9 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
|||||||
try {
|
try {
|
||||||
$metadata = $this->classMetadataFactory->getMetadataFor($class);
|
$metadata = $this->classMetadataFactory->getMetadataFor($class);
|
||||||
} catch (MappingException $exception) {
|
} catch (MappingException $exception) {
|
||||||
return;
|
return null;
|
||||||
} catch (OrmMappingException $exception) {
|
} catch (OrmMappingException $exception) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
|
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
|
||||||
@ -68,9 +68,9 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
|||||||
try {
|
try {
|
||||||
$metadata = $this->classMetadataFactory->getMetadataFor($class);
|
$metadata = $this->classMetadataFactory->getMetadataFor($class);
|
||||||
} catch (MappingException $exception) {
|
} catch (MappingException $exception) {
|
||||||
return;
|
return null;
|
||||||
} catch (OrmMappingException $exception) {
|
} catch (OrmMappingException $exception) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($metadata->hasAssociation($property)) {
|
if ($metadata->hasAssociation($property)) {
|
||||||
@ -162,6 +162,8 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
|||||||
return $builtinType ? [new Type($builtinType, $nullable)] : null;
|
return $builtinType ? [new Type($builtinType, $nullable)] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,5 +227,7 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
|||||||
case DBALType::OBJECT:
|
case DBALType::OBJECT:
|
||||||
return Type::BUILTIN_TYPE_OBJECT;
|
return Type::BUILTIN_TYPE_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class DoctrineFooType extends Type
|
|||||||
public function convertToDatabaseValue($value, AbstractPlatform $platform)
|
public function convertToDatabaseValue($value, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if (!$value instanceof Foo) {
|
if (!$value instanceof Foo) {
|
||||||
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
||||||
@ -62,7 +62,7 @@ class DoctrineFooType extends Type
|
|||||||
public function convertToPHPValue($value, AbstractPlatform $platform)
|
public function convertToPHPValue($value, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if (!\is_string($value)) {
|
if (!\is_string($value)) {
|
||||||
throw ConversionException::conversionFailed($value, self::NAME);
|
throw ConversionException::conversionFailed($value, self::NAME);
|
||||||
|
@ -25,6 +25,8 @@ class ClockMock
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
|
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function time()
|
public static function time()
|
||||||
@ -54,6 +56,8 @@ class ClockMock
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::$now += $us / 1000000;
|
self::$now += $us / 1000000;
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function microtime($asFloat = false)
|
public static function microtime($asFloat = false)
|
||||||
|
@ -180,6 +180,8 @@ class DeprecationErrorHandler
|
|||||||
++$ref;
|
++$ref;
|
||||||
}
|
}
|
||||||
++$deprecations[$group.'Count'];
|
++$deprecations[$group.'Count'];
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
$oldErrorHandler = set_error_handler($deprecationHandler);
|
$oldErrorHandler = set_error_handler($deprecationHandler);
|
||||||
|
|
||||||
@ -291,6 +293,8 @@ class DeprecationErrorHandler
|
|||||||
return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
|
return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
|
||||||
}
|
}
|
||||||
$deprecations[] = array(error_reporting(), $msg, $file);
|
$deprecations[] = array(error_reporting(), $msg, $file);
|
||||||
|
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
register_shutdown_function(function () use ($outputFile, &$deprecations) {
|
register_shutdown_function(function () use ($outputFile, &$deprecations) {
|
||||||
|
@ -95,11 +95,7 @@ class CoverageListenerTrait
|
|||||||
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
|
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
|
||||||
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
|
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
|
||||||
|
|
||||||
if (!class_exists($sutFqcn)) {
|
return class_exists($sutFqcn) ? $sutFqcn : null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sutFqcn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
|
@ -357,6 +357,8 @@ class SymfonyTestsListenerTrait
|
|||||||
$msg = 'Unsilenced deprecation: '.$msg;
|
$msg = 'Unsilenced deprecation: '.$msg;
|
||||||
}
|
}
|
||||||
$this->gatheredDeprecations[] = $msg;
|
$this->gatheredDeprecations[] = $msg;
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +135,7 @@ $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
|
|||||||
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
|
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
|
||||||
|
|
||||||
if ($PHPUNIT_VERSION < 8.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)) {
|
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
|
||||||
$argv[] = '--do-not-cache-result';
|
$argv[] = '--do-not-cache-result';
|
||||||
++$argc;
|
++$argc;
|
||||||
|
@ -46,7 +46,7 @@ if (class_exists(Version::class) && version_compare(\defined(Version::class.'::V
|
|||||||
$functionLoader = $functionLoader[0];
|
$functionLoader = $functionLoader[0];
|
||||||
}
|
}
|
||||||
if (!\is_object($functionLoader)) {
|
if (!\is_object($functionLoader)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if ($functionLoader instanceof ClassLoader) {
|
if ($functionLoader instanceof ClassLoader) {
|
||||||
return $functionLoader;
|
return $functionLoader;
|
||||||
@ -57,6 +57,8 @@ if (class_exists(Version::class) && version_compare(\defined(Version::class.'::V
|
|||||||
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
|
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
|
||||||
return $getComposerClassLoader($functionLoader->getClassLoader());
|
return $getComposerClassLoader($functionLoader->getClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$classLoader = null;
|
$classLoader = null;
|
||||||
|
@ -83,9 +83,8 @@ class AppVariable
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $token->getUser();
|
$user = $token->getUser();
|
||||||
if (\is_object($user)) {
|
|
||||||
return $user;
|
return \is_object($user) ? $user : null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,9 +112,7 @@ class AppVariable
|
|||||||
throw new \RuntimeException('The "app.session" variable is not available.');
|
throw new \RuntimeException('The "app.session" variable is not available.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request = $this->getRequest()) {
|
return ($request = $this->getRequest()) ? $request->getSession() : null;
|
||||||
return $request->getSession();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,16 +220,16 @@ EOF
|
|||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
if ('tests' === $type) {
|
if ('tests' === $type) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if ('functions' === $type || 'filters' === $type) {
|
if ('functions' === $type || 'filters' === $type) {
|
||||||
$cb = $entity->getCallable();
|
$cb = $entity->getCallable();
|
||||||
if (null === $cb) {
|
if (null === $cb) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if (\is_array($cb)) {
|
if (\is_array($cb)) {
|
||||||
if (!method_exists($cb[0], $cb[1])) {
|
if (!method_exists($cb[0], $cb[1])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
||||||
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
|
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
|
||||||
@ -268,6 +268,8 @@ EOF
|
|||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPrettyMetadata($type, $entity, $decorated)
|
private function getPrettyMetadata($type, $entity, $decorated)
|
||||||
@ -302,5 +304,7 @@ EOF
|
|||||||
if ('filters' === $type) {
|
if ('filters' === $type) {
|
||||||
return $meta ? '('.implode(', ', $meta).')' : '';
|
return $meta ? '('.implode(', ', $meta).')' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class DumpExtension extends AbstractExtension
|
|||||||
public function dump(Environment $env, $context)
|
public function dump(Environment $env, $context)
|
||||||
{
|
{
|
||||||
if (!$env->isDebug()) {
|
if (!$env->isDebug()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (2 === \func_num_args()) {
|
if (2 === \func_num_args()) {
|
||||||
|
@ -115,7 +115,7 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
|
|||||||
} elseif ($arguments->hasNode($index)) {
|
} elseif ($arguments->hasNode($index)) {
|
||||||
$argument = $arguments->getNode($index);
|
$argument = $arguments->getNode($index);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getReadDomainFromNode($argument);
|
return $this->getReadDomainFromNode($argument);
|
||||||
|
@ -71,6 +71,8 @@ class UndefinedCallableHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
|
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onUndefinedFunction($name)
|
public static function onUndefinedFunction($name)
|
||||||
@ -80,6 +82,8 @@ class UndefinedCallableHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::onUndefined($name, 'function', self::$functionComponents[$name]);
|
self::onUndefined($name, 'function', self::$functionComponents[$name]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function onUndefined($name, $type, $component)
|
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)',
|
'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);
|
$extension = $this->findExtension($name);
|
||||||
@ -129,5 +129,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
|
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,5 +93,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
$io->table([], $tableRows);
|
$io->table([], $tableRows);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,10 +154,13 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return callable|null
|
||||||
|
*/
|
||||||
private function extractCallable(Route $route)
|
private function extractCallable(Route $route)
|
||||||
{
|
{
|
||||||
if (!$route->hasDefault('_controller')) {
|
if (!$route->hasDefault('_controller')) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller = $route->getDefault('_controller');
|
$controller = $route->getDefault('_controller');
|
||||||
@ -178,5 +181,7 @@ EOF
|
|||||||
return $controller;
|
return $controller;
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,5 +149,7 @@ EOF
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ EOF
|
|||||||
if (!\count($operation->getDomains())) {
|
if (!\count($operation->getDomains())) {
|
||||||
$errorIo->warning('No translation messages were found.');
|
$errorIo->warning('No translation messages were found.');
|
||||||
|
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultMessage = 'Translation files were successfully updated';
|
$resultMessage = 'Translation files were successfully updated';
|
||||||
@ -307,6 +307,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
$errorIo->success($resultMessage.'.');
|
$errorIo->success($resultMessage.'.');
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function filterCatalogue(MessageCatalogue $catalogue, $domain)
|
private function filterCatalogue(MessageCatalogue $catalogue, $domain)
|
||||||
|
@ -142,7 +142,9 @@ class JsonDescriptor extends Descriptor
|
|||||||
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
|
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
|
||||||
{
|
{
|
||||||
if (!$builder) {
|
if (!$builder) {
|
||||||
return $this->writeData($this->getContainerAliasData($alias), $options);
|
$this->writeData($this->getContainerAliasData($alias), $options);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeData(
|
$this->writeData(
|
||||||
|
@ -249,7 +249,9 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
|
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
|
||||||
|
|
||||||
if (!isset($options['id'])) {
|
if (!isset($options['id'])) {
|
||||||
return $this->write($output);
|
$this->write($output);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));
|
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));
|
||||||
|
@ -369,7 +369,7 @@ class TextDescriptor extends Descriptor
|
|||||||
return;
|
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]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +98,9 @@ class XmlDescriptor extends Descriptor
|
|||||||
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
|
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
|
||||||
|
|
||||||
if (!$builder) {
|
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));
|
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
|
||||||
|
@ -34,10 +34,6 @@ class SessionListener extends AbstractSessionListener
|
|||||||
|
|
||||||
protected function getSession()
|
protected function getSession()
|
||||||
{
|
{
|
||||||
if (!$this->container->has('session')) {
|
return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->container->get('session');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,6 @@ class TestSessionListener extends AbstractTestSessionListener
|
|||||||
|
|
||||||
protected function getSession()
|
protected function getSession()
|
||||||
{
|
{
|
||||||
if (!$this->container->has('session')) {
|
return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->container->get('session');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,15 +45,12 @@ class GlobalVariables
|
|||||||
public function getUser()
|
public function getUser()
|
||||||
{
|
{
|
||||||
if (!$token = $this->getToken()) {
|
if (!$token = $this->getToken()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $token->getUser();
|
$user = $token->getUser();
|
||||||
if (!\is_object($user)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user;
|
return \is_object($user) ? $user : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,9 +58,7 @@ class GlobalVariables
|
|||||||
*/
|
*/
|
||||||
public function getRequest()
|
public function getRequest()
|
||||||
{
|
{
|
||||||
if ($this->container->has('request_stack')) {
|
return $this->container->has('request_stack') ? $this->container->get('request_stack')->getCurrentRequest() : null;
|
||||||
return $this->container->get('request_stack')->getCurrentRequest();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,9 +66,7 @@ class GlobalVariables
|
|||||||
*/
|
*/
|
||||||
public function getSession()
|
public function getSession()
|
||||||
{
|
{
|
||||||
if ($request = $this->getRequest()) {
|
return ($request = $this->getRequest()) ? $request->getSession() : null;
|
||||||
return $request->getSession();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ class CodeHelper extends Helper
|
|||||||
* @param string $file A file path
|
* @param string $file A file path
|
||||||
* @param int $line The selected line number
|
* @param int $line The selected line number
|
||||||
*
|
*
|
||||||
* @return string An HTML string
|
* @return string|null An HTML string
|
||||||
*/
|
*/
|
||||||
public function fileExcerpt($file, $line)
|
public function fileExcerpt($file, $line)
|
||||||
{
|
{
|
||||||
@ -138,6 +138,8 @@ class CodeHelper extends Helper
|
|||||||
|
|
||||||
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
|
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,10 @@ class StopwatchHelper extends Helper
|
|||||||
|
|
||||||
public function __call($method, $arguments = [])
|
public function __call($method, $arguments = [])
|
||||||
{
|
{
|
||||||
if (null !== $this->stopwatch) {
|
if (null === $this->stopwatch) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (method_exists($this->stopwatch, $method)) {
|
if (method_exists($this->stopwatch, $method)) {
|
||||||
return \call_user_func_array([$this->stopwatch, $method], $arguments);
|
return \call_user_func_array([$this->stopwatch, $method], $arguments);
|
||||||
}
|
}
|
||||||
@ -43,4 +46,3 @@ class StopwatchHelper extends Helper
|
|||||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -85,7 +85,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$container = $this->createContainerFromFile('property_accessor');
|
$container = $this->createContainerFromFile('property_accessor');
|
||||||
|
|
||||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
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');
|
$cache = $container->getDefinition('cache.property_access');
|
||||||
@ -98,7 +100,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
|
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
|
||||||
|
|
||||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
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');
|
$cache = $container->getDefinition('cache.property_access');
|
||||||
|
@ -109,5 +109,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln('ACL tables have been initialized successfully.');
|
$output->writeln('ACL tables have been initialized successfully.');
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
$errorIo->success('Password encoding succeeded');
|
$errorIo->success('Password encoding succeeded');
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,5 +49,7 @@ class ContainerAwareRuntimeLoader implements RuntimeLoaderInterface
|
|||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->warning(sprintf('Class "%s" is not configured as a Twig runtime. Add the "twig.runtime" tag to the related service in the container.', $class));
|
$this->logger->warning(sprintf('Class "%s" is not configured as a Twig runtime. Add the "twig.runtime" tag to the related service in the container.', $class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,7 @@ class ProfilerControllerTest extends TestCase
|
|||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('loadProfile')
|
->method('loadProfile')
|
||||||
->willReturnCallback(function ($token) {
|
->willReturnCallback(function ($token) {
|
||||||
if ('found' == $token) {
|
return 'found' == $token ? new Profile($token) : null;
|
||||||
return new Profile($token);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -155,5 +155,7 @@ EOF
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,5 +88,7 @@ EOF
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,5 +62,7 @@ EOF
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,12 @@ class WebServerConfig
|
|||||||
return $this->hostname.':'.$this->port;
|
return $this->hostname.':'.$this->port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $documentRoot
|
||||||
|
* @param string $env
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
private function findFrontController($documentRoot, $env)
|
private function findFrontController($documentRoot, $env)
|
||||||
{
|
{
|
||||||
$fileNames = $this->getFrontControllerFileNames($env);
|
$fileNames = $this->getFrontControllerFileNames($env);
|
||||||
@ -110,13 +116,23 @@ class WebServerConfig
|
|||||||
return $fileName;
|
return $fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $env
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
private function getFrontControllerFileNames($env)
|
private function getFrontControllerFileNames($env)
|
||||||
{
|
{
|
||||||
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
|
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
private function findBestPort()
|
private function findBestPort()
|
||||||
{
|
{
|
||||||
$port = 8000;
|
$port = 8000;
|
||||||
|
@ -60,6 +60,8 @@ class CookieJar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,6 +177,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
|
|||||||
foreach ($this->getItems([$key]) as $item) {
|
foreach ($this->getItems([$key]) as $item) {
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +113,8 @@ class ApcClassLoader
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,6 +161,8 @@ class ClassLoader
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,5 +205,7 @@ class ClassLoader
|
|||||||
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
|
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,6 @@ class MapClassLoader
|
|||||||
*/
|
*/
|
||||||
public function findFile($class)
|
public function findFile($class)
|
||||||
{
|
{
|
||||||
if (isset($this->map[$class])) {
|
return isset($this->map[$class]) ? $this->map[$class] : null;
|
||||||
return $this->map[$class];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,8 @@ class Psr4ClassLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,6 +112,8 @@ class WinCacheClassLoader
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,6 +106,8 @@ class XcacheClassLoader
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,5 +306,7 @@ class XmlReferenceDumper
|
|||||||
if (\is_array($value)) {
|
if (\is_array($value)) {
|
||||||
return implode(',', $value);
|
return implode(',', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,5 +168,7 @@ abstract class FileLoader extends Loader
|
|||||||
throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
|
throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,9 @@ class ErrorListener implements EventSubscriberInterface
|
|||||||
$error = $event->getError();
|
$error = $event->getError();
|
||||||
|
|
||||||
if (!$inputString = $this->getInputString($event)) {
|
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()]);
|
$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)) {
|
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]);
|
$this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
|
||||||
|
@ -288,6 +288,8 @@ class ArgvInput extends Input
|
|||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +46,8 @@ class ArrayInput extends Input
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -355,7 +355,9 @@ class SymfonyStyle extends OutputStyle
|
|||||||
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||||
|
|
||||||
if (!isset($chars[0])) {
|
if (!isset($chars[0])) {
|
||||||
return $this->newLine(); //empty history, so we should start with a new line.
|
$this->newLine(); //empty history, so we should start with a new line.
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//Prepend new line for each non LF chars (This means no blank line was output before)
|
//Prepend new line for each non LF chars (This means no blank line was output before)
|
||||||
$this->newLine(2 - substr_count($chars, "\n"));
|
$this->newLine(2 - substr_count($chars, "\n"));
|
||||||
|
@ -73,6 +73,8 @@ class TokenizerEscaping
|
|||||||
if (0x10000 > $c) {
|
if (0x10000 > $c) {
|
||||||
return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
|
return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}, $value);
|
}, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,6 +317,12 @@ class DebugClassLoader
|
|||||||
return $deprecations;
|
return $deprecations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $file
|
||||||
|
* @param string $class
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
public function checkCase(\ReflectionClass $refl, $file, $class)
|
public function checkCase(\ReflectionClass $refl, $file, $class)
|
||||||
{
|
{
|
||||||
$real = explode('\\', $class.strrchr($file, '.'));
|
$real = explode('\\', $class.strrchr($file, '.'));
|
||||||
@ -333,7 +339,7 @@ class DebugClassLoader
|
|||||||
array_splice($tail, 0, $i + 1);
|
array_splice($tail, 0, $i + 1);
|
||||||
|
|
||||||
if (!$tail) {
|
if (!$tail) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
|
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
|
||||||
@ -349,6 +355,8 @@ class DebugClassLoader
|
|||||||
) {
|
) {
|
||||||
return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
|
return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -599,7 +599,9 @@ class ErrorHandler
|
|||||||
$this->exceptionHandler = null;
|
$this->exceptionHandler = null;
|
||||||
try {
|
try {
|
||||||
if (null !== $exceptionHandler) {
|
if (null !== $exceptionHandler) {
|
||||||
return \call_user_func($exceptionHandler, $exception);
|
$exceptionHandler($exception);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$handlerException = $handlerException ?: $exception;
|
$handlerException = $handlerException ?: $exception;
|
||||||
} catch (\Exception $handlerException) {
|
} catch (\Exception $handlerException) {
|
||||||
|
@ -71,6 +71,8 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
|
|||||||
|
|
||||||
return new ClassNotFoundException($message, $exception);
|
return new ClassNotFoundException($message, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,6 +198,8 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
|
|||||||
return $candidate;
|
return $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,5 +439,7 @@ class ClassLoader
|
|||||||
} elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) {
|
} elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) {
|
||||||
eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }');
|
eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->container->hasDefinition($id)) {
|
if (!$this->container->hasDefinition($id)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->container->normalizeId($id);
|
return $this->container->normalizeId($id);
|
||||||
|
@ -81,5 +81,7 @@ class CheckArgumentsValidityPass extends AbstractRecursivePass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
public function getReflectionClass($class, $throw = true)
|
public function getReflectionClass($class, $throw = true)
|
||||||
{
|
{
|
||||||
if (!$class = $this->getParameterBag()->resolveValue($class)) {
|
if (!$class = $this->getParameterBag()->resolveValue($class)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset(self::$internalTypes[$class])) {
|
if (isset(self::$internalTypes[$class])) {
|
||||||
@ -621,7 +621,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
$definition = $this->getDefinition($id);
|
$definition = $this->getDefinition($id);
|
||||||
} catch (ServiceNotFoundException $e) {
|
} catch (ServiceNotFoundException $e) {
|
||||||
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -65,7 +65,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
|
|
||||||
if (false !== $i || 'string' !== $prefix) {
|
if (false !== $i || 'string' !== $prefix) {
|
||||||
if (null === $env = $getEnv($name)) {
|
if (null === $env = $getEnv($name)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
} elseif (isset($_ENV[$name])) {
|
} elseif (isset($_ENV[$name])) {
|
||||||
$env = $_ENV[$name];
|
$env = $_ENV[$name];
|
||||||
@ -77,7 +77,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $env = $this->container->getParameter("env($name)")) {
|
if (null === $env = $this->container->getParameter("env($name)")) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +84,12 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
|
|||||||
$class = $container->getReflectionClass($class);
|
$class = $container->getReflectionClass($class);
|
||||||
$constructor = $class ? $class->getConstructor() : null;
|
$constructor = $class ? $class->getConstructor() : null;
|
||||||
|
|
||||||
if ($class && (!$constructor || !$constructor->getNumberOfRequiredParameters())) {
|
return $class && (!$constructor || !$constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null;
|
||||||
return $class->newInstance();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
|
@ -58,8 +58,7 @@ class ProxyHelper
|
|||||||
if ('self' === $lcName) {
|
if ('self' === $lcName) {
|
||||||
return $prefix.$r->getDeclaringClass()->name;
|
return $prefix.$r->getDeclaringClass()->name;
|
||||||
}
|
}
|
||||||
if ($parent = $r->getDeclaringClass()->getParentClass()) {
|
|
||||||
return $prefix.$parent->name;
|
return ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1053,9 +1053,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function getNode($position)
|
public function getNode($position)
|
||||||
{
|
{
|
||||||
if (isset($this->nodes[$position])) {
|
return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
|
||||||
return $this->nodes[$position];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1115,7 +1113,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
/**
|
/**
|
||||||
* @param string $prefix
|
* @param string $prefix
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string|null
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -1128,9 +1126,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
// ask for one namespace, otherwise we'd get a collection with an item for each node
|
// 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));
|
$namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix));
|
||||||
|
|
||||||
if ($node = $namespaces->item(0)) {
|
return ($node = $namespaces->item(0)) ? $node->nodeValue : null;
|
||||||
return $node->nodeValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,9 +72,8 @@ abstract class FormField
|
|||||||
}
|
}
|
||||||
|
|
||||||
$labels = $xpath->query('ancestor::label[1]', $this->node);
|
$labels = $xpath->query('ancestor::label[1]', $this->node);
|
||||||
if ($labels->length > 0) {
|
|
||||||
return $labels->item(0);
|
return $labels->length > 0 ? $labels->item(0) : null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
public function getListenerPriority($eventName, $listener)
|
public function getListenerPriority($eventName, $listener)
|
||||||
{
|
{
|
||||||
if (empty($this->listeners[$eventName])) {
|
if (empty($this->listeners[$eventName])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||||
@ -97,6 +97,8 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ class FilesystemTestCase extends TestCase
|
|||||||
protected $longPathNamesWindows = [];
|
protected $longPathNamesWindows = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Symfony\Component\Filesystem\Filesystem
|
* @var Filesystem
|
||||||
*/
|
*/
|
||||||
protected $filesystem = null;
|
protected $filesystem = null;
|
||||||
|
|
||||||
@ -110,9 +110,8 @@ class FilesystemTestCase extends TestCase
|
|||||||
$this->markAsSkippedIfPosixIsMissing();
|
$this->markAsSkippedIfPosixIsMissing();
|
||||||
|
|
||||||
$infos = stat($filepath);
|
$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)
|
protected function getFileGroup($filepath)
|
||||||
|
@ -140,6 +140,7 @@ abstract class AbstractExtension implements FormExtensionInterface
|
|||||||
*/
|
*/
|
||||||
protected function loadTypeGuesser()
|
protected function loadTypeGuesser()
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,9 +80,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
|||||||
// when such values are passed to
|
// when such values are passed to
|
||||||
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
||||||
// so that the call to getValue() doesn't break.
|
// so that the call to getValue() doesn't break.
|
||||||
if (\is_object($choice) || \is_array($choice)) {
|
return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
|
||||||
return $accessor->getValue($choice, $value);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,9 +111,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
|||||||
// when such values are passed to
|
// when such values are passed to
|
||||||
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
// ChoiceListInterface::getValuesForChoices(). Handle this case
|
||||||
// so that the call to getValue() doesn't break.
|
// so that the call to getValue() doesn't break.
|
||||||
if (\is_object($choice) || \is_array($choice)) {
|
return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
|
||||||
return $accessor->getValue($choice, $value);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +187,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
|||||||
return $accessor->getValue($choice, $groupBy);
|
return $accessor->getValue($choice, $groupBy);
|
||||||
} catch (UnexpectedTypeException $e) {
|
} catch (UnexpectedTypeException $e) {
|
||||||
// Don't group if path is not readable
|
// 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) > 0) {
|
||||||
if (\count($emptyKeys) === \count($this->partMapping)) {
|
if (\count($emptyKeys) === \count($this->partMapping)) {
|
||||||
// All parts empty
|
// All parts empty
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)));
|
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 (1 !== \count($choices)) {
|
||||||
if (null === $value || '' === $value) {
|
if (null === $value || '' === $value) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
|
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)
|
public function transform($dateTimeZone)
|
||||||
{
|
{
|
||||||
if (null === $dateTimeZone) {
|
if (null === $dateTimeZone) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->multiple) {
|
if ($this->multiple) {
|
||||||
@ -58,7 +58,7 @@ class DateTimeZoneToStringTransformer implements DataTransformerInterface
|
|||||||
public function reverseTransform($value)
|
public function reverseTransform($value)
|
||||||
{
|
{
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->multiple) {
|
if ($this->multiple) {
|
||||||
|
@ -251,7 +251,7 @@ class ChoiceType extends AbstractType
|
|||||||
{
|
{
|
||||||
$emptyData = function (Options $options) {
|
$emptyData = function (Options $options) {
|
||||||
if ($options['expanded'] && !$options['multiple']) {
|
if ($options['expanded'] && !$options['multiple']) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['multiple']) {
|
if ($options['multiple']) {
|
||||||
@ -284,13 +284,13 @@ class ChoiceType extends AbstractType
|
|||||||
$placeholderNormalizer = function (Options $options, $placeholder) {
|
$placeholderNormalizer = function (Options $options, $placeholder) {
|
||||||
if ($options['multiple']) {
|
if ($options['multiple']) {
|
||||||
// never use an empty value for this case
|
// never use an empty value for this case
|
||||||
return;
|
return null;
|
||||||
} elseif ($options['required'] && ($options['expanded'] || isset($options['attr']['size']) && $options['attr']['size'] > 1)) {
|
} 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
|
// placeholder for required radio buttons or a select with size > 1 does not make sense
|
||||||
return;
|
return null;
|
||||||
} elseif (false === $placeholder) {
|
} elseif (false === $placeholder) {
|
||||||
// an empty value should be added but the user decided otherwise
|
// an empty value should be added but the user decided otherwise
|
||||||
return;
|
return null;
|
||||||
} elseif ($options['expanded'] && '' === $placeholder) {
|
} elseif ($options['expanded'] && '' === $placeholder) {
|
||||||
// never use an empty label for radio buttons
|
// never use an empty label for radio buttons
|
||||||
return 'None';
|
return 'None';
|
||||||
@ -380,9 +380,6 @@ class ChoiceType extends AbstractType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $choiceView, array $options)
|
private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $choiceView, array $options)
|
||||||
{
|
{
|
||||||
$choiceOpts = [
|
$choiceOpts = [
|
||||||
|
@ -36,7 +36,7 @@ abstract class BaseValidatorExtension extends AbstractTypeExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($groups)) {
|
if (empty($groups)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_callable($groups)) {
|
if (\is_callable($groups)) {
|
||||||
|
@ -153,6 +153,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
|||||||
case 'Symfony\Component\Validator\Constraints\IsFalse':
|
case 'Symfony\Component\Validator\Constraints\IsFalse':
|
||||||
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);
|
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +170,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
|||||||
case 'Symfony\Component\Validator\Constraints\IsTrue':
|
case 'Symfony\Component\Validator\Constraints\IsTrue':
|
||||||
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
|
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,6 +200,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,6 +238,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,9 +54,7 @@ class MappingRule
|
|||||||
*/
|
*/
|
||||||
public function match($propertyPath)
|
public function match($propertyPath)
|
||||||
{
|
{
|
||||||
if ($propertyPath === $this->propertyPath) {
|
return $propertyPath === $this->propertyPath ? $this->getTarget() : null;
|
||||||
return $this->getTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -757,9 +757,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
return $this->clickedButton;
|
return $this->clickedButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
|
return $this->parent && method_exists($this->parent, 'getClickedButton') ? $this->parent->getClickedButton() : null;
|
||||||
return $this->parent->getClickedButton();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,5 +53,7 @@ class StringUtil
|
|||||||
if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
|
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 strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,5 +90,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
|
|||||||
return $extension;
|
return $extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,5 +129,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
|
|||||||
if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
|
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?)');
|
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,49 +97,49 @@ class Request
|
|||||||
/**
|
/**
|
||||||
* Custom parameters.
|
* Custom parameters.
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
* @var ParameterBag
|
||||||
*/
|
*/
|
||||||
public $attributes;
|
public $attributes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request body parameters ($_POST).
|
* Request body parameters ($_POST).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
* @var ParameterBag
|
||||||
*/
|
*/
|
||||||
public $request;
|
public $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query string parameters ($_GET).
|
* Query string parameters ($_GET).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
* @var ParameterBag
|
||||||
*/
|
*/
|
||||||
public $query;
|
public $query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server and execution environment parameters ($_SERVER).
|
* Server and execution environment parameters ($_SERVER).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\ServerBag
|
* @var ServerBag
|
||||||
*/
|
*/
|
||||||
public $server;
|
public $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uploaded files ($_FILES).
|
* Uploaded files ($_FILES).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\FileBag
|
* @var FileBag
|
||||||
*/
|
*/
|
||||||
public $files;
|
public $files;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookies ($_COOKIE).
|
* Cookies ($_COOKIE).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
* @var ParameterBag
|
||||||
*/
|
*/
|
||||||
public $cookies;
|
public $cookies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Headers (taken from the $_SERVER).
|
* Headers (taken from the $_SERVER).
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\HttpFoundation\HeaderBag
|
* @var HeaderBag
|
||||||
*/
|
*/
|
||||||
public $headers;
|
public $headers;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class Request
|
|||||||
protected $format;
|
protected $format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Symfony\Component\HttpFoundation\Session\SessionInterface
|
* @var SessionInterface
|
||||||
*/
|
*/
|
||||||
protected $session;
|
protected $session;
|
||||||
|
|
||||||
@ -1449,6 +1449,8 @@ class Request
|
|||||||
return $format;
|
return $format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ class Response
|
|||||||
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Symfony\Component\HttpFoundation\ResponseHeaderBag
|
* @var ResponseHeaderBag
|
||||||
*/
|
*/
|
||||||
public $headers;
|
public $headers;
|
||||||
|
|
||||||
@ -790,6 +790,8 @@ class Response
|
|||||||
if (null !== $this->getExpires()) {
|
if (null !== $this->getExpires()) {
|
||||||
return (int) $this->getExpires()->format('U') - (int) $this->getDate()->format('U');
|
return (int) $this->getExpires()->format('U') - (int) $this->getDate()->format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -846,6 +848,8 @@ class Response
|
|||||||
if (null !== $maxAge = $this->getMaxAge()) {
|
if (null !== $maxAge = $this->getMaxAge()) {
|
||||||
return $maxAge - $this->getAge();
|
return $maxAge - $this->getAge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,9 +87,7 @@ abstract class Bundle implements BundleInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->extension) {
|
return $this->extension ?: null;
|
||||||
return $this->extension;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,9 +197,7 @@ abstract class Bundle implements BundleInterface
|
|||||||
*/
|
*/
|
||||||
protected function createContainerExtension()
|
protected function createContainerExtension()
|
||||||
{
|
{
|
||||||
if (class_exists($class = $this->getContainerExtensionClass())) {
|
return class_exists($class = $this->getContainerExtensionClass()) ? new $class() : null;
|
||||||
return new $class();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseClassName()
|
private function parseClassName()
|
||||||
|
@ -103,17 +103,17 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
|||||||
{
|
{
|
||||||
if ($this->supportsParameterType) {
|
if ($this->supportsParameterType) {
|
||||||
if (!$type = $parameter->getType()) {
|
if (!$type = $parameter->getType()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
$name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
|
$name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
|
||||||
if ('array' === $name && !$type->isBuiltin()) {
|
if ('array' === $name && !$type->isBuiltin()) {
|
||||||
// Special case for HHVM with variadics
|
// Special case for HHVM with variadics
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) {
|
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) {
|
||||||
$name = $name[1];
|
$name = $name[1];
|
||||||
} else {
|
} else {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
$lcName = strtolower($name);
|
$lcName = strtolower($name);
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
|||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
if (!$function instanceof \ReflectionMethod) {
|
if (!$function instanceof \ReflectionMethod) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
if ('self' === $lcName) {
|
if ('self' === $lcName) {
|
||||||
return $function->getDeclaringClass()->name;
|
return $function->getDeclaringClass()->name;
|
||||||
@ -129,5 +129,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
|||||||
if ($parent = $function->getDeclaringClass()->getParentClass()) {
|
if ($parent = $function->getDeclaringClass()->getParentClass()) {
|
||||||
return $parent->name;
|
return $parent->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class FileLinkFormatter implements \Serializable
|
|||||||
$request = $this->requestStack->getMasterRequest();
|
$request = $this->requestStack->getMasterRequest();
|
||||||
if ($request instanceof Request) {
|
if ($request instanceof Request) {
|
||||||
if ($this->urlFormat instanceof \Closure && !$this->urlFormat = \call_user_func($this->urlFormat)) {
|
if ($this->urlFormat instanceof \Closure && !$this->urlFormat = \call_user_func($this->urlFormat)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -111,5 +111,7 @@ class FileLinkFormatter implements \Serializable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,5 +108,7 @@ class FragmentHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response->sendContent();
|
$response->sendContent();
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,8 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,5 +111,7 @@ class Esi extends AbstractSurrogate
|
|||||||
|
|
||||||
// remove ESI/1.0 from the Surrogate-Control header
|
// remove ESI/1.0 from the Surrogate-Control header
|
||||||
$this->removeFromControl($response);
|
$this->removeFromControl($response);
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,7 @@ class Ssi extends AbstractSurrogate
|
|||||||
|
|
||||||
// remove SSI/1.0 from the Surrogate-Control header
|
// remove SSI/1.0 from the Surrogate-Control header
|
||||||
$this->removeFromControl($response);
|
$this->removeFromControl($response);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
if (isset($collectedLogs[$message])) {
|
if (isset($collectedLogs[$message])) {
|
||||||
++$collectedLogs[$message]['count'];
|
++$collectedLogs[$message]['count'];
|
||||||
|
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
|
||||||
@ -627,6 +627,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
'trace' => $backtrace,
|
'trace' => $backtrace,
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,16 +248,19 @@ class Profiler
|
|||||||
return $this->collectors[$name];
|
return $this->collectors[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
private function getTimestamp($value)
|
private function getTimestamp($value)
|
||||||
{
|
{
|
||||||
if (null === $value || '' == $value) {
|
if (null === $value || '' == $value) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$value = new \DateTime(is_numeric($value) ? '@'.$value : $value);
|
$value = new \DateTime(is_numeric($value) ? '@'.$value : $value);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value->getTimestamp();
|
return $value->getTimestamp();
|
||||||
|
@ -88,7 +88,7 @@ class EsiTest extends TestCase
|
|||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->headers->set('Content-Type', 'text/plain');
|
$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'));
|
$this->assertFalse($response->headers->has('x-body-eval'));
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ class EsiTest extends TestCase
|
|||||||
|
|
||||||
$request = Request::create('/');
|
$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");
|
$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());
|
$this->assertEquals(' Keep this And this', $response->getContent());
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ class EsiTest extends TestCase
|
|||||||
|
|
||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$response = new Response('<esi:comment text="some comment >" /> Keep this');
|
$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());
|
$this->assertEquals(' Keep this', $response->getContent());
|
||||||
}
|
}
|
||||||
@ -121,23 +121,23 @@ class EsiTest extends TestCase
|
|||||||
|
|
||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$response = new Response('foo <esi:comment text="some comment" /><esi:include src="..." alt="alt" onerror="continue" />');
|
$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('foo <?php echo $this->surrogate->handle($this, \'...\', \'alt\', true) ?>'."\n", $response->getContent());
|
||||||
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
$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" />');
|
$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());
|
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'foo\\\'\', \'bar\\\'\', true) ?>'."\n", $response->getContent());
|
||||||
|
|
||||||
$response = new Response('foo <esi:include src="..." />');
|
$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());
|
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
|
||||||
|
|
||||||
$response = new Response('foo <esi:include src="..."></esi:include>');
|
$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());
|
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ class EsiTest extends TestCase
|
|||||||
|
|
||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$response = new Response('<?php <? <% <script language=php>');
|
$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());
|
$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('/');
|
$request = Request::create('/');
|
||||||
$response = new Response('foo <esi:include />');
|
$response = new Response('foo <esi:include />');
|
||||||
$esi->process($request, $response);
|
$this->assertSame($response, $esi->process($request, $response));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProcessRemoveSurrogateControlHeader()
|
public function testProcessRemoveSurrogateControlHeader()
|
||||||
@ -170,16 +170,16 @@ class EsiTest extends TestCase
|
|||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$response = new Response('foo <esi:include src="..." />');
|
$response = new Response('foo <esi:include src="..." />');
|
||||||
$response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
|
$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'));
|
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
|
||||||
|
|
||||||
$response->headers->set('Surrogate-Control', 'no-store, content="ESI/1.0"');
|
$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('ESI', $response->headers->get('x-body-eval'));
|
||||||
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
||||||
|
|
||||||
$response->headers->set('Surrogate-Control', 'content="ESI/1.0", no-store');
|
$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('ESI', $response->headers->get('x-body-eval'));
|
||||||
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,6 +134,8 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,6 +104,8 @@ class RegionDataGenerator extends AbstractDataGenerator
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +73,8 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +101,7 @@ class FullTransformer
|
|||||||
* @param string $dateChars The date characters to be replaced with a formatted ICU value
|
* @param string $dateChars The date characters to be replaced with a formatted ICU value
|
||||||
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
|
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
|
||||||
*
|
*
|
||||||
* @return string The formatted value
|
* @return string|null The formatted value
|
||||||
*
|
*
|
||||||
* @throws NotImplementedException When it encounters a not implemented date character
|
* @throws NotImplementedException When it encounters a not implemented date character
|
||||||
*/
|
*/
|
||||||
@ -123,6 +123,8 @@ class FullTransformer
|
|||||||
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
|
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
|
||||||
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern));
|
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,6 +198,8 @@ class FullTransformer
|
|||||||
|
|
||||||
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
|
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}, $escapedPattern);
|
}, $escapedPattern);
|
||||||
|
|
||||||
return $reverseMatchingRegExp;
|
return $reverseMatchingRegExp;
|
||||||
|
@ -104,9 +104,7 @@ final class Locale extends \Locale
|
|||||||
|
|
||||||
// Don't return default fallback for "root", "meta" or others
|
// Don't return default fallback for "root", "meta" or others
|
||||||
// Normal locales have two or three letters
|
// Normal locales have two or three letters
|
||||||
if (\strlen($locale) < 4) {
|
return \strlen($locale) < 4 ? self::$defaultFallback : null;
|
||||||
return self::$defaultFallback;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user