burzum / cakephp-html-purifier

This is a CakePHP wrapper for the HTML Purifier lib. The plugin includes a trait, a view helper, a behavior and a shell to clean your markup wherever you like, in the view or in the model layer or clean any table and field using the shell.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatible type `string`

salines opened this issue · comments

https://github.com/burzum/cakephp-html-purifier/blob/3.0-beta1/src/Lib/Purifier.php#L50

array('HTML.AllowedEleme...rializerPath' => CACHE) of type array<string,mixed|string|true> is incompatible with the type string expected by parameter $config of Burzum\HtmlPurifier\Lib\Purifier::config().

Can you please paste a whole stack trace? How can I reproduce it issue...?

How can I reproduce it issue...?

Purifier::config(
    'JvoPurifier',
    [
        'HTML.AllowedElements' => 'h1,h2,b,i,u,p,ol,ul,li,a,br',
        'HTML.AllowedAttributes' => 'a.href',
        'AutoFormat.RemoveEmpty' => true,
        'Cache.SerializerPath' => CACHE,
    ]
);

But second parameter of config method are declared as string (line 50), in that method you can also use array (line 65)

@salines line 50 doesn't matter at all this is just a doc block - that is wrong - but doesn't cause any runtime errors. The only thing complaining here is probably phpcs. The 2nd arg has no strict type. I'll fix the doc block but this is not really a problem.

Edit: It's fixed.

Yes, it's an issue related to php-doc params, but tools like the scrutinizer show a Bug message and our client is worried.

Danke.