@@ -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 | } |
@@ -4,8 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Padawan\Domain\Core\Project; |
| 6 | 6 | use Padawan\Domain\Core\Index; |
| 7 | -use Padawan\Command\ErrorCommand; |
|
| 8 | -use DI\Container; |
|
| 9 | 7 | use Padawan\Domain\Event\ProjectLoadedEvent; |
| 10 | 8 | use Padawan\Framework\Application\BaseApplication; |
| 11 | 9 | use Psr\Log\LoggerInterface; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | use Padawan\Framework\IO\Reader; |
| 14 | 14 | |
| 15 | 15 | |
| 16 | -define("STUBS_DIR", dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/stubs'); |
|
| 16 | +define("STUBS_DIR", dirname(dirname(dirname(dirname(dirname(__DIR__))))).'/stubs'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | class App extends BaseApplication |
@@ -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 | } |
@@ -19,6 +19,11 @@ |
||
| 19 | 19 | $str = serialize($project); |
| 20 | 20 | return $str; |
| 21 | 21 | } |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param string $fileName |
|
| 25 | + * @param string $data |
|
| 26 | + */ |
|
| 22 | 27 | protected function writeToFile($fileName, $data) |
| 23 | 28 | { |
| 24 | 29 | $this->getPath()->write($fileName, $data); |
@@ -14,6 +14,10 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | return $this->path->canonical($path); |
| 16 | 16 | } |
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @param string $from |
|
| 20 | + */ |
|
| 17 | 21 | public function relative($from, $to, $addDot = false) |
| 18 | 22 | { |
| 19 | 23 | $fromParts = array_values(array_filter($this->path->split($from))); |
@@ -111,6 +115,10 @@ discard block |
||
| 111 | 115 | return $file !== '.' && $file !== '..' && $file !== '.git'; |
| 112 | 116 | }); |
| 113 | 117 | } |
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @param string $dir |
|
| 121 | + */ |
|
| 114 | 122 | public function getDirFilesRecursive($dir) |
| 115 | 123 | { |
| 116 | 124 | $files = []; |