fat-code /
open-api
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | namespace FatCode\OpenApi; |
||
| 4 | |||
| 5 | class FileAnalyse |
||
| 6 | { |
||
| 7 | public function getFileComments() : array |
||
| 8 | { |
||
| 9 | |||
| 10 | } |
||
|
0 ignored issues
–
show
|
|||
| 11 | |||
| 12 | public function getDeclaredFunctions() : array |
||
| 13 | { |
||
| 14 | |||
| 15 | } |
||
|
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
Loading history...
|
|||
| 16 | |||
| 17 | public function getDeclaredClasses() : array |
||
| 18 | { |
||
| 19 | |||
| 20 | } |
||
|
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
Loading history...
|
|||
| 21 | |||
| 22 | public function getDeclaredInterfaces() : array |
||
| 23 | { |
||
| 24 | |||
| 25 | } |
||
|
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
Loading history...
|
|||
| 26 | } |
||
| 27 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: