File tree Expand file tree Collapse file tree 4 files changed +39
-3
lines changed
src/phpDocumentor/Reflection/Php/Factory Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 33
33
use PhpParser \Node \Stmt \Interface_ as InterfaceNode ;
34
34
use PhpParser \Node \Stmt \Trait_ as TraitNode ;
35
35
36
+ use function array_merge ;
36
37
use function get_class ;
37
38
use function in_array ;
38
- use function is_array ;
39
39
40
40
/**
41
41
* Strategy to create File element from the provided filename.
@@ -144,19 +144,22 @@ protected function createFileDocBlock(
144
144
array $ nodes = []
145
145
): ?DocBlockInstance {
146
146
$ node = null ;
147
+ $ comments = [];
147
148
foreach ($ nodes as $ n ) {
148
149
if (!in_array (get_class ($ n ), self ::SKIPPED_NODE_TYPES )) {
149
150
$ node = $ n ;
150
151
break ;
151
152
}
153
+
154
+ $ comments = array_merge ($ comments , $ n ->getAttribute ('comments ' , []));
152
155
}
153
156
154
157
if (!$ node instanceof Node) {
155
158
return null ;
156
159
}
157
160
158
- $ comments = $ node ->getAttribute ('comments ' );
159
- if (! is_array ( $ comments ) || empty ($ comments )) {
161
+ $ comments = array_merge ( $ comments , $ node ->getAttribute ('comments ' , []) );
162
+ if (empty ($ comments )) {
160
163
return null ;
161
164
}
162
165
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ public function fileProvider() : array
43
43
[ __DIR__ . '/data/GlobalFiles/empty.php ' ],
44
44
[ __DIR__ . '/data/GlobalFiles/empty_with_declare.php ' ],
45
45
[ __DIR__ . '/data/GlobalFiles/empty_shebang.php ' ],
46
+ [ __DIR__ . '/data/GlobalFiles/psr12.php ' ],
47
+ [ __DIR__ . '/data/GlobalFiles/docblock_followed_by_html.php ' ],
46
48
];
47
49
}
48
50
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file is part of phpDocumentor.
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ *
8
+ * @copyright 2015-2018 Mike van Riel<mike@phpdoc.org>
9
+ * @license http://www.opensource.org/licenses/mit-license.php MIT
10
+ * @link http://phpdoc.org
11
+ */
12
+ ?>
13
+ <h1>Test</h1>
14
+ <?php
15
+
16
+ require 'Pizza.php ' ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file is part of phpDocumentor.
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ *
8
+ * @copyright 2015-2018 Mike van Riel<mike@phpdoc.org>
9
+ * @license http://www.opensource.org/licenses/mit-license.php MIT
10
+ * @link http://phpdoc.org
11
+ */
12
+
13
+ declare (strict_types=1 );
14
+
15
+ require 'Pizza.php ' ;
You can’t perform that action at this time.
0 commit comments