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;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Railt\Io\Readable;
use Railt\Reflection\Contracts\Document;
use Railt\Reflection\Contracts\Reflection;
use Railt\SDL\Backend\Generator;
use Railt\SDL\Backend\Validator;
use Railt\SDL\IR\Definition;
* Class Generator
class Backend implements LoggerAwareInterface
{
use LoggerAwareTrait;
* @var Generator
private $generator;
* @var Validator
private $validator;
* Generator constructor.
* @param Reflection $reflection
public function __construct(Reflection $reflection)
$this->generator = new Generator($reflection);
$this->validator = new Validator();
}
* @param Readable $file
* @param iterable|Definition[] $ir
* @return Document
* @throws Exception\InternalException
public function run(Readable $file, iterable $ir): Document
return $this->generator->generate($file, $this->validate($ir));
$this->validate($ir)
object<Generator>
object<Railt\SDL\Backend\iterable>
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);
* @return iterable|Definition[]
private function validate(iterable $ir): iterable
foreach ($ir as $definition) {
yield $this->validator->validate($definition);
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: