for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Ray\Di;
use Ray\Aop\Compiler;
final class Grapher
{
/**
* @var string
*/
private $classDir;
* @var Container
private $container;
* @param AbstractModule $module Binding module
* @param string $tmpDir Writable directory for generated AOP classes
$tmpDir
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
public function __construct(AbstractModule $module, string $classDir)
$module->install(new AssistedModule);
new \Ray\Di\AssistedModule()
object<Ray\Di\AssistedModule>
object<self>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$this->container = $module->getContainer();
$this->classDir = $classDir;
$this->container->weaveAspects(new Compiler($this->classDir));
// builtin injection
(new Bind($this->container, InjectorInterface::class))->toInstance(new Injector($module));
}
* Wakeup
public function __wakeup()
spl_autoload_register(
function (string $class) {
$file = sprintf('%s/%s.php', $this->classDir, str_replace('\\', '_', $class));
if (file_exists($file)) {
include $file; //@codeCoverageIgnore
);
* Build an object graph with give constructor parameters
*
* @param string $class class name
* @param array $params constuct paramteters
* @return mixed
public function newInstanceArgs(string $class, array $params)
return $this->container->getInstanceWithArgs($class, $params);
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.