1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
This commit is contained in:
Matthew Brown 2020-08-23 13:03:25 -04:00 committed by Daniil Gentili
parent bc945b98bd
commit 8589e4af55
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 46 additions and 33 deletions

View File

@ -174,9 +174,9 @@
<xs:element name="ArgumentTypeCoercion" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="AssignmentToVoid" type="IssueHandlerType" minOccurs="0" />
<xs:element name="CircularReference" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ContinueOutsideLoop" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ConflictingReferenceConstraint" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ConstructorSignatureMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ContinueOutsideLoop" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedConstant" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedFunction" type="FunctionIssueHandlerType" minOccurs="0" />
@ -186,16 +186,15 @@
<xs:element name="DeprecatedTrait" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DocblockTypeContradiction" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateArrayKey" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateFunction" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateClass" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateFunction" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="EmptyArrayAccess" type="IssueHandlerType" minOccurs="0" />
<xs:element name="FalseOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="FalsableReturnStatement" type="IssueHandlerType" minOccurs="0" />
<xs:element name="FalseOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ForbiddenCode" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ForbiddenEcho" type="IssueHandlerType" minOccurs="0" />
<xs:element name="NoValue" type="IssueHandlerType" minOccurs="0" />
<xs:element name="IfThisIsMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImplementedParamTypeMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImplementedReturnTypeMismatch" type="IssueHandlerType" minOccurs="0" />
@ -204,8 +203,9 @@
<xs:element name="ImpureFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpureMethodCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpurePropertyAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpureStaticVariable" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpurePropertyFetch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpureStaticProperty" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ImpureStaticVariable" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InaccessibleClassConstant" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InaccessibleMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="InaccessibleProperty" type="IssueHandlerType" minOccurs="0" />
@ -220,11 +220,10 @@
<xs:element name="InvalidCast" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidCatch" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidExtendClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidClone" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidParamDefault" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidDocblock" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidDocblockParamName" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidExtendClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidFalsableReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidGlobal" type="IssueHandlerType" minOccurs="0" />
@ -232,6 +231,7 @@
<xs:element name="InvalidMethodCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidNullableReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidParamDefault" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidParent" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidPassByReference" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidPropertyAssignment" type="IssueHandlerType" minOccurs="0" />
@ -253,22 +253,23 @@
<xs:element name="LoopInvalidation" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MethodSignatureMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MethodSignatureMustOmitReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MisplacedRequiredParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MismatchingDocblockParamType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MismatchingDocblockReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MisplacedRequiredParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingClosureParamType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingClosureReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingConstructor" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingDependency" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingDocblockType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingFile" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingImmutableAnnotation" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingParamType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingPropertyType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingDocblockType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingTemplateParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingThrowsDocblock" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedArgumentTypeCoercion" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedArrayAccess" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedArrayAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedArrayOffset" type="IssueHandlerType" minOccurs="0" />
@ -281,17 +282,17 @@
<xs:element name="MixedOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyFetch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyTypeCoercion" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="MixedReturnStatement" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedReturnTypeCoercion" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedStringOffsetAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedTypeCoercion" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedArgumentTypeCoercion" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedReturnTypeCoercion" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyTypeCoercion" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="MoreSpecificReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MoreSpecificImplementedParamType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MoreSpecificReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MutableDependency" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="NoInterfaceProperties" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="NonStaticSelfCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="NoValue" type="IssueHandlerType" minOccurs="0" />
<xs:element name="NullableReturnStatement" type="IssueHandlerType" minOccurs="0" />
<xs:element name="NullArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="NullArrayAccess" type="IssueHandlerType" minOccurs="0" />
@ -304,8 +305,8 @@
<xs:element name="NullReference" type="IssueHandlerType" minOccurs="0" />
<xs:element name="OverriddenMethodAccess" type="IssueHandlerType" minOccurs="0" />
<xs:element name="OverriddenPropertyAccess" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="ParamNameMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ParadoxicalCondition" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ParamNameMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ParentNotFound" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossibleRawObjectIteration" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyFalseArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
@ -338,10 +339,10 @@
<xs:element name="PossiblyNullPropertyFetch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyNullReference" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedArrayOffset" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedIntArrayOffset" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedStringArrayOffset" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedGlobalVariable" type="VariableIssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedIntArrayOffset" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedStringArrayOffset" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUndefinedVariable" type="IssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUnusedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="PossiblyUnusedParam" type="IssueHandlerType" minOccurs="0" />
@ -356,11 +357,11 @@
<xs:element name="ReservedWord" type="IssueHandlerType" minOccurs="0" />
<xs:element name="StringIncrement" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TaintedInput" type="IssueHandlerType" minOccurs="0" />
<xs:element name="Trace" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TraitMethodSignatureMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TooFewArguments" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="TooManyArguments" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="TooManyTemplateParams" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="Trace" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TraitMethodSignatureMismatch" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TypeCoercion" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TypeDoesNotContainNull" type="IssueHandlerType" minOccurs="0" />
<xs:element name="TypeDoesNotContainType" type="IssueHandlerType" minOccurs="0" />
@ -369,6 +370,7 @@
<xs:element name="UndefinedConstant" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedDocblockClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedFunction" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedGlobalVariable" type="VariableIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedInterface" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedInterfaceMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedMagicMethod" type="MethodIssueHandlerType" minOccurs="0" />
@ -381,26 +383,25 @@
<xs:element name="UndefinedThisPropertyFetch" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedTrace" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedTrait" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedGlobalVariable" type="VariableIssueHandlerType" minOccurs="0" />
<xs:element name="UndefinedVariable" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnevaluatedCode" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnimplementedAbstractMethod" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnimplementedInterfaceMethod" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UninitializedProperty" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="UnnecessaryVarAnnotation" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnrecognizedExpression" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnrecognizedStatement" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnresolvableInclude" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnevaluatedCode" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnnecessaryVarAnnotation" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnsafeInstantiation" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedClosureParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedFunctionCall" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedMethodCall" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedVariable" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedProperty" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedPsalmSuppress" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedVariable" type="IssueHandlerType" minOccurs="0" />
</xs:choice>
</xs:complexType>

View File

@ -10,13 +10,9 @@ class A {
}
/** @psalm-pure */
function filterOdd(int $i, A $a) : ?int {
$a->a++;
function foo(int $i, A $a) : int {
$a->a = $i;
if ($i % 2 === 0 || $a->a === 2) {
return $i;
}
return null;
}
```

View File

@ -0,0 +1,16 @@
# ImpurePropertyFetch
Emitted when fetching a property value inside a function or method marked as pure.
```php
<?php
class A {
public int $a = 5;
}
/** @psalm-pure */
function foo(int $i, A $a) : int {
return $i + $a->a;
}
```