1 | <?php |
||
25 | final class Extractor |
||
26 | { |
||
27 | /** |
||
28 | * @var FileExtractor[] |
||
29 | */ |
||
30 | private $fileExtractors = []; |
||
31 | |||
32 | /** |
||
33 | * @param Finder $finder |
||
34 | * |
||
35 | * @return SourceCollection |
||
36 | */ |
||
37 | 1 | public function extract(Finder $finder) |
|
41 | |||
42 | /** |
||
43 | * @param string $dir |
||
44 | * |
||
45 | * @return SourceCollection |
||
46 | */ |
||
47 | public function extractFromDirectory($dir) |
||
54 | |||
55 | /** |
||
56 | * @param SplFileInfo $file |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 1 | private function getType(SplFileInfo $file) |
|
61 | { |
||
62 | 1 | $filename = $file->getFilename(); |
|
63 | 1 | if (preg_match('|.+\.blade\.php$|', $filename)) { |
|
64 | 1 | $ext = 'blade.php'; |
|
65 | } else { |
||
66 | 1 | $ext = $file->getExtension(); |
|
67 | } |
||
68 | |||
69 | 1 | switch ($ext) { |
|
70 | case 'php': |
||
71 | case 'php5': |
||
72 | case 'phtml': |
||
73 | 1 | return 'php'; |
|
74 | case 'twig': |
||
75 | 1 | return 'twig'; |
|
76 | case 'blade.php': |
||
77 | 1 | return 'blade'; |
|
78 | default: |
||
79 | 1 | return $ext; |
|
80 | } |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param FileExtractor $fileExtractors |
||
|
|||
85 | */ |
||
86 | 1 | public function addFileExtractor(FileExtractor $fileExtractor) |
|
90 | |||
91 | /** |
||
92 | * @param Finder $finder |
||
93 | * |
||
94 | * @return SourceCollection |
||
95 | */ |
||
96 | 1 | private function doExtract(Finder $finder) |
|
112 | } |
||
113 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.