Skip to content

Commit 8cc59b4

Browse files
committed
Fix inconsistent return points.
1 parent a46a86d commit 8cc59b4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Compiler/AutowirePass.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
318318
}
319319

320320
if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) {
321-
return;
321+
return null;
322322
}
323323

324324
if (isset($this->autowired[$type])) {
@@ -328,6 +328,8 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
328328
if (!$this->strictMode) {
329329
return $this->createAutowiredDefinition($type);
330330
}
331+
332+
return null;
331333
}
332334

333335
/**
@@ -425,7 +427,7 @@ private function set($type, $id)
425427
private function createAutowiredDefinition($type)
426428
{
427429
if (!($typeHint = $this->container->getReflectionClass($type, false)) || !$typeHint->isInstantiable()) {
428-
return;
430+
return null;
429431
}
430432

431433
$currentId = $this->currentId;
@@ -445,7 +447,7 @@ private function createAutowiredDefinition($type)
445447
$this->lastFailure = $e->getMessage();
446448
$this->container->log($this, $this->lastFailure);
447449

448-
return;
450+
return null;
449451
} finally {
450452
$this->throwOnAutowiringException = $originalThrowSetting;
451453
$this->currentId = $currentId;
@@ -518,7 +520,7 @@ private function createTypeAlternatives(TypedReference $reference)
518520
} elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) {
519521
return ' It cannot be auto-registered because it is from a different root namespace.';
520522
} else {
521-
return;
523+
return '';
522524
}
523525

524526
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
@@ -572,5 +574,7 @@ private function getAliasesSuggestionForType($type, $extraContext = null)
572574
if ($aliases) {
573575
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
574576
}
577+
578+
return null;
575579
}
576580
}

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
211211
$alias->setPublic($defaults['public']);
212212
}
213213

214-
return;
214+
return null;
215215
}
216216

217217
if ($this->isLoadingInstanceof) {

0 commit comments

Comments
 (0)