for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of Railt package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Railt\SDL\Backend\Context;
use Railt\Reflection\Contracts\Definition\TypeDefinition;
* Class AbstractContext
abstract class AbstractContext implements ContextInterface
{
* @var array|LocalContext[]
protected $types = [];
* @param TypeDefinition $type
* @return ContextInterface|LocalContext
public function create(TypeDefinition $type): ContextInterface
\assert($this instanceof LocalContextInterface);
return $this->types[$type->getName()] = new LocalContext($this, $type);
$this
this<Railt\SDL\Backend\Context\AbstractContext>
object<Railt\SDL\Backend...\LocalContextInterface>
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);
}
* @param string $type
* @return bool
protected function has(string $type): bool
return isset($this->types[$type]);
* @return string
abstract public function __toString(): string;
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: