-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample02.php
More file actions
42 lines (36 loc) · 1.22 KB
/
example02.php
File metadata and controls
42 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
error_reporting(E_ERROR);
class B {
/**
* @param string $p
* @return string
*/
function g($p) {
if (!$p) {
return null;
}
return $p;
}
}
class C extends B {
function f($p) {
return $this->$p[0];
}
/**
* @param int $p
* @return int
*/
function g($p) {
$this->p = $p;
$this->property = [42];
return $this->f($p);
}
}
print (new C)->g('property' . $undeclared_global) . "\n";
// /example02.php:11 PhanTypeMismatchReturn Returning type null but g() is declared to return string
// /example02.php:19 PhanCompatiblePHP7 Expression may not be PHP 7 compatible
// /example02.php:26 PhanParamSignatureMismatch Declaration of function g(int $p) : int should be compatible with function g(string $p) : string defined in /example02.php:9
// /example02.php:27 PhanUndeclaredProperty Reference to undeclared property \C->p
// /example02.php:28 PhanUndeclaredProperty Reference to undeclared property \C->property
// /example02.php:34 PhanTypeMismatchArgument Argument 1 (p) is string but \C::g() takes int defined at /example02.php:26
// /example02.php:34 PhanUndeclaredVariable Variable $undeclared_global is undeclared