Completed
Push — master ( 0ea243...da58d4 )
by Henry
10:25 queued 33s
created

includes/Bootstrap/Cache.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Bootstrap;
3
4
use Redaxscript\Filter;
5
6
/**
7
 * children class to boot the cache
8
 *
9
 * @since 3.1.0
10
 *
11
 * @package Redaxscript
12
 * @category Bootstrap
13
 * @author Henry Ruhs
14
 */
15
16
class Cache extends BootstrapAbstract
17
{
18
	/**
19
	 * automate run
20
	 *
21
	 * @since 3.1.0
22
	 */
23
24 3
	public function autorun() : void
25
	{
26 3
		$filterBoolean = new Filter\Boolean();
27 3
		$noCache = $filterBoolean->sanitize($this->_request->getQuery('no-cache'));
0 ignored issues
show
It seems like $this->_request->getQuery('no-cache') targeting Redaxscript\Request::getQuery() can also be of type array; however, Redaxscript\Filter\Boolean::sanitize() does only seem to accept null|string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
28
29
		/* set the registry */
30
31 3
		$this->_registry->set('noCache', false);
0 ignored issues
show
false is of type boolean, but the function expects a string|array|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);
Loading history...
32 3
		if ($this->_registry->get('loggedIn') === $this->_registry->get('token') || $noCache)
33
		{
34 2
			$this->_registry->set('noCache', true);
0 ignored issues
show
true is of type boolean, but the function expects a string|array|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);
Loading history...
35
		}
36 3
	}
37
}
38