Fix inconsistent return points.
This commit is contained in:
parent
41234653d5
commit
1a83f9beed
@ -73,5 +73,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface
|
|||||||
return $handler;
|
return $handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,14 +135,14 @@ class _FirewallMap
|
|||||||
$context = $this->getFirewallContext($request);
|
$context = $this->getFirewallContext($request);
|
||||||
|
|
||||||
if (null === $context) {
|
if (null === $context) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $context->getConfig();
|
return $context->getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return FirewallContext
|
* @return FirewallContext|null
|
||||||
*/
|
*/
|
||||||
private function getFirewallContext(Request $request)
|
private function getFirewallContext(Request $request)
|
||||||
{
|
{
|
||||||
@ -164,5 +164,7 @@ class _FirewallMap
|
|||||||
return $this->container->get($contextId);
|
return $this->container->get($contextId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,26 +87,14 @@ class Terminal
|
|||||||
*/
|
*/
|
||||||
private static function getConsoleMode()
|
private static function getConsoleMode()
|
||||||
{
|
{
|
||||||
if (!\function_exists('proc_open')) {
|
$info = self::readFromProcess('mode CON');
|
||||||
return;
|
|
||||||
|
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]];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs and parses stty -a if it's available, suppressing any error output.
|
* Runs and parses stty -a if it's available, suppressing any error output.
|
||||||
@ -114,9 +102,19 @@ class Terminal
|
|||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private static function getSttyColumns()
|
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')) {
|
if (!\function_exists('proc_open')) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$descriptorspec = [
|
$descriptorspec = [
|
||||||
@ -124,8 +122,11 @@ class Terminal
|
|||||||
2 => ['pipe', 'w'],
|
2 => ['pipe', 'w'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
||||||
if (\is_resource($process)) {
|
if (!\is_resource($process)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$info = stream_get_contents($pipes[1]);
|
$info = stream_get_contents($pipes[1]);
|
||||||
fclose($pipes[1]);
|
fclose($pipes[1]);
|
||||||
fclose($pipes[2]);
|
fclose($pipes[2]);
|
||||||
@ -134,4 +135,3 @@ class Terminal
|
|||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -318,7 +318,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) {
|
if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->autowired[$type])) {
|
if (isset($this->autowired[$type])) {
|
||||||
@ -328,6 +328,8 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
if (!$this->strictMode) {
|
if (!$this->strictMode) {
|
||||||
return $this->createAutowiredDefinition($type);
|
return $this->createAutowiredDefinition($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,7 +427,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
private function createAutowiredDefinition($type)
|
private function createAutowiredDefinition($type)
|
||||||
{
|
{
|
||||||
if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) {
|
if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentId = $this->currentId;
|
$currentId = $this->currentId;
|
||||||
@ -445,7 +447,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
$this->lastFailure = $e->getMessage();
|
$this->lastFailure = $e->getMessage();
|
||||||
$this->container->log($this, $this->lastFailure);
|
$this->container->log($this, $this->lastFailure);
|
||||||
|
|
||||||
return;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
$this->throwOnAutowiringException = $originalThrowSetting;
|
$this->throwOnAutowiringException = $originalThrowSetting;
|
||||||
$this->currentId = $currentId;
|
$this->currentId = $currentId;
|
||||||
@ -518,7 +520,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
} elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) {
|
} elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) {
|
||||||
return ' It cannot be auto-registered because it is from a different root namespace.';
|
return ' It cannot be auto-registered because it is from a different root namespace.';
|
||||||
} else {
|
} else {
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
|
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) {
|
if ($aliases) {
|
||||||
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
|
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
$alias->setPublic($defaults['public']);
|
$alias->setPublic($defaults['public']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isLoadingInstanceof) {
|
if ($this->isLoadingInstanceof) {
|
||||||
|
@ -134,7 +134,7 @@ class Store implements StoreInterface
|
|||||||
$key = $this->getCacheKey($request);
|
$key = $this->getCacheKey($request);
|
||||||
|
|
||||||
if (!$entries = $this->getMetadata($key)) {
|
if (!$entries = $this->getMetadata($key)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a cached entry that matches the request.
|
// find a cached entry that matches the request.
|
||||||
@ -148,7 +148,7 @@ class Store implements StoreInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $match) {
|
if (null === $match) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = $match[1];
|
$headers = $match[1];
|
||||||
@ -159,6 +159,7 @@ class Store implements StoreInterface
|
|||||||
// TODO the metaStore referenced an entity that doesn't exist in
|
// TODO the metaStore referenced an entity that doesn't exist in
|
||||||
// the entityStore. We definitely want to return nil but we should
|
// the entityStore. We definitely want to return nil but we should
|
||||||
// also purge the entry from the meta-store when this is detected.
|
// 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')) {
|
if (!$response->headers->has('X-Content-Digest')) {
|
||||||
$digest = $this->generateContentDigest($response);
|
$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.');
|
throw new \RuntimeException('Unable to store the entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +210,7 @@ class Store implements StoreInterface
|
|||||||
|
|
||||||
array_unshift($entries, [$storedEnv, $headers]);
|
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.');
|
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.');
|
throw new \RuntimeException('Unable to store the metadata.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,6 +409,8 @@ class Store implements StoreInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
@chmod($path, 0666 & ~umask());
|
@chmod($path, 0666 & ~umask());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPath($key)
|
public function getPath($key)
|
||||||
|
@ -840,6 +840,8 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
return [$addMethod, $removeMethod];
|
return [$addMethod, $removeMethod];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +261,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
private function parseDefaultsConfig(\DOMElement $element, $path)
|
private function parseDefaultsConfig(\DOMElement $element, $path)
|
||||||
{
|
{
|
||||||
if ($this->isElementValueNull($element)) {
|
if ($this->isElementValueNull($element)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for existing element nodes in the default element. There can
|
// 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)
|
private function parseDefaultNode(\DOMElement $node, $path)
|
||||||
{
|
{
|
||||||
if ($this->isElementValueNull($node)) {
|
if ($this->isElementValueNull($node)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($node->localName) {
|
switch ($node->localName) {
|
||||||
|
@ -243,6 +243,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
|||||||
return $normalizer;
|
return $normalizer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,6 +264,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
|||||||
return $normalizer;
|
return $normalizer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user