Skip to content

Commit 8b40078

Browse files
committed
Fix psalm errors
1 parent 70f2ad1 commit 8b40078

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+360
-102
lines changed

phpcs.xml.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,27 @@
1818
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
1919
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
2020
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
21+
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations"/>
2122

2223
<exclude name="Squiz.Commenting.FunctionComment"/>
2324
</rule>
2425

26+
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
27+
<properties>
28+
<property name="forbiddenAnnotations" type="array">
29+
<element value="@author"/>
30+
<element value="@category"/>
31+
<element value="@copyright"/>
32+
<element value="@created"/>
33+
<element value="@license"/>
34+
<element value="@package"/>
35+
<element value="@since"/>
36+
<element value="@subpackage"/>
37+
<element value="@version"/>
38+
</property>
39+
</properties>
40+
</rule>
41+
2542
<rule ref="Generic.Formatting.SpaceAfterNot">
2643
<properties>
2744
<property name="spacing" value="0"/>

psalm-baseline.xml

Lines changed: 175 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,236 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.26.0@6998fabb2bf528b65777bf9941920888d23c03ac">
2+
<files psalm-version="6.8.2@720ed6b578ac24f9543c65c3d4cecea0ff348ccd">
3+
<file src="src/phpDocumentor/Reflection/File/LocalFile.php">
4+
<FalsableReturnStatement>
5+
<code><![CDATA[md5_file($this->path)]]></code>
6+
</FalsableReturnStatement>
7+
<InvalidFalsableReturnType>
8+
<code><![CDATA[string]]></code>
9+
</InvalidFalsableReturnType>
10+
<UnusedClass>
11+
<code><![CDATA[LocalFile]]></code>
12+
</UnusedClass>
13+
</file>
14+
<file src="src/phpDocumentor/Reflection/Metadata/MetaDataContainer.php">
15+
<PossiblyUnusedMethod>
16+
<code><![CDATA[addMetadata]]></code>
17+
<code><![CDATA[getMetadata]]></code>
18+
</PossiblyUnusedMethod>
19+
</file>
320
<file src="src/phpDocumentor/Reflection/Middleware/ChainFactory.php">
4-
<DocblockTypeContradiction occurrences="1">
5-
<code>gettype($middleware)</code>
6-
</DocblockTypeContradiction>
7-
<MissingClosureParamType occurrences="1">
8-
<code>$command</code>
21+
<MissingClosureParamType>
22+
<code><![CDATA[$command]]></code>
923
</MissingClosureParamType>
10-
<MixedArgument occurrences="1">
11-
<code>$command</code>
24+
<MixedArgument>
25+
<code><![CDATA[$command]]></code>
1226
</MixedArgument>
13-
<MixedArgumentTypeCoercion occurrences="1">
14-
<code>$lastCallable</code>
27+
<MixedArgumentTypeCoercion>
28+
<code><![CDATA[$lastCallable]]></code>
1529
</MixedArgumentTypeCoercion>
16-
<RedundantConditionGivenDocblockType occurrences="1">
17-
<code>is_object($middleware)</code>
18-
</RedundantConditionGivenDocblockType>
1930
</file>
2031
<file src="src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php">
21-
<NoInterfaceProperties occurrences="1">
22-
<code>$node-&gt;fqsen</code>
23-
</NoInterfaceProperties>
24-
<MixedAssignment occurrences="1">
25-
<code>$part</code>
26-
</MixedAssignment>
27-
<MixedOperand occurrences="1">
28-
<code>$part</code>
29-
</MixedOperand>
32+
<ImplicitToStringCast>
33+
<code><![CDATA[$node->name]]></code>
34+
<code><![CDATA[$node->name]]></code>
35+
<code><![CDATA[$node->name]]></code>
36+
<code><![CDATA[$node->name]]></code>
37+
<code><![CDATA[$node->name]]></code>
38+
<code><![CDATA[$part]]></code>
39+
</ImplicitToStringCast>
40+
<MixedPropertyTypeCoercion>
41+
<code><![CDATA[new SplDoublyLinkedList()]]></code>
42+
</MixedPropertyTypeCoercion>
43+
<PossiblyNullOperand>
44+
<code><![CDATA[$part]]></code>
45+
</PossiblyNullOperand>
3046
</file>
31-
<file src="src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php">
32-
<RedundantCondition occurrences="1">
33-
<code>is_object($object)</code>
34-
</RedundantCondition>
35-
<TypeDoesNotContainType occurrences="1">
36-
<code>gettype($object)</code>
37-
</TypeDoesNotContainType>
38-
</file>
39-
<file src="src/phpDocumentor/Reflection/Php/Factory/Argument.php">
40-
<PossiblyInvalidCast occurrences="1">
41-
<code>$object-&gt;var-&gt;name</code>
42-
</PossiblyInvalidCast>
43-
<RedundantConditionGivenDocblockType occurrences="1">
44-
<code>isInstanceOf</code>
45-
</RedundantConditionGivenDocblockType>
46-
<UndefinedMethod occurrences="1">
47-
<code>addArgument</code>
48-
</UndefinedMethod>
47+
<file src="src/phpDocumentor/Reflection/Php/AttributeContainer.php">
48+
<PossiblyUnusedMethod>
49+
<code><![CDATA[getAttributes]]></code>
50+
</PossiblyUnusedMethod>
4951
</file>
5052
<file src="src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php">
51-
<PossiblyUndefinedMethod occurrences="1">
52-
<code>addConstant</code>
53+
<PossiblyUndefinedMethod>
54+
<code><![CDATA[addConstant]]></code>
5355
</PossiblyUndefinedMethod>
54-
<RedundantCondition occurrences="1">
55-
<code>$const-&gt;getValue() !== null</code>
56+
<RedundantCondition>
57+
<code><![CDATA[$const->getValue() !== null]]></code>
5658
</RedundantCondition>
5759
</file>
5860
<file src="src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php">
59-
<MixedInferredReturnType occurrences="1">
60-
<code>Fqsen</code>
61-
</MixedInferredReturnType>
62-
<MixedReturnStatement occurrences="1"/>
61+
<MixedReturnStatement>
62+
<code><![CDATA[$this->classConstants->consts[$this->index]->getAttribute('fqsen')]]></code>
63+
</MixedReturnStatement>
64+
<PossiblyUnusedMethod>
65+
<code><![CDATA[getName]]></code>
66+
<code><![CDATA[isPublic]]></code>
67+
</PossiblyUnusedMethod>
6368
</file>
6469
<file src="src/phpDocumentor/Reflection/Php/Factory/Class_.php">
65-
<MixedArgument occurrences="1"/>
70+
<ImplicitToStringCast>
71+
<code><![CDATA[$object->extends]]></code>
72+
</ImplicitToStringCast>
73+
<MixedArgument>
74+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
75+
</MixedArgument>
6676
</file>
6777
<file src="src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php">
68-
<PossiblyInvalidCast occurrences="1">
69-
<code>$param-&gt;var-&gt;name</code>
78+
<ImplicitToStringCast>
79+
<code><![CDATA[$methodContainer->getFqsen()]]></code>
80+
</ImplicitToStringCast>
81+
<PossiblyInvalidCast>
82+
<code><![CDATA[$param->var->name]]></code>
7083
</PossiblyInvalidCast>
84+
<RedundantCondition>
85+
<code><![CDATA[$param->hooks]]></code>
86+
</RedundantCondition>
87+
<TypeDoesNotContainType>
88+
<code><![CDATA[[]]]></code>
89+
</TypeDoesNotContainType>
7190
</file>
7291
<file src="src/phpDocumentor/Reflection/Php/Factory/EnumCase.php">
73-
<MixedArgument occurrences="1"/>
92+
<MixedArgument>
93+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
94+
</MixedArgument>
7495
</file>
7596
<file src="src/phpDocumentor/Reflection/Php/Factory/Enum_.php">
76-
<MixedArgument occurrences="1"/>
97+
<MixedArgument>
98+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
99+
</MixedArgument>
77100
</file>
78101
<file src="src/phpDocumentor/Reflection/Php/Factory/File.php">
79-
<MissingClosureParamType occurrences="1">
80-
<code>$command</code>
102+
<MissingClosureParamType>
103+
<code><![CDATA[$command]]></code>
81104
</MissingClosureParamType>
82-
<MixedArgument occurrences="2">
83-
<code>$command</code>
84-
<code>$file</code>
105+
<MixedArgument>
106+
<code><![CDATA[$command]]></code>
107+
<code><![CDATA[$file]]></code>
85108
</MixedArgument>
86-
<MixedAssignment occurrences="1">
87-
<code>$file</code>
109+
<MixedAssignment>
110+
<code><![CDATA[$file]]></code>
88111
</MixedAssignment>
89112
</file>
90113
<file src="src/phpDocumentor/Reflection/Php/Factory/Function_.php">
91-
<DocblockTypeContradiction occurrences="1">
92-
<code>is_array($object-&gt;stmts)</code>
93-
</DocblockTypeContradiction>
94-
<MixedArgument occurrences="1"/>
114+
<MixedArgument>
115+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
116+
</MixedArgument>
95117
</file>
96118
<file src="src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php">
97-
<RedundantCondition occurrences="1">
98-
<code>$const-&gt;getValue() !== null</code>
119+
<RedundantCondition>
120+
<code><![CDATA[$const->getValue() !== null]]></code>
99121
</RedundantCondition>
100122
</file>
101123
<file src="src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php">
102-
<MixedInferredReturnType occurrences="1">
103-
<code>Fqsen</code>
104-
</MixedInferredReturnType>
105-
<MixedReturnStatement occurrences="1"/>
124+
<MixedReturnStatement>
125+
<code><![CDATA[$this->constant->consts[$this->index]->getAttribute('fqsen')]]></code>
126+
</MixedReturnStatement>
127+
<PossiblyUnusedMethod>
128+
<code><![CDATA[getName]]></code>
129+
</PossiblyUnusedMethod>
130+
</file>
131+
<file src="src/phpDocumentor/Reflection/Php/Factory/IfStatement.php">
132+
<ClassMustBeFinal>
133+
<code><![CDATA[IfStatement]]></code>
134+
</ClassMustBeFinal>
106135
</file>
107136
<file src="src/phpDocumentor/Reflection/Php/Factory/Interface_.php">
108-
<MixedArgument occurrences="1"/>
137+
<MixedArgument>
138+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
139+
</MixedArgument>
109140
</file>
110141
<file src="src/phpDocumentor/Reflection/Php/Factory/Method.php">
111-
<MixedArgument occurrences="1"/>
112-
<UndefinedMethod occurrences="1">
113-
<code>addMethod</code>
142+
<MixedArgument>
143+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
144+
</MixedArgument>
145+
<UndefinedMethod>
146+
<code><![CDATA[addMethod]]></code>
114147
</UndefinedMethod>
115148
</file>
116149
<file src="src/phpDocumentor/Reflection/Php/Factory/Namespace_.php">
117-
<DocblockTypeContradiction occurrences="1">
118-
<code>gettype($object)</code>
119-
</DocblockTypeContradiction>
120-
<MixedArgument occurrences="1"/>
121-
<RedundantConditionGivenDocblockType occurrences="1">
122-
<code>is_object($object)</code>
123-
</RedundantConditionGivenDocblockType>
150+
<ClassMustBeFinal>
151+
<code><![CDATA[Namespace_]]></code>
152+
</ClassMustBeFinal>
153+
<MixedArgument>
154+
<code><![CDATA[$object->getAttribute('fqsen') ?? new Fqsen('\\')]]></code>
155+
</MixedArgument>
156+
</file>
157+
<file src="src/phpDocumentor/Reflection/Php/Factory/Noop.php">
158+
<ClassMustBeFinal>
159+
<code><![CDATA[Noop]]></code>
160+
</ClassMustBeFinal>
124161
</file>
125162
<file src="src/phpDocumentor/Reflection/Php/Factory/Property.php">
126-
<PossiblyInvalidArgument occurrences="1">
127-
<code>$iterator-&gt;getDefault()</code>
128-
</PossiblyInvalidArgument>
129-
<UndefinedMethod occurrences="1">
130-
<code>addProperty</code>
163+
<UndefinedMethod>
164+
<code><![CDATA[addProperty]]></code>
131165
</UndefinedMethod>
132166
</file>
167+
<file src="src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php">
168+
<PropertyNotSetInConstructor>
169+
<code><![CDATA[$endLocation]]></code>
170+
<code><![CDATA[$fqsen]]></code>
171+
<code><![CDATA[$startLocation]]></code>
172+
<code><![CDATA[$type]]></code>
173+
</PropertyNotSetInConstructor>
174+
</file>
133175
<file src="src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php">
134-
<MixedInferredReturnType occurrences="1">
135-
<code>Fqsen</code>
136-
</MixedInferredReturnType>
137-
<MixedReturnStatement occurrences="1"/>
176+
<MixedReturnStatement>
177+
<code><![CDATA[$this->property->props[$this->index]->getAttribute('fqsen')]]></code>
178+
</MixedReturnStatement>
179+
<PossiblyUnusedMethod>
180+
<code><![CDATA[getName]]></code>
181+
</PossiblyUnusedMethod>
182+
</file>
183+
<file src="src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php">
184+
<ClassMustBeFinal>
185+
<code><![CDATA[Parameter]]></code>
186+
</ClassMustBeFinal>
138187
</file>
139188
<file src="src/phpDocumentor/Reflection/Php/Factory/Trait_.php">
140-
<MixedArgument occurrences="1"/>
189+
<MixedArgument>
190+
<code><![CDATA[$object->getAttribute('fqsen')]]></code>
191+
</MixedArgument>
192+
</file>
193+
<file src="src/phpDocumentor/Reflection/Php/NodesFactory.php">
194+
<ClassMustBeFinal>
195+
<code><![CDATA[NodesFactory]]></code>
196+
</ClassMustBeFinal>
197+
<PossiblyUnusedParam>
198+
<code><![CDATA[$kind]]></code>
199+
</PossiblyUnusedParam>
200+
</file>
201+
<file src="src/phpDocumentor/Reflection/Php/ProjectFactory.php">
202+
<ImplicitToStringCast>
203+
<code><![CDATA[$namespace->getFqsen()]]></code>
204+
<code><![CDATA[$namespace->getFqsen()]]></code>
205+
<code><![CDATA[$namespace->getFqsen()]]></code>
206+
<code><![CDATA[$namespace->getFqsen()]]></code>
207+
<code><![CDATA[$namespace->getFqsen()]]></code>
208+
<code><![CDATA[$namespace->getFqsen()]]></code>
209+
</ImplicitToStringCast>
210+
<PossiblyUnusedMethod>
211+
<code><![CDATA[addStrategy]]></code>
212+
<code><![CDATA[createInstance]]></code>
213+
</PossiblyUnusedMethod>
141214
</file>
142215
<file src="src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php">
143-
<MixedArgument occurrences="1">
144-
<code>$object</code>
216+
<MixedArgument>
217+
<code><![CDATA[$object]]></code>
145218
</MixedArgument>
146-
<MixedPropertyTypeCoercion occurrences="1">
147-
<code>new SplPriorityQueue()</code>
219+
<MixedPropertyTypeCoercion>
220+
<code><![CDATA[new SplPriorityQueue()]]></code>
148221
</MixedPropertyTypeCoercion>
149222
</file>
150223
<file src="src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php">
151-
<MixedInferredReturnType occurrences="1">
152-
<code>string</code>
153-
</MixedInferredReturnType>
154-
<MixedReturnStatement occurrences="1">
155-
<code>$evaluator-&gt;evaluateSilently($expr)</code>
224+
<MixedReturnStatement>
225+
<code><![CDATA[$evaluator->evaluateSilently($expr)]]></code>
156226
</MixedReturnStatement>
157227
</file>
158228
<file src="src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php">
159-
<MixedArgumentTypeCoercion occurrences="1">
160-
<code>$this-&gt;aliasesToFullyQualifiedNames($namespace)</code>
229+
<ClassMustBeFinal>
230+
<code><![CDATA[NamespaceNodeToContext]]></code>
231+
</ClassMustBeFinal>
232+
<MixedArgumentTypeCoercion>
233+
<code><![CDATA[$this->aliasesToFullyQualifiedNames($namespace)]]></code>
161234
</MixedArgumentTypeCoercion>
162235
</file>
163236
</files>

src/phpDocumentor/Reflection/Exception.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* An exception specifically originating from the Reflection component.
1818
*
1919
* @link http://phpdoc.org
20+
*
21+
* @api
2022
*/
2123
class Exception extends \Exception
2224
{

0 commit comments

Comments
 (0)