@@ -32,7 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return FQCN |
|
35 | + * @return \Padawan\Domain\Core\FQCN |
|
36 | 36 | */ |
37 | 37 | public function getFQCN() |
38 | 38 | { |
@@ -22,6 +22,10 @@ |
||
22 | 22 | { |
23 | 23 | return $this->getParent()->getFQCN(); |
24 | 24 | } |
25 | + |
|
26 | + /** |
|
27 | + * @return \Padawan\Domain\Core\Node\ClassData |
|
28 | + */ |
|
25 | 29 | public function getClass() |
26 | 30 | { |
27 | 31 | return $this->getParent()->getClass(); |
@@ -162,6 +162,10 @@ |
||
162 | 162 | { |
163 | 163 | $this->type = $type; |
164 | 164 | } |
165 | + |
|
166 | + /** |
|
167 | + * @param integer $type |
|
168 | + */ |
|
165 | 169 | protected function addType($type) |
166 | 170 | { |
167 | 171 | $this->type |= $type; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->addType(self::T_UNKNOWN); |
59 | 59 | } |
60 | 60 | if (!$this->isReady()) { |
61 | - $this->symbol = $symbol . $this->symbol; |
|
61 | + $this->symbol = $symbol.$this->symbol; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function removeType($type) |
174 | 174 | { |
175 | - if((bool) ($this->type & $type)){ |
|
175 | + if ((bool) ($this->type & $type)) { |
|
176 | 176 | $this->type ^= $type; |
177 | 177 | } |
178 | 178 | } |
@@ -28,6 +28,10 @@ |
||
28 | 28 | $this->logger = $logger; |
29 | 29 | $this->useParser = $useParser; |
30 | 30 | } |
31 | + |
|
32 | + /** |
|
33 | + * @param string $badLine |
|
34 | + */ |
|
31 | 35 | public function getContext($badLine, Index $index, Scope $scope = null) |
32 | 36 | { |
33 | 37 | if (empty($scope)) { |
@@ -123,7 +123,7 @@ |
||
123 | 123 | if (strpos($badLine, '<?php') === false |
124 | 124 | || strpos($badLine, '<?') === false |
125 | 125 | ) { |
126 | - $badLine = '<?php ' . $badLine; |
|
126 | + $badLine = '<?php '.$badLine; |
|
127 | 127 | } |
128 | 128 | $badLine = str_replace(['elseif', 'else', 'catch'], '', $badLine); |
129 | 129 | if ($wrapFunctionCall && $badLine[strlen($badLine) - 1] === '(') { |
@@ -145,6 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | + * @param \PhpParser\Node $node |
|
148 | 149 | * @return Chain |
149 | 150 | */ |
150 | 151 | protected function createChain($node) |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $chain = $this->createChain($node); |
93 | 93 | $block = $chain; |
94 | 94 | while ($block instanceof Chain) { |
95 | - $this->logger->debug('looking for type of ' . $block->getName()); |
|
95 | + $this->logger->debug('looking for type of '.$block->getName()); |
|
96 | 96 | $event = new TypeResolveEvent($block, $type); |
97 | 97 | $this->dispatcher->dispatch(self::BLOCK_START, $event); |
98 | 98 | if ($block->getType() === 'var') { |
@@ -93,6 +93,10 @@ |
||
93 | 93 | ); |
94 | 94 | $index->addParsedFile($file); |
95 | 95 | } |
96 | + |
|
97 | + /** |
|
98 | + * @return null|FileScope |
|
99 | + */ |
|
96 | 100 | public function createScopeForFile($file, Index $index, $createCache = true) |
97 | 101 | { |
98 | 102 | $startParser = microtime(1); |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Padawan\Framework\Generator; |
4 | 4 | |
5 | -use Padawan\Domain\Core\Node\ClassData; |
|
6 | -use Padawan\Domain\Core\Node\InterfaceData; |
|
7 | 5 | use Padawan\Domain\Event\IndexGenerationEvent; |
8 | 6 | use Padawan\Domain\Core\Index; |
9 | 7 | use Padawan\Domain\Core\Project; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $end = microtime(1) - $start; |
67 | 67 | |
68 | 68 | $this->getLogger()->debug("Indexing: [$end]s"); |
69 | - $this->getLogger()->debug("Memory: " . memory_get_usage()); |
|
69 | + $this->getLogger()->debug("Memory: ".memory_get_usage()); |
|
70 | 70 | $globalTime += $end; |
71 | 71 | ++$done; |
72 | 72 | $process = floor($done / $all * 100); |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | $this->getLogger()->debug(sprintf("Processing %s interfaces", count($scope->getInterfaces()))); |
120 | 120 | $this->getLogger()->debug(sprintf("Processing %s functions", count($scope->getFunctions()))); |
121 | 121 | foreach ($scope->getClasses() as $classData) { |
122 | - $this->getLogger()->debug('Processing node ' . $classData->fqcn->toString()); |
|
122 | + $this->getLogger()->debug('Processing node '.$classData->fqcn->toString()); |
|
123 | 123 | $index->addFQCN($classData->fqcn); |
124 | 124 | $index->addClass($classData); |
125 | 125 | } |
126 | 126 | foreach ($scope->getInterfaces() as $interfaceData) { |
127 | - $this->getLogger()->debug('Processing node ' . $interfaceData->fqcn->toString()); |
|
127 | + $this->getLogger()->debug('Processing node '.$interfaceData->fqcn->toString()); |
|
128 | 128 | $index->addFQCN($interfaceData->fqcn); |
129 | 129 | $index->addInterface($interfaceData); |
130 | 130 | } |
131 | 131 | foreach ($scope->getFunctions() as $functionData) { |
132 | - $this->getLogger()->debug('Processing node ' . $functionData->name); |
|
132 | + $this->getLogger()->debug('Processing node '.$functionData->name); |
|
133 | 133 | $index->addFunction($functionData); |
134 | 134 | } |
135 | 135 | } |
@@ -35,6 +35,10 @@ discard block |
||
35 | 35 | $content = $this->path->read($file); |
36 | 36 | return $this->parseContent($file, $content, $uses, $createCache); |
37 | 37 | } |
38 | + |
|
39 | + /** |
|
40 | + * @return \Padawan\Domain\Core\Completion\Scope\FileScope |
|
41 | + */ |
|
38 | 42 | public function parseContent($file, $content, Uses $uses = null, $createCache = true) |
39 | 43 | { |
40 | 44 | if ($createCache) { |
@@ -109,6 +113,10 @@ discard block |
||
109 | 113 | } |
110 | 114 | return $nodes; |
111 | 115 | } |
116 | + |
|
117 | + /** |
|
118 | + * @param \Padawan\Domain\Core\Index $index |
|
119 | + */ |
|
112 | 120 | public function setIndex($index) |
113 | 121 | { |
114 | 122 | foreach ($this->walkers as $walker) { |
@@ -55,8 +55,7 @@ |
||
55 | 55 | if (!$createCache || $oldHash !== $hash || empty($ast)) { |
56 | 56 | try { |
57 | 57 | $ast = $this->parser->parse($content); |
58 | - } |
|
59 | - catch (\Exception $e) { |
|
58 | + } catch (\Exception $e) { |
|
60 | 59 | $this->logger->addError(sprintf("Parsing failed in file %s\n", $file)); |
61 | 60 | $this->logger->error($e); |
62 | 61 | return null; |
@@ -16,6 +16,11 @@ |
||
16 | 16 | { |
17 | 17 | $this->typeResolver = $typeResolver; |
18 | 18 | } |
19 | + |
|
20 | + /** |
|
21 | + * @param \Padawan\Domain\Core\Completion\Scope\MethodScope $scope |
|
22 | + * @param \Padawan\Domain\Core\Index $index |
|
23 | + */ |
|
19 | 24 | public function transform(Assign $node, ClassData $class, $scope, $index) |
20 | 25 | { |
21 | 26 | $fetch = $node->var; |
@@ -88,6 +88,10 @@ |
||
88 | 88 | } |
89 | 89 | return $line >= $startLine; |
90 | 90 | } |
91 | + |
|
92 | + /** |
|
93 | + * @param Node $node |
|
94 | + */ |
|
91 | 95 | public function getNodeLines($node) |
92 | 96 | { |
93 | 97 | $startLine = $endLine = -1; |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use Padawan\Domain\Core\Node\Variable; |
13 | 13 | use Padawan\Domain\Core\Completion\Scope; |
14 | 14 | use Padawan\Domain\Core\Completion\Scope\FileScope; |
15 | -use Padawan\Domain\Core\Completion\Scope\FunctionScope; |
|
16 | 15 | use Padawan\Domain\Core\Completion\Scope\MethodScope; |
17 | 16 | use Padawan\Domain\Core\Completion\Scope\ClassScope; |
18 | 17 | use Padawan\Domain\Core\Completion\Scope\ClosureScope; |