for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Del\Form\Field;
use Del\Form\Renderer\Field\CheckboxRender;
use Del\Form\Traits\CanRenderInlineTrait;
use Del\Form\Traits\HasOptionsTrait;
class CheckBox extends FieldAbstract implements ArrayValueInterface
{
use CanRenderInlineTrait;
use HasOptionsTrait;
/**
* We end up ignoring this during rendering Checkboxes, see the renderer for info
*
* @return string
*/
public function getTag(): string
return 'div';
}
public function init(): void
$this->setValue([]);
array()
array
string
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$this->setRenderInline(false);
$this->setRenderer(new CheckboxRender());
* @param $key
public function checkValue($key): void
$values = $this->getValue();
$values[$key] = true;
$this->setValue($values);
public function uncheckValue($key): void
$value = $this->getValue();
if (is_array($value) && in_array($key, $value, true)) {
$index = array_search($key, $value, true);
unset($value[$index]);
$this->setValue($value);
$value
} else {
$this->setValue(null);
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: