Issues (11)

example/index.php (2 issues)

1
<?php
2
3
use Enjoys\Cookie\Cookie;
4
5
include __DIR__."/../vendor/autoload.php";
6
//
7
//
8
//$cookieOptions = new \Enjoys\Cookie\Options();
9
//$cookieOptions->setDomain(false);
10
//$cookieOptions->setPath('/');
11
//$cookieOptions->setHttponly(true);
12
13
$cookie = new Cookie(new \Enjoys\Cookie\Options());
0 ignored issues
show
The call to Enjoys\Cookie\Options::__construct() has too few arguments starting with request. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
$cookie = new Cookie(/** @scrutinizer ignore-call */ new \Enjoys\Cookie\Options());

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
14
15
16
17
$cookie->set('token', '<>', 'session');
18
$cookie->setRaw('token4', '<>', 'session');
19
$cookie->set('token2', time(), 3600, [
20
'samesite' => 'strict'
21
]);
22
var_dump(Cookie::has('token4'));
0 ignored issues
show
Bug Best Practice introduced by
The method Enjoys\Cookie\Cookie::has() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
var_dump(Cookie::/** @scrutinizer ignore-call */ has('token4'));
Loading history...
23
//var_dump($cookie);
24
//var_dump($_COOKIE);
25