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
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
public function newInstanceArgs(string $class, array $params)
return $this->container->getInstanceWithArgs($class, $params);
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: