@@ -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') { |
@@ -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\Project\Node\Variable; |
13 | 13 | use Padawan\Domain\Scope; |
14 | 14 | use Padawan\Domain\Scope\FileScope; |
15 | -use Padawan\Domain\Scope\FunctionScope; |
|
16 | 15 | use Padawan\Domain\Scope\MethodScope; |
17 | 16 | use Padawan\Domain\Scope\ClassScope; |
18 | 17 | use Padawan\Domain\Scope\ClosureScope; |
@@ -52,15 +52,13 @@ |
||
52 | 52 | foreach ($node->stmts AS $child) { |
53 | 53 | if ($child instanceof ClassMethod) { |
54 | 54 | $classData->addMethod($this->parseMethod($child)); |
55 | - } |
|
56 | - elseif ($child instanceof Property) { |
|
55 | + } elseif ($child instanceof Property) { |
|
57 | 56 | foreach ($child->props AS $prop) { |
58 | 57 | $classData->addProp( |
59 | 58 | $this->parseProperty($prop, $child->type, $child->getAttribute('comments')) |
60 | 59 | ); |
61 | 60 | } |
62 | - } |
|
63 | - elseif ($child instanceof ClassConst) { |
|
61 | + } elseif ($child instanceof ClassConst) { |
|
64 | 62 | foreach ($child->consts AS $const) { |
65 | 63 | $classData->addConst($const->name); |
66 | 64 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | public function parse($content) { |
9 | 9 | try { |
10 | 10 | return parent::parse($content); |
11 | - } |
|
12 | - catch (\Exception $e) { |
|
11 | + } catch (\Exception $e) { |
|
13 | 12 | return $this->semValue; |
14 | 13 | } |
15 | 14 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | } |
13 | 13 | public function parse(Param $node) { |
14 | 14 | $param = new MethodParam($node->name); |
15 | - if ($node->type instanceof Name) |
|
16 | - $param->setFQCN($this->useParser->getFQCN($node->type)); |
|
17 | - else { |
|
15 | + if ($node->type instanceof Name) { |
|
16 | + $param->setFQCN($this->useParser->getFQCN($node->type)); |
|
17 | + } else { |
|
18 | 18 | $param->setType($node->type); |
19 | 19 | } |
20 | 20 | return $param; |
@@ -8,8 +8,7 @@ |
||
8 | 8 | public function parse($content) { |
9 | 9 | try { |
10 | 10 | return parent::parse($content); |
11 | - } |
|
12 | - catch (\Exception $e) { |
|
11 | + } catch (\Exception $e) { |
|
13 | 12 | return $this->semValue; |
14 | 13 | } |
15 | 14 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | return; |
30 | 30 | } |
31 | 31 | $arrayForInput = ['command' => $request->command]; |
32 | - foreach($request->params as $key=>$value) { |
|
33 | - $arrayForInput[$key] = $value; |
|
32 | + foreach ($request->params as $key=>$value) { |
|
33 | + $arrayForInput[$key] = $value; |
|
34 | 34 | } |
35 | 35 | $input = new ArrayInput($arrayForInput); |
36 | 36 | $command = $this->find($request->command); |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | class UseParser { |
11 | 11 | /** @var Uses */ |
12 | 12 | private $uses; |
13 | - public function parse(Use_ $node){ |
|
14 | - foreach($node->uses AS $use){ |
|
13 | + public function parse(Use_ $node) { |
|
14 | + foreach ($node->uses AS $use) { |
|
15 | 15 | $fqcn = $this->parseFQCN($use->name->toString()); |
16 | 16 | $this->uses->add($fqcn, $use->alias); |
17 | 17 | } |
@@ -21,44 +21,44 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param string $type |
23 | 23 | */ |
24 | - public function parseType($type){ |
|
24 | + public function parseType($type) { |
|
25 | 25 | $pureFQCN = $this->parseFQCN($type); |
26 | - if($pureFQCN->isScalar()){ |
|
26 | + if ($pureFQCN->isScalar()) { |
|
27 | 27 | return $pureFQCN; |
28 | 28 | } |
29 | - if(strpos($type, '\\') === 0){ |
|
29 | + if (strpos($type, '\\') === 0) { |
|
30 | 30 | return $pureFQCN; |
31 | 31 | } |
32 | 32 | $fqcn = $this->uses->find($type); |
33 | - if(!empty($fqcn)){ |
|
33 | + if (!empty($fqcn)) { |
|
34 | 34 | return $fqcn; |
35 | 35 | } |
36 | 36 | return $this->createFQCN($pureFQCN); |
37 | 37 | } |
38 | - public function getFQCN(Name $node = null){ |
|
39 | - if($node === null) { |
|
38 | + public function getFQCN(Name $node = null) { |
|
39 | + if ($node === null) { |
|
40 | 40 | return $node; |
41 | 41 | } |
42 | - if($node->isFullyQualified()){ |
|
42 | + if ($node->isFullyQualified()) { |
|
43 | 43 | return $this->parseFQCN($node->toString()); |
44 | 44 | } |
45 | 45 | $fqcn = $this->uses->find($node->getFirst()); |
46 | - if($fqcn){ |
|
46 | + if ($fqcn) { |
|
47 | 47 | return $fqcn; |
48 | 48 | } |
49 | 49 | return $this->createFQCN($node->toString()); |
50 | 50 | } |
51 | - public function parseFQCN($fqcn){ |
|
51 | + public function parseFQCN($fqcn) { |
|
52 | 52 | $fqcn = trim($fqcn, '\\'); |
53 | - if(empty($fqcn)){ |
|
53 | + if (empty($fqcn)) { |
|
54 | 54 | return new FQCN(''); |
55 | 55 | } |
56 | 56 | $parts = explode('\\', $fqcn); |
57 | 57 | $name = array_pop($parts); |
58 | 58 | $regex = '/(\w+)(\\[\\])?/'; |
59 | 59 | preg_match($regex, $name, $matches); |
60 | - if(count($matches) === 0){ |
|
61 | - throw new \Exception("Could not parse FQCN for empty class name: " . $fqcn); |
|
60 | + if (count($matches) === 0) { |
|
61 | + throw new \Exception("Could not parse FQCN for empty class name: ".$fqcn); |
|
62 | 62 | } |
63 | 63 | $name = $matches[1]; |
64 | 64 | $isArray = count($matches) === 3 && $matches[2] = '[]'; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | explode("-", $part) |
30 | 30 | )); |
31 | 31 | }, $parts)); |
32 | - $className .= "\\" . $this->pluginClassName; |
|
32 | + $className .= "\\".$this->pluginClassName; |
|
33 | 33 | try { |
34 | 34 | /** @var \Padawan\Plugin\PluginInterface */ |
35 | 35 | $plugin = $this->container->get($className); |