the variable you call a method on is always an object.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | /** |
||
5 | * This file is part of phpDocumentor. |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | * |
||
10 | * @author Mike van Riel <[email protected]> |
||
11 | * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) |
||
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
13 | * @link http://phpdoc.org |
||
14 | */ |
||
15 | |||
16 | namespace phpDocumentor\Transformer\Router\UrlGenerator\Standard; |
||
17 | |||
18 | use phpDocumentor\Descriptor; |
||
19 | use phpDocumentor\Transformer\Router\UrlGenerator\UrlGeneratorInterface; |
||
20 | |||
21 | class FileDescriptor implements UrlGeneratorInterface |
||
22 | { |
||
23 | /** |
||
24 | * Generates a URL from the given node or returns false if unable. |
||
25 | * |
||
26 | * @param string|Descriptor\FileDescriptor $node |
||
27 | * |
||
28 | * @return string|false |
||
29 | */ |
||
30 | 1 | public function __invoke($node) |
|
31 | { |
||
32 | 1 | $converter = new QualifiedNameToUrlConverter(); |
|
33 | |||
34 | 1 | return '/files/' . $converter->fromFile($node->getPath()) . '.html'; |
|
0 ignored issues
–
show
|
|||
35 | } |
||
36 | } |
||
37 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: