Completed
Pull Request — develop (#126)
by Chuck
10:01
created
example.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Php/Factory/DocBlock.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
      * Returns true when the strategy is able to handle the object.
49 49
      *
50 50
      *
51
-     * @param mixed $object object to check.
51
+     * @param Doc $object object to check.
52 52
      */
53 53
     public function matches($object): bool
54 54
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Php/Factory/File.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
 
155 155
     /**
156 156
      * @param Node[] $nodes
157
-     * @return null|\phpDocumentor\Reflection\DocBlock
157
+     * @return null|\phpDocumentor\Reflection\Element
158 158
      */
159 159
     protected function createFileDocBlock(
160 160
         Doc $docBlock = null,
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $this->nodesFactory = $nodesFactory;
55 55
 
56
-        $lastCallable = function ($command) {
56
+        $lastCallable = function($command) {
57 57
             return $this->createFile($command);
58 58
         };
59 59
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     private function createElements(Fqsen $namespace, $nodes, FileElement $file, StrategyContainer $strategies)
122 122
     {
123 123
         $contextFactory = new ContextFactory();
124
-        $context = $contextFactory->createForNamespace((string) $namespace, $file->getSource());
124
+        $context = $contextFactory->createForNamespace((string)$namespace, $file->getSource());
125 125
         foreach ($nodes as $node) {
126 126
             switch (get_class($node)) {
127 127
                 case ClassNode::class:
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Php/ProjectFactory.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
tests/component/ProjectNamespaceTest.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/PrettyPrinter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Php/Class_.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function addInterface(Fqsen $interface): void
134 134
     {
135
-        $this->implements[(string) $interface] = $interface;
135
+        $this->implements[(string)$interface] = $interface;
136 136
     }
137 137
 
138 138
     /**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function addConstant(Constant $constant): void
152 152
     {
153
-        $this->constants[(string) $constant->getFqsen()] = $constant;
153
+        $this->constants[(string)$constant->getFqsen()] = $constant;
154 154
     }
155 155
 
156 156
     /**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function addMethod(Method $method): void
170 170
     {
171
-        $this->methods[(string) $method->getFqsen()] = $method;
171
+        $this->methods[(string)$method->getFqsen()] = $method;
172 172
     }
173 173
 
174 174
     /**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function addProperty(Property $property): void
188 188
     {
189
-        $this->properties[(string) $property->getFqsen()] = $property;
189
+        $this->properties[(string)$property->getFqsen()] = $property;
190 190
     }
191 191
 
192 192
     /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function addUsedTrait(Fqsen $fqsen): void
206 206
     {
207
-        $this->usedTraits[(string) $fqsen] = $fqsen;
207
+        $this->usedTraits[(string)$fqsen] = $fqsen;
208 208
     }
209 209
 
210 210
     /**
Please login to merge, or discard this patch.
src/phpDocumentor/Reflection/Php/Method.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * This file is part of phpDocumentor.
Please login to merge, or discard this patch.