for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bdf\Form\View;
/**
* Implements @see ElementViewInterface
*
* @psalm-require-implements ElementViewInterface
*/
trait ElementViewTrait
{
* @var string
private $type;
* @var string|null
private $error;
* {@inheritdoc}
public function type(): string
return $this->type;
}
public function error(): ?string
return $this->error;
public function hasError(): bool
return $this->error !== null;
public function onError($action): ?string
if (!$this->hasError()) {
return null;
return is_string($action) ? $action : $action($this);