for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Adminerng\Drivers\Redis\Forms;
use Adminerng\Core\Forms\TableForm\TableFormInterface;
use Nette\Application\UI\Form;
use Nette\Utils\ArrayHash;
use RedisProxy\RedisProxy;
class RedisCreateSetForm implements TableFormInterface
{
private $connection;
public function __construct(RedisProxy $connection)
$this->connection = $connection;
}
public function addFieldsToForm(Form $form)
$form->addText('key', 'redis.set_form.key.label')
->setRequired('redis.set_form.key.required');
'redis.set_form.key.required'
string
boolean
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);
$form->addText('members', 'redis.set_form.members.label')
->setRequired('redis.set_form.members.required')
'redis.set_form.members.required'
->setOption('description', 'redis.set_form.members.description');
public function submit(Form $form, ArrayHash $values)
$key = $values['key'];
$members = array_map('trim', explode(',', $values['members']));
call_user_func_array([$this->connection, 'sadd'], array_merge([$key], $members));
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: