for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Port\SymfonyConsole;
use Port\Writer;
use Port\Writer\WriterTemplate;
use Symfony\Component\Console\Helper\Table;
/**
* @author Igor Mukhin <[email protected]>
*/
class TableWriter implements Writer
{
use WriterTemplate;
* @var Table
private $table;
* @var array
private $firstItem;
* @param Table $table
public function __construct(Table $table) {
$this->table = $table;
}
* {@inheritdoc}
public function writeItem(array $item) {
// Save first item to get keys to display at header
if (is_null($this->firstItem)) {
$this->firstItem = $item;
$this->table->addRow($item);
public function finish() {
$headers = $this->firstItem ? array_keys($this->firstItem) : [];
$this->table->setHeaders($headers);
$this->table->render();
$this->firstItem = null;
null
array
$firstItem
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..