for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bdf\Form\View;
use ArrayIterator;
use BadMethodCallException;
use Iterator;
/**
* Implements @see FieldSetViewInterface
*
* @psalm-require-implements FieldSetViewInterface
*/
trait FieldSetViewTrait
{
* @var array<string, ElementViewInterface>
private $elements = [];
* {@inheritdoc}
public function offsetExists($offset): bool
return isset($this->elements[$offset]);
}
public function offsetGet($offset): ElementViewInterface
return $this->elements[$offset];
public function offsetSet($offset, $value): void
$offset
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function offsetSet(/** @scrutinizer ignore-unused */ $offset, $value): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$value
public function offsetSet($offset, /** @scrutinizer ignore-unused */ $value): void
throw new BadMethodCallException('FormView is read only');
public function offsetUnset($offset): void
public function offsetUnset(/** @scrutinizer ignore-unused */ $offset): void
public function hasError(): bool
if ($this->error() !== null) {
error()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
if ($this->/** @scrutinizer ignore-call */ error() !== null) {
return true;
foreach ($this->elements as $element) {
if ($element->hasError()) {
return false;
* @return Iterator<string, ElementViewInterface>
* @psalm-suppress ImplementedReturnTypeMismatch
public function getIterator(): Iterator
return new ArrayIterator($this->elements);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.