for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @link https://github.com/nnx-framework/entry-name-resolver
* @author Malofeykin Andrey <[email protected]>
*/
namespace Nnx\EntryNameResolver;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\MutableCreationOptionsInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\MutableCreationOptionsTrait;
* Class ResolverByMapFactory
*
* @package Nnx\EntryNameResolver\EntryNameResolver
class ResolverByMapFactory implements FactoryInterface, MutableCreationOptionsInterface
{
use MutableCreationOptionsTrait;
* @inheritdoc
* @param ServiceLocatorInterface $serviceLocator
* @return ResolverByMap
public function createService(ServiceLocatorInterface $serviceLocator)
$creationOptions = $this->getCreationOptions();
$options = is_array($creationOptions) ? $creationOptions : [];
$options
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
return new ResolverByMap();
}
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.