Are you sure the assignment to $this->services is correct as $this->loadServiceList($jsonFile) (which targets Gr8abbasi\Container\Fact...tory::loadServiceList()) seems to always return null.
This check looks for function or method calls that always return null and whose
return value is assigned to a variable.
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
64
{
65
if(!isset($this->serviceList[$service])) {
66
throw new NotFoundException('Service not found: ' . $service);
67
}
68
69
if (!class_exists($this->serviceList[$service]->class)) {
70
throw new ContainerException(
71
'Class does not exists: ' . $this->serviceList[$service]->class
72
);
73
}
74
75
$service = new \ReflectionClass($this->serviceList[$service]->class);
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.