for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Realshadow\RequestDeserializer\Validation;
/**
* Extension of Purifier to make it type aware
*
* @package Realshadow\RequestDeserializer\Validation
* @author Lukáš Homza <[email protected]>
*/
class Purifier extends \Mews\Purifier\Purifier
{
* @inheritdoc
public function clean($dirty, $config = null)
if (is_array($dirty)) {
$output = array_map(function ($item) use ($config) {
return $this->clean($item, $config);
}, $dirty);
} else {
# -- the htmlpurifier uses replace instead of merge, so we merge
$output = is_string($dirty) ? $this->purifier->purify($dirty, $this->getConfig($config)) : $dirty;
$this->getConfig($config)
array
object<HTMLPurifier_Config>|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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
}
return $output;
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: