Skip to content

Commit 8e0e2a3

Browse files
committed
add phpstan exceptions for things we cannot fix just yet;
1 parent e7fe79b commit 8e0e2a3

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

phpstan.neon

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
parameters:
2+
ignoreErrors:
3+
#
4+
# all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it)
5+
#
6+
# src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php
7+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#'
8+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#'
9+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#'
10+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassMethod::\$fqsen\.#'
11+
- '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#'
12+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#'
13+
#
14+
# src/phpDocumentor/Reflection/Php/Factory/Class_.php
15+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#'
16+
#
17+
# src/phpDocumentor/Reflection/Php/Factory/Trait_.php
18+
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Trait_::\$fqsen\.#'
19+
#
20+
#
21+
# this is a mismatch inside php-parser, not reflection
22+
- '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\<PhpParser\\Node>, array\<PhpParser\\Node>\|null given\.#'
23+
#
24+
#
25+
# there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser)
26+
# src/phpDocumentor/Reflection/Php/Factory/Property.php
27+
- '#Parameter \#1 \$node of method PhpParser\\PrettyPrinterAbstract::prettyPrintExpr\(\) expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|string given\.#'
28+
#
29+
#
30+
# there are some Elements doubling as Arguments, so we should probably tie their classes together somehow
31+
# src/phpDocumentor/Reflection/Php/Factory/Function_.php
32+
- '#Parameter \#1 \$argument of method phpDocumentor\\Reflection\\Php\\Function\_::addArgument\(\) expects phpDocumentor\\Reflection\\Php\\Argument, phpDocumentor\\Reflection\\Element given\.#'
33+
#
34+
#
35+
# many classes here that should have relationship to Element
36+
# src/phpDocumentor/Reflection/Php/Factory/File.php
37+
- '#Parameter \#1 \$class of method phpDocumentor\\Reflection\\Php\\File::addClass\(\) expects phpDocumentor\\Reflection\\Php\\Class\_, phpDocumentor\\Reflection\\Element given\.#'
38+
- '#Parameter \#1 \$function of method phpDocumentor\\Reflection\\Php\\File::addFunction\(\) expects phpDocumentor\\Reflection\\Php\\Function\_, phpDocumentor\\Reflection\\Element given\.#'
39+
- '#Parameter \#1 \$interface of method phpDocumentor\\Reflection\\Php\\File::addInterface\(\) expects phpDocumentor\\Reflection\\Php\\Interface\_, phpDocumentor\\Reflection\\Element given\.#'
40+
- '#Parameter \#1 \$trait of method phpDocumentor\\Reflection\\Php\\File::addTrait\(\) expects phpDocumentor\\Reflection\\Php\\Trait\_, phpDocumentor\\Reflection\\Element given\.#'
41+
#
42+
#
43+
# another class with relationship to Element
44+
# src/phpDocumentor/Reflection/Php/ProjectFactory.php
45+
- '#Parameter \#1 \$file of method phpDocumentor\\Reflection\\Php\\Project::addFile\(\) expects phpDocumentor\\Reflection\\Php\\File, phpDocumentor\\Reflection\\Element given\.#'

src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public function leaveNode(Node $node): void
6666

6767
/**
6868
* Adds fqsen property to a node when applicable.
69+
*
70+
* @todo this method is decorating the Node with an $fqsen property...
71+
* since we can't declare it in PhpParser/NodeAbstract,
72+
* we should add a decorator class wrapper in Reflection...
73+
* that should clear up the PHPSTAN errors about
74+
* "access to an undefined property ::$fqsen".
6975
*/
7076
public function enterNode(Node $node): ?int
7177
{

0 commit comments

Comments
 (0)