for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Star\Component\State\Transitions;
use Star\Component\State\RegistryBuilder;
use Star\Component\State\StateTransition;
use Webmozart\Assert\Assert;
final class ManyToOneTransition implements StateTransition
{
/**
* @var string
*/
private $name;
* @var string[]
private $fromStates;
private $to;
public function __construct(string $name, string $to, string ...$fromStates)
$this->name = $name;
Assert::greaterThanEq(\count($fromStates), 1, 'Expected at least %2$s state. Got: %s');
$this->fromStates = $fromStates;
$this->to = $to;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
}
public function getName(): string
return $this->name;
public function onRegister(RegistryBuilder $registry): void
foreach ($this->fromStates as $from) {
$registry->registerStartingState($this->name, $from, []);
$registry->registerDestinationState($this->name, $this->to, []);
public function getDestinationState(): string
return $this->to;
This check marks files that end in a newline character, i.e. an empy line.