@@ -405,7 +405,7 @@ private static function _init_handle_map() : array {
405405 'PhpParser\Node\Stmt\Declare_ ' => function (PhpParser \Node \Stmt \Declare_ $ n , int $ startLine ) : \ast \Node {
406406 return self ::_ast_stmt_declare (
407407 self ::_phpparser_declare_list_to_ast_declares ($ n ->declares , $ startLine ),
408- $ n ->stmts !== null ? self ::_phpparser_stmtlist_to_ast_node ($ n ->stmts , $ startLine ) : null ,
408+ is_array ( $ n ->stmts ) ? self ::_phpparser_stmtlist_to_ast_node ($ n ->stmts , $ startLine ) : null ,
409409 $ startLine
410410 );
411411 },
@@ -466,12 +466,12 @@ private static function _init_handle_map() : array {
466466 $ startLine
467467 );
468468 },
469+ /** @suppress PhanDeprecatedProperty */
469470 'PhpParser\Node\Stmt\Namespace_ ' => function (PhpParser \Node \Stmt \Namespace_ $ n , int $ startLine ) : \ast \Node {
470471 $ nodeDumper = new \PhpParser \NodeDumper ([
471472 'dumpComments ' => true ,
472473 'dumpPositions ' => true ,
473474 ]);
474- echo $ nodeDumper ->dump ($ n );
475475 return astnode (
476476 \ast \AST_NAMESPACE ,
477477 0 ,
@@ -783,7 +783,7 @@ private static function _ast_stub($parserNode) : \ast\Node{
783783 }
784784
785785 /**
786- * @param PhpParser\Expr\ClosureUse[] $uses
786+ * @param PhpParser\Node\ Expr\ClosureUse[] $uses
787787 * @param int $line
788788 * @return ?\ast\Node
789789 */
@@ -874,7 +874,7 @@ private static function _phpparser_class_flags_to_ast_class_flags(int $flags) {
874874 * @param int $flags
875875 * @param ?string $name
876876 * @param mixed|null $extends TODO
877- * @param array $implements
877+ * @param ? array $implements
878878 * @param \ast\Node|null $stmts
879879 * @param int $line
880880 * @param int $endLine
@@ -1173,10 +1173,14 @@ private static function _extract_phpdoc_comment($comments) : ?string {
11731173 if (\is_string ($ comments )) {
11741174 return $ comments ;
11751175 }
1176- if ($ comments === null || count ( $ comments ) === 0 ) {
1176+ if ($ comments === null ) {
11771177 return null ;
11781178 }
1179- for ($ i = count ($ comments ) - 1 ; $ i >= 0 ; $ i --) {
1179+ assert (\is_array ($ comments ));
1180+ if (\count ($ comments ) === 0 ) {
1181+ return null ;
1182+ }
1183+ for ($ i = \count ($ comments ) - 1 ; $ i >= 0 ; $ i --) {
11801184 if ($ comments [$ i ] instanceof PhpParser \Comment \Doc) {
11811185 return $ comments [$ i ]->getText ();
11821186 } else {
0 commit comments