for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the phpflo/phpflo package.
*
* (c) Henri Bergius <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PhpFlo\Component;
use PhpFlo\Component;
/**
* Class Counter
* @package PhpFlo\Component
* @author Henri Bergius <[email protected]>
class Counter extends Component
{
* @var null
private $count;
public function __construct()
$this->inPorts()->add('in', ['datatype' => 'bang']);
$this->outPorts()->add('count', ['datatype' => 'int']);
$this->inPorts()->in->on('data', [$this, 'appendCount']);
$this->inPorts()->in->on('disconnect', [$this, 'sendCount']);
$this->count = null;
}
* @param int|null $data
public function appendCount($data)
if (is_null($this->count)) {
$this->count = 0;
0
integer
null
$count
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..
$this->count++;
public function sendCount()
$this->outPorts()
->count
->send($this->count)
->disconnect();
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..