for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Brazanation\States\Console\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Generate extends Command
{
/**
* @var Generate\ReaderDataset
*/
private $stateReader;
* @var Generate\ClassFileWriter
private $writer;
public function __construct()
parent::__construct('states:generate');
$this->stateReader = new Generate\ReaderDataset(null);
$this->writer = new Generate\ClassFileWriter();
}
protected function configure()
$this->addArgument(
new InputArgument(
new \Symfony\Component\C...es', __DIR__ . './src')
object<Symfony\Component...le\Input\InputArgument>
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
'path',
InputArgument::REQUIRED,
'Directory to create states classes',
__DIR__ . './src'
)
);
protected function execute(InputInterface $input, OutputInterface $output)
$this->stateReader->read();
$output->writeln('Start writing files.');
foreach ($this->stateReader as $state) {
$output->write($state->getClassName() . ' ... ');
$this->writer->write($input->getArgument('path'), $state);
$output->writeln('done!');
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: