diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php index a8b31cc09b..a88b46fd78 100644 --- a/src/Symfony/Bridge/Monolog/Logger.php +++ b/src/Symfony/Bridge/Monolog/Logger.php @@ -73,5 +73,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface return $handler; } } + + return null; } } diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php index 599f9050af..3bb16b26c7 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php @@ -135,14 +135,14 @@ class _FirewallMap $context = $this->getFirewallContext($request); if (null === $context) { - return; + return null; } return $context->getConfig(); } /** - * @return FirewallContext + * @return FirewallContext|null */ private function getFirewallContext(Request $request) { @@ -164,5 +164,7 @@ class _FirewallMap return $this->container->get($contextId); } } + + return null; } } diff --git a/src/Symfony/Component/Console/Terminal.php b/src/Symfony/Component/Console/Terminal.php index 456cca11ca..56eb050964 100644 --- a/src/Symfony/Component/Console/Terminal.php +++ b/src/Symfony/Component/Console/Terminal.php @@ -87,25 +87,13 @@ class Terminal */ private static function getConsoleMode() { - if (!\function_exists('proc_open')) { - return; + $info = self::readFromProcess('mode CON'); + + if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { + return null; } - $descriptorspec = [ - 1 => ['pipe', 'w'], - 2 => ['pipe', 'w'], - ]; - $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); - if (\is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { - return [(int) $matches[2], (int) $matches[1]]; - } - } + return [(int) $matches[2], (int) $matches[1]]; } /** @@ -114,9 +102,19 @@ class Terminal * @return string|null */ private static function getSttyColumns() + { + return self::readFromProcess('stty -a | grep columns'); + } + + /** + * @param string $command + * + * @return string|null + */ + private static function readFromProcess($command) { if (!\function_exists('proc_open')) { - return; + return null; } $descriptorspec = [ @@ -124,14 +122,16 @@ class Terminal 2 => ['pipe', 'w'], ]; - $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); - if (\is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - return $info; + $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); + if (!\is_resource($process)) { + return null; } + + $info = stream_get_contents($pipes[1]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($process); + + return $info; } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index c8e7a0f575..f2a5b46993 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -318,7 +318,7 @@ class AutowirePass extends AbstractRecursivePass } if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { - return; + return null; } if (isset($this->autowired[$type])) { @@ -328,6 +328,8 @@ class AutowirePass extends AbstractRecursivePass if (!$this->strictMode) { return $this->createAutowiredDefinition($type); } + + return null; } /** @@ -425,7 +427,7 @@ class AutowirePass extends AbstractRecursivePass private function createAutowiredDefinition($type) { if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) { - return; + return null; } $currentId = $this->currentId; @@ -445,7 +447,7 @@ class AutowirePass extends AbstractRecursivePass $this->lastFailure = $e->getMessage(); $this->container->log($this, $this->lastFailure); - return; + return null; } finally { $this->throwOnAutowiringException = $originalThrowSetting; $this->currentId = $currentId; @@ -518,7 +520,7 @@ class AutowirePass extends AbstractRecursivePass } elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) { return ' It cannot be auto-registered because it is from a different root namespace.'; } else { - return; + return ''; } return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message); @@ -572,5 +574,7 @@ class AutowirePass extends AbstractRecursivePass if ($aliases) { return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]); } + + return null; } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 718592d8ec..60102eaa8c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -211,7 +211,7 @@ class XmlFileLoader extends FileLoader $alias->setPublic($defaults['public']); } - return; + return null; } if ($this->isLoadingInstanceof) { diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index ffd4f01aea..d0eeb16529 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -134,7 +134,7 @@ class Store implements StoreInterface $key = $this->getCacheKey($request); if (!$entries = $this->getMetadata($key)) { - return; + return null; } // find a cached entry that matches the request. @@ -148,7 +148,7 @@ class Store implements StoreInterface } if (null === $match) { - return; + return null; } $headers = $match[1]; @@ -159,6 +159,7 @@ class Store implements StoreInterface // TODO the metaStore referenced an entity that doesn't exist in // the entityStore. We definitely want to return nil but we should // also purge the entry from the meta-store when this is detected. + return null; } /** @@ -180,7 +181,7 @@ class Store implements StoreInterface if (!$response->headers->has('X-Content-Digest')) { $digest = $this->generateContentDigest($response); - if (false === $this->save($digest, $response->getContent())) { + if (!$this->save($digest, $response->getContent())) { throw new \RuntimeException('Unable to store the entity.'); } @@ -209,7 +210,7 @@ class Store implements StoreInterface array_unshift($entries, [$storedEnv, $headers]); - if (false === $this->save($key, serialize($entries))) { + if (!$this->save($key, serialize($entries))) { throw new \RuntimeException('Unable to store the metadata.'); } @@ -248,7 +249,7 @@ class Store implements StoreInterface } } - if ($modified && false === $this->save($key, serialize($entries))) { + if ($modified && !$this->save($key, serialize($entries))) { throw new \RuntimeException('Unable to store the metadata.'); } } @@ -408,6 +409,8 @@ class Store implements StoreInterface } @chmod($path, 0666 & ~umask()); + + return true; } public function getPath($key) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 83b0f1ce13..e36211bd65 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -840,6 +840,8 @@ class PropertyAccessor implements PropertyAccessorInterface return [$addMethod, $removeMethod]; } } + + return null; } /** diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index 444a08a776..c114310fc3 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -261,7 +261,7 @@ class XmlFileLoader extends FileLoader private function parseDefaultsConfig(\DOMElement $element, $path) { if ($this->isElementValueNull($element)) { - return; + return null; } // Check for existing element nodes in the default element. There can @@ -298,7 +298,7 @@ class XmlFileLoader extends FileLoader private function parseDefaultNode(\DOMElement $node, $path) { if ($this->isElementValueNull($node)) { - return; + return null; } switch ($node->localName) { diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index f63cf67bdf..fd6b7dd059 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -243,6 +243,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz return $normalizer; } } + + return null; } /** @@ -262,6 +264,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz return $normalizer; } } + + return null; } /**