| @@ -99,7 +99,6 @@ | ||
| 99 | 99 | /** | 
| 100 | 100 | * Calculates the price for this specific component. | 
| 101 | 101 | * | 
| 102 | - * @param float[] $...additionalPrices Additional costs may be passed | |
| 103 | 102 | * | 
| 104 | 103 | * @return float | 
| 105 | 104 | */ | 
| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Create a project map (similar to a sitemap) of project. | |
| 4 | - * | |
| 5 | - * The Reflection component is capable of analyzing one or more files into a hierarchy of objects representing the | |
| 6 | - * structure of your project. It does this by analyzing the source code of each individual file using the | |
| 7 | - * `analyze()` method in the Analyzer class. | |
| 8 | - * | |
| 9 | - * Because the Analyzer class requires a whole series of objects that interact together a factory method `create()` | |
| 10 | - * is available. This method instantiates all objects and provides a reasonable default to start using the Analyzer. | |
| 11 | - * | |
| 12 | - * There is also a Service Provider (`\phpDocumentor\Descriptor\ServiceProvider`) that can be used with either Silex | |
| 13 | - * or Cilex instead of using the factory method; this will make it easier to plug in your own features if you want to. | |
| 14 | - */ | |
| 3 | + * Create a project map (similar to a sitemap) of project. | |
| 4 | + * | |
| 5 | + * The Reflection component is capable of analyzing one or more files into a hierarchy of objects representing the | |
| 6 | + * structure of your project. It does this by analyzing the source code of each individual file using the | |
| 7 | + * `analyze()` method in the Analyzer class. | |
| 8 | + * | |
| 9 | + * Because the Analyzer class requires a whole series of objects that interact together a factory method `create()` | |
| 10 | + * is available. This method instantiates all objects and provides a reasonable default to start using the Analyzer. | |
| 11 | + * | |
| 12 | + * There is also a Service Provider (`\phpDocumentor\Descriptor\ServiceProvider`) that can be used with either Silex | |
| 13 | + * or Cilex instead of using the factory method; this will make it easier to plug in your own features if you want to. | |
| 14 | + */ | |
| 15 | 15 | |
| 16 | 16 | // use Composer's autoloader to allow the application to automatically load all classes on request. | 
| 17 | 17 | use phpDocumentor\Reflection\Php\Project; | 
| @@ -22,16 +22,16 @@ | ||
| 22 | 22 | $projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); | 
| 23 | 23 | |
| 24 | 24 | // Create an array of files to analize. | 
| 25 | -$files = [ new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php') ]; | |
| 25 | +$files = [new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')]; | |
| 26 | 26 | |
| 27 | 27 | //create a new project 'MyProject' containing all elements in the files. | 
| 28 | 28 | /** @var Project $project */ | 
| 29 | 29 |  $project = $projectFactory->create('MyProject', $files); | 
| 30 | 30 | |
| 31 | 31 | // As an example of what you can do, let's list all class names in the file 'tests/example.file.php'. | 
| 32 | -echo 'List all classes in the example source file: ' . PHP_EOL; | |
| 32 | +echo 'List all classes in the example source file: '.PHP_EOL; | |
| 33 | 33 | |
| 34 | 34 | /** @var \phpDocumentor\Reflection\Php\Class_ $class */ | 
| 35 | 35 |  foreach ($project->getFiles()['tests/example.file.php']->getClasses() as $class) { | 
| 36 | - echo '- ' . $class->getFqsen() . PHP_EOL; | |
| 36 | + echo '- '.$class->getFqsen().PHP_EOL; | |
| 37 | 37 | } | 
| @@ -56,7 +56,7 @@ | ||
| 56 | 56 |      { | 
| 57 | 57 | $this->nodesFactory = $nodesFactory; | 
| 58 | 58 | |
| 59 | -        $lastCallable = function ($command) { | |
| 59 | +        $lastCallable = function($command) { | |
| 60 | 60 | return $this->createFile($command); | 
| 61 | 61 | }; | 
| 62 | 62 | |
| @@ -155,6 +155,7 @@ | ||
| 155 | 155 | |
| 156 | 156 | /** | 
| 157 | 157 | * @param Node[] $nodes | 
| 158 | + * @param StrategyContainer $strategies | |
| 158 | 159 | */ | 
| 159 | 160 | protected function createFileDocBlock( | 
| 160 | 161 | ?Doc $docBlock = null, | 
| @@ -16,7 +16,6 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | use phpDocumentor\Reflection\DocBlock as DocBlockInstance; | 
| 18 | 18 | use phpDocumentor\Reflection\File as FileSystemFile; | 
| 19 | -use phpDocumentor\Reflection\Fqsen; | |
| 20 | 19 | use phpDocumentor\Reflection\Middleware\ChainFactory; | 
| 21 | 20 | use phpDocumentor\Reflection\Middleware\Middleware; | 
| 22 | 21 | use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; | 
| @@ -25,7 +24,6 @@ discard block | ||
| 25 | 24 | use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; | 
| 26 | 25 | use phpDocumentor\Reflection\Php\StrategyContainer; | 
| 27 | 26 | use phpDocumentor\Reflection\Types\Context; | 
| 28 | -use phpDocumentor\Reflection\Types\ContextFactory; | |
| 29 | 27 | use phpDocumentor\Reflection\Types\NamespaceNodeToContext; | 
| 30 | 28 | use PhpParser\Comment\Doc; | 
| 31 | 29 | use PhpParser\Node; | 
| @@ -98,6 +98,7 @@ | ||
| 98 | 98 | |
| 99 | 99 | /** | 
| 100 | 100 | * Gets Namespace from the project if it exists, otherwise returns a new namepace | 
| 101 | + * @param string $name | |
| 101 | 102 | */ | 
| 102 | 103 | private function getNamespaceByName(Project $project, $name): Namespace_ | 
| 103 | 104 |      { | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 |      { | 
| 91 | 91 |          foreach ($project->getFiles() as $file) { | 
| 92 | 92 |              foreach ($file->getNamespaces() as $namespaceFqsen) { | 
| 93 | - $namespace = $this->getNamespaceByName($project, (string) $namespaceFqsen); | |
| 93 | + $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); | |
| 94 | 94 | $this->buildNamespace($file, $namespace); | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -118,31 +118,31 @@ discard block | ||
| 118 | 118 | private function buildNamespace(File $file, Namespace_ $namespace): void | 
| 119 | 119 |      { | 
| 120 | 120 |          foreach ($file->getClasses() as $class) { | 
| 121 | -            if ($namespace->getFqsen() . '\\' . $class->getName() === (string) $class->getFqsen()) { | |
| 121 | +            if ($namespace->getFqsen().'\\'.$class->getName() === (string)$class->getFqsen()) { | |
| 122 | 122 | $namespace->addClass($class->getFqsen()); | 
| 123 | 123 | } | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 |          foreach ($file->getInterfaces() as $interface) { | 
| 127 | -            if ($namespace->getFqsen() . '\\' . $interface->getName() === (string) $interface->getFqsen()) { | |
| 127 | +            if ($namespace->getFqsen().'\\'.$interface->getName() === (string)$interface->getFqsen()) { | |
| 128 | 128 | $namespace->addInterface($interface->getFqsen()); | 
| 129 | 129 | } | 
| 130 | 130 | } | 
| 131 | 131 | |
| 132 | 132 |          foreach ($file->getFunctions() as $function) { | 
| 133 | -            if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === (string) $function->getFqsen()) { | |
| 133 | +            if ($namespace->getFqsen().'\\'.$function->getName().'()' === (string)$function->getFqsen()) { | |
| 134 | 134 | $namespace->addFunction($function->getFqsen()); | 
| 135 | 135 | } | 
| 136 | 136 | } | 
| 137 | 137 | |
| 138 | 138 |          foreach ($file->getConstants() as $constant) { | 
| 139 | -            if ($namespace->getFqsen() . '::' . $constant->getName() === (string) $constant->getFqsen()) { | |
| 139 | +            if ($namespace->getFqsen().'::'.$constant->getName() === (string)$constant->getFqsen()) { | |
| 140 | 140 | $namespace->addConstant($constant->getFqsen()); | 
| 141 | 141 | } | 
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 |          foreach ($file->getTraits() as $trait) { | 
| 145 | -            if ($namespace->getFqsen() . '\\' . $trait->getName() === (string) $trait->getFqsen()) { | |
| 145 | +            if ($namespace->getFqsen().'\\'.$trait->getName() === (string)$trait->getFqsen()) { | |
| 146 | 146 | $namespace->addTrait($trait->getFqsen()); | 
| 147 | 147 | } | 
| 148 | 148 | } | 
| @@ -14,7 +14,6 @@ | ||
| 14 | 14 | |
| 15 | 15 | use Mockery as m; | 
| 16 | 16 | use phpDocumentor\Reflection\File\LocalFile; | 
| 17 | -use phpDocumentor\Reflection\Php\Factory\File; | |
| 18 | 17 | use phpDocumentor\Reflection\Php\ProjectFactory; | 
| 19 | 18 | use PHPUnit\Framework\TestCase; | 
| 20 | 19 | |
| @@ -111,6 +111,7 @@ | ||
| 111 | 111 | |
| 112 | 112 | /** | 
| 113 | 113 | * Resets the state of the object to an empty state. | 
| 114 | + * @param string $namespace | |
| 114 | 115 | */ | 
| 115 | 116 | private function resetState(?string $namespace = null): void | 
| 116 | 117 |      { | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 |      { | 
| 78 | 78 |          switch (get_class($node)) { | 
| 79 | 79 | case Namespace_::class: | 
| 80 | -                $this->resetState('\\' . $node->name . '\\'); | |
| 80 | +                $this->resetState('\\'.$node->name.'\\'); | |
| 81 | 81 | $node->fqsen = new Fqsen($this->buildName()); | 
| 82 | 82 | break; | 
| 83 | 83 | case Class_::class: | 
| @@ -91,11 +91,11 @@ discard block | ||
| 91 | 91 | $node->fqsen = new Fqsen($this->buildName()); | 
| 92 | 92 | break; | 
| 93 | 93 | case Function_::class: | 
| 94 | - $this->parts->push($node->name . '()'); | |
| 94 | + $this->parts->push($node->name.'()'); | |
| 95 | 95 | $node->fqsen = new Fqsen($this->buildName()); | 
| 96 | 96 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; | 
| 97 | 97 | case ClassMethod::class: | 
| 98 | -                $this->parts->push('::' . $node->name . '()'); | |
| 98 | +                $this->parts->push('::'.$node->name.'()'); | |
| 99 | 99 | $node->fqsen = new Fqsen($this->buildName()); | 
| 100 | 100 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; | 
| 101 | 101 | case ClassConst::class: | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | $node->fqsen = new Fqsen($this->buildName()); | 
| 107 | 107 | break; | 
| 108 | 108 | case PropertyProperty::class: | 
| 109 | -                $this->parts->push('::$' . $node->name); | |
| 109 | +                $this->parts->push('::$'.$node->name); | |
| 110 | 110 | $node->fqsen = new Fqsen($this->buildName()); | 
| 111 | 111 | break; | 
| 112 | 112 | } | 
| @@ -133,6 +133,6 @@ discard block | ||
| 133 | 133 | $name .= $part; | 
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | - return rtrim((string) $name, '\\'); | |
| 136 | + return rtrim((string)$name, '\\'); | |
| 137 | 137 | } | 
| 138 | 138 | } | 
| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | ); | 
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | -            $lastCallable = function ($command) use ($middleware, $lastCallable) { | |
| 37 | +            $lastCallable = function($command) use ($middleware, $lastCallable) { | |
| 38 | 38 | return $middleware->execute($command, $lastCallable); | 
| 39 | 39 | }; | 
| 40 | 40 | } | 
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | $classElement = new ClassElement( | 
| 63 | 63 | $object->fqsen, | 
| 64 | 64 | $docBlock, | 
| 65 | -            $object->extends ? new Fqsen('\\' . $object->extends) : null, | |
| 65 | +            $object->extends ? new Fqsen('\\'.$object->extends) : null, | |
| 66 | 66 | $object->isAbstract(), | 
| 67 | 67 | $object->isFinal(), | 
| 68 | 68 | new Location($object->getLine()) | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 |          if (isset($object->implements)) { | 
| 72 | 72 |              foreach ($object->implements as $interfaceClassName) { | 
| 73 | 73 | $classElement->addInterface( | 
| 74 | -                    new Fqsen('\\' . $interfaceClassName->toString()) | |
| 74 | +                    new Fqsen('\\'.$interfaceClassName->toString()) | |
| 75 | 75 | ); | 
| 76 | 76 | } | 
| 77 | 77 | } | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 |                  switch (get_class($stmt)) { | 
| 82 | 82 | case TraitUse::class: | 
| 83 | 83 |                          foreach ($stmt->traits as $use) { | 
| 84 | -                            $classElement->addUsedTrait(new Fqsen('\\' . $use->toString())); | |
| 84 | +                            $classElement->addUsedTrait(new Fqsen('\\'.$use->toString())); | |
| 85 | 85 | } | 
| 86 | 86 | break; | 
| 87 | 87 | case PropertyNode::class: | 
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); | 
| 59 | 59 | $parents = []; | 
| 60 | 60 |          foreach ($object->extends as $extend) { | 
| 61 | -            $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); | |
| 61 | +            $parents['\\'.(string)$extend] = new Fqsen('\\'.(string)$extend); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); |