Permalink
Fetching contributors…
Cannot retrieve contributors at this time
3423 lines (3333 sloc) 142 KB
<?php declare(strict_types=1);
namespace Phan;
use AssertionError;
use InvalidArgumentException;
use Phan\Config;
use Phan\Language\Context;
use Phan\Language\Element\TypedElement;
use Phan\Language\Element\UnaddressableTypedElement;
use Phan\Language\FQSEN;
use Phan\Language\Type;
use Phan\Language\UnionType;
use Phan\Plugin\ConfigPluginSet;
/**
* An issue emitted during the course of analysis
*/
class Issue
{
// phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
// this is deliberate for issue names
// Issue::CATEGORY_SYNTAX
const SyntaxError = 'PhanSyntaxError';
const InvalidConstantExpression = 'PhanInvalidConstantExpression';
const InvalidNode = 'PhanInvalidNode';
const InvalidWriteToTemporaryExpression = 'PhanInvalidWriteToTemporaryExpression';
// Issue::CATEGORY_UNDEFINED
const AmbiguousTraitAliasSource = 'PhanAmbiguousTraitAliasSource';
const ClassContainsAbstractMethodInternal = 'PhanClassContainsAbstractMethodInternal';
const ClassContainsAbstractMethod = 'PhanClassContainsAbstractMethod';
const EmptyFile = 'PhanEmptyFile';
const ParentlessClass = 'PhanParentlessClass';
const RequiredTraitNotAdded = 'PhanRequiredTraitNotAdded';
const TraitParentReference = 'PhanTraitParentReference';
const UndeclaredAliasedMethodOfTrait = 'PhanUndeclaredAliasedMethodOfTrait';
const UndeclaredClass = 'PhanUndeclaredClass';
const UndeclaredClassAliasOriginal = 'PhanUndeclaredClassAliasOriginal';
const UndeclaredClassCatch = 'PhanUndeclaredClassCatch';
const UndeclaredClassConstant = 'PhanUndeclaredClassConstant';
const UndeclaredClassInstanceof = 'PhanUndeclaredClassInstanceof';
const UndeclaredClassMethod = 'PhanUndeclaredClassMethod';
const UndeclaredClassReference = 'PhanUndeclaredClassReference';
const UndeclaredClosureScope = 'PhanUndeclaredClosureScope';
const UndeclaredConstant = 'PhanUndeclaredConstant';
const UndeclaredExtendedClass = 'PhanUndeclaredExtendedClass';
const UndeclaredFunction = 'PhanUndeclaredFunction';
const UndeclaredInterface = 'PhanUndeclaredInterface';
const UndeclaredMethod = 'PhanUndeclaredMethod';
const UndeclaredProperty = 'PhanUndeclaredProperty';
const UndeclaredStaticMethod = 'PhanUndeclaredStaticMethod';
const UndeclaredStaticProperty = 'PhanUndeclaredStaticProperty';
const UndeclaredTrait = 'PhanUndeclaredTrait';
const UndeclaredTypeParameter = 'PhanUndeclaredTypeParameter';
const UndeclaredTypeReturnType = 'PhanUndeclaredTypeReturnType';
const UndeclaredTypeProperty = 'PhanUndeclaredTypeProperty';
const UndeclaredTypeThrowsType = 'PhanUndeclaredTypeThrowsType';
const UndeclaredVariable = 'PhanUndeclaredVariable';
const UndeclaredVariableDim = 'PhanUndeclaredVariableDim';
const UndeclaredVariableAssignOp = 'PhanUndeclaredVariableAssignOp';
const UndeclaredClassInCallable = 'PhanUndeclaredClassInCallable';
const UndeclaredStaticMethodInCallable = 'PhanUndeclaredStaticMethodInCallable';
const UndeclaredFunctionInCallable = 'PhanUndeclaredFunctionInCallable';
const UndeclaredMethodInCallable = 'PhanUndeclaredMethodInCallable';
const EmptyFQSENInCallable = 'PhanEmptyFQSENInCallable';
const EmptyFQSENInClasslike = 'PhanEmptyFQSENInClasslike';
// Issue::CATEGORY_TYPE
const NonClassMethodCall = 'PhanNonClassMethodCall';
const TypeArrayOperator = 'PhanTypeArrayOperator';
const TypeArraySuspicious = 'PhanTypeArraySuspicious';
const TypeArrayUnsetSuspicious = 'PhanTypeArrayUnsetSuspicious';
const TypeArraySuspiciousNullable = 'PhanTypeArraySuspiciousNullable';
const TypeSuspiciousIndirectVariable = 'PhanTypeSuspiciousIndirectVariable';
const TypeComparisonFromArray = 'PhanTypeComparisonFromArray';
const TypeComparisonToArray = 'PhanTypeComparisonToArray';
const TypeConversionFromArray = 'PhanTypeConversionFromArray';
const TypeInstantiateAbstract = 'PhanTypeInstantiateAbstract';
const TypeInstantiateInterface = 'PhanTypeInstantiateInterface';
const TypeInvalidClosureScope = 'PhanTypeInvalidClosureScope';
const TypeInvalidLeftOperand = 'PhanTypeInvalidLeftOperand';
const TypeInvalidRightOperand = 'PhanTypeInvalidRightOperand';
const TypeInvalidLeftOperandOfAdd = 'PhanTypeInvalidLeftOperandOfAdd';
const TypeInvalidRightOperandOfAdd = 'PhanTypeInvalidRightOperandOfAdd';
const TypeInvalidLeftOperandOfNumericOp = 'PhanTypeInvalidLeftOperandOfNumericOp';
const TypeInvalidRightOperandOfNumericOp = 'PhanTypeInvalidRightOperandOfNumericOp';
const TypeInvalidUnaryOperandNumeric = 'PhanTypeInvalidUnaryOperandNumeric';
const TypeInvalidUnaryOperandBitwiseNot = 'PhanTypeInvalidUnaryOperandBitwiseNot';
const TypeInvalidInstanceof = 'PhanTypeInvalidInstanceof';
const TypeInvalidDimOffset = 'PhanTypeInvalidDimOffset';
const TypeInvalidDimOffsetArrayDestructuring = 'PhanTypeInvalidDimOffsetArrayDestructuring';
const TypeInvalidExpressionArrayDestructuring = 'PhanTypeInvalidExpressionArrayDestructuring';
const TypeInvalidThrowsNonObject = 'PhanTypeInvalidThrowsNonObject';
const TypeInvalidThrowsNonThrowable = 'PhanTypeInvalidThrowsNonThrowable';
const TypeInvalidThrowsIsTrait = 'PhanTypeInvalidThrowsIsTrait';
const TypeInvalidThrowsIsInterface = 'PhanTypeInvalidThrowsIsInterface';
const TypeMagicVoidWithReturn = 'PhanTypeMagicVoidWithReturn';
const TypeMismatchArgument = 'PhanTypeMismatchArgument';
const TypeMismatchArgumentInternal = 'PhanTypeMismatchArgumentInternal';
const PartialTypeMismatchArgument = 'PhanPartialTypeMismatchArgument';
const PartialTypeMismatchArgumentInternal = 'PhanPartialTypeMismatchArgumentInternal';
const PossiblyNullTypeArgument = 'PhanPossiblyNullTypeArgument';
const PossiblyNullTypeArgumentInternal = 'PhanPossiblyNullTypeArgumentInternal';
const PossiblyFalseTypeArgument = 'PhanPossiblyFalseTypeArgument';
const PossiblyFalseTypeArgumentInternal = 'PhanPossiblyFalseTypeArgumentInternal';
const TypeMismatchDefault = 'PhanTypeMismatchDefault';
const TypeMismatchDimAssignment = 'PhanTypeMismatchDimAssignment';
const TypeMismatchDimEmpty = 'PhanTypeMismatchDimEmpty';
const TypeMismatchDimFetch = 'PhanTypeMismatchDimFetch';
const TypeMismatchDimFetchNullable = 'PhanTypeMismatchDimFetchNullable';
const TypeMismatchUnpackKey = 'PhanTypeMismatchUnpackKey';
const TypeMismatchUnpackValue = 'PhanTypeMismatchUnpackValue';
const TypeMismatchArrayDestructuringKey = 'PhanTypeMismatchArrayDestructuringKey';
const TypeMismatchVariadicComment = 'PhanMismatchVariadicComment';
const TypeMismatchVariadicParam = 'PhanMismatchVariadicParam';
const TypeMismatchForeach = 'PhanTypeMismatchForeach';
const TypeMismatchProperty = 'PhanTypeMismatchProperty';
const PossiblyNullTypeMismatchProperty = 'PhanPossiblyNullTypeMismatchProperty';
const PossiblyFalseTypeMismatchProperty = 'PhanPossiblyFalseTypeMismatchProperty';
const PartialTypeMismatchProperty = 'PhanPartialTypeMismatchProperty';
const TypeMismatchReturn = 'PhanTypeMismatchReturn';
const PartialTypeMismatchReturn = 'PhanPartialTypeMismatchReturn';
const PossiblyNullTypeReturn = 'PhanPossiblyNullTypeReturn';
const PossiblyFalseTypeReturn = 'PhanPossiblyFalseTypeReturn';
const TypeMismatchDeclaredReturn = 'PhanTypeMismatchDeclaredReturn';
const TypeMismatchDeclaredReturnNullable = 'PhanTypeMismatchDeclaredReturnNullable';
const TypeMismatchDeclaredParam = 'PhanTypeMismatchDeclaredParam';
const TypeMismatchDeclaredParamNullable = 'PhanTypeMismatchDeclaredParamNullable';
const TypeMissingReturn = 'PhanTypeMissingReturn';
const TypeNonVarPassByRef = 'PhanTypeNonVarPassByRef';
const TypeParentConstructorCalled = 'PhanTypeParentConstructorCalled';
const TypeSuspiciousEcho = 'PhanTypeSuspiciousEcho';
const TypeSuspiciousStringExpression = 'PhanTypeSuspiciousStringExpression';
const TypeVoidAssignment = 'PhanTypeVoidAssignment';
const TypeInvalidCallableArraySize = 'PhanTypeInvalidCallableArraySize';
const TypeInvalidCallableArrayKey = 'PhanTypeInvalidCallableArrayKey';
const TypeInvalidCallableObjectOfMethod = 'PhanTypeInvalidCallableObjectOfMethod';
const TypeExpectedObject = 'PhanTypeExpectedObject';
const TypeExpectedObjectOrClassName = 'PhanTypeExpectedObjectOrClassName';
const TypeExpectedObjectOrClassNameInvalidName = 'PhanTypeExpectedObjectOrClassNameInvalidName';
const TypeExpectedObjectPropAccess = 'PhanTypeExpectedObjectPropAccess';
const TypeExpectedObjectPropAccessButGotNull = 'PhanTypeExpectedObjectPropAccessButGotNull';
const TypeExpectedObjectStaticPropAccess = 'PhanTypeExpectedObjectStaticPropAccess';
const TypeMismatchGeneratorYieldValue = 'PhanTypeMismatchGeneratorYieldValue';
const TypeMismatchGeneratorYieldKey = 'PhanTypeMismatchGeneratorYieldKey';
const TypeInvalidYieldFrom = 'PhanTypeInvalidYieldFrom';
// Issue::CATEGORY_ANALYSIS
const Unanalyzable = 'PhanUnanalyzable';
const UnanalyzableInheritance = 'PhanUnanalyzableInheritance';
// Issue::CATEGORY_VARIABLE
const VariableUseClause = 'PhanVariableUseClause';
// Issue::CATEGORY_STATIC
const StaticCallToNonStatic = 'PhanStaticCallToNonStatic';
// Issue::CATEGORY_CONTEXT
const ContextNotObject = 'PhanContextNotObject';
const ContextNotObjectInCallable = 'PhanContextNotObjectInCallable';
const ContextNotObjectUsingSelf = 'PhanContextNotObjectUsingSelf';
// Issue::CATEGORY_DEPRECATED
const DeprecatedClass = 'PhanDeprecatedClass';
const DeprecatedInterface = 'PhanDeprecatedInterface';
const DeprecatedTrait = 'PhanDeprecatedTrait';
const DeprecatedFunction = 'PhanDeprecatedFunction';
const DeprecatedFunctionInternal = 'PhanDeprecatedFunctionInternal';
const DeprecatedProperty = 'PhanDeprecatedProperty';
// Issue::CATEGORY_PARAMETER
const ParamReqAfterOpt = 'PhanParamReqAfterOpt';
const ParamSpecial1 = 'PhanParamSpecial1';
const ParamSpecial2 = 'PhanParamSpecial2';
const ParamSpecial3 = 'PhanParamSpecial3';
const ParamSpecial4 = 'PhanParamSpecial4';
const ParamSuspiciousOrder = 'PhanParamSuspiciousOrder';
const ParamTooFew = 'PhanParamTooFew';
const ParamTooFewInternal = 'PhanParamTooFewInternal';
const ParamTooFewCallable = 'PhanParamTooFewCallable';
const ParamTooMany = 'PhanParamTooMany';
const ParamTooManyInternal = 'PhanParamTooManyInternal';
const ParamTooManyCallable = 'PhanParamTooManyCallable';
const ParamTypeMismatch = 'PhanParamTypeMismatch';
const ParamSignatureMismatch = 'PhanParamSignatureMismatch';
const ParamSignatureMismatchInternal = 'PhanParamSignatureMismatchInternal';
const ParamRedefined = 'PhanParamRedefined';
const ParamSignatureRealMismatchReturnType = 'PhanParamSignatureRealMismatchReturnType';
const ParamSignatureRealMismatchReturnTypeInternal = 'PhanParamSignatureRealMismatchReturnTypeInternal';
const ParamSignaturePHPDocMismatchReturnType = 'PhanParamSignaturePHPDocMismatchReturnType';
const ParamSignatureRealMismatchTooManyRequiredParameters = 'PhanParamSignatureRealMismatchTooManyRequiredParameters';
const ParamSignatureRealMismatchTooManyRequiredParametersInternal = 'PhanParamSignatureRealMismatchTooManyRequiredParametersInternal';
const ParamSignaturePHPDocMismatchTooManyRequiredParameters = 'PhanParamSignaturePHPDocMismatchTooManyRequiredParameters';
const ParamSignatureRealMismatchTooFewParameters = 'PhanParamSignatureRealMismatchTooFewParameters';
const ParamSignatureRealMismatchTooFewParametersInternal = 'PhanParamSignatureRealMismatchTooFewParametersInternal';
const ParamSignaturePHPDocMismatchTooFewParameters = 'PhanParamSignaturePHPDocMismatchTooFewParameters';
const ParamSignatureRealMismatchHasParamType = 'PhanParamSignatureRealMismatchHasParamType';
const ParamSignatureRealMismatchHasParamTypeInternal = 'PhanParamSignatureRealMismatchHasParamTypeInternal';
const ParamSignaturePHPDocMismatchHasParamType = 'PhanParamSignaturePHPDocMismatchHasParamType';
const ParamSignatureRealMismatchHasNoParamType = 'PhanParamSignatureRealMismatchHasNoParamType';
const ParamSignatureRealMismatchHasNoParamTypeInternal = 'PhanParamSignatureRealMismatchHasNoParamTypeInternal';
const ParamSignaturePHPDocMismatchHasNoParamType = 'PhanParamSignaturePHPDocMismatchHasNoParamType';
const ParamSignatureRealMismatchParamIsReference = 'PhanParamSignatureRealMismatchParamIsReference';
const ParamSignatureRealMismatchParamIsReferenceInternal = 'PhanParamSignatureRealMismatchParamIsReferenceInternal';
const ParamSignaturePHPDocMismatchParamIsReference = 'PhanParamSignaturePHPDocMismatchParamIsReference';
const ParamSignatureRealMismatchParamIsNotReference = 'PhanParamSignatureRealMismatchParamIsNotReference';
const ParamSignatureRealMismatchParamIsNotReferenceInternal = 'PhanParamSignatureRealMismatchParamIsNotReferenceInternal';
const ParamSignaturePHPDocMismatchParamIsNotReference = 'PhanParamSignaturePHPDocMismatchParamIsNotReference';
const ParamSignatureRealMismatchParamVariadic = 'PhanParamSignatureRealMismatchParamVariadic';
const ParamSignatureRealMismatchParamVariadicInternal = 'PhanParamSignatureRealMismatchParamVariadicInternal';
const ParamSignaturePHPDocMismatchParamVariadic = 'PhanParamSignaturePHPDocMismatchParamVariadic';
const ParamSignatureRealMismatchParamNotVariadic = 'PhanParamSignatureRealMismatchParamNotVariadic';
const ParamSignatureRealMismatchParamNotVariadicInternal = 'PhanParamSignatureRealMismatchParamNotVariadicInternal';
const ParamSignaturePHPDocMismatchParamNotVariadic = 'PhanParamSignaturePHPDocMismatchParamNotVariadic';
const ParamSignatureRealMismatchParamType = 'PhanParamSignatureRealMismatchParamType';
const ParamSignatureRealMismatchParamTypeInternal = 'PhanParamSignatureRealMismatchParamTypeInternal';
const ParamSignaturePHPDocMismatchParamType = 'PhanParamSignaturePHPDocMismatchParamType';
// Issue::CATEGORY_NOOP
const NoopArray = 'PhanNoopArray';
const NoopClosure = 'PhanNoopClosure';
const NoopConstant = 'PhanNoopConstant';
const NoopProperty = 'PhanNoopProperty';
const NoopVariable = 'PhanNoopVariable';
const NoopUnaryOperator = 'PhanNoopUnaryOperator';
const NoopBinaryOperator = 'PhanNoopBinaryOperator';
const NoopStringLiteral = 'PhanNoopStringLiteral';
const NoopEncapsulatedStringLiteral = 'PhanNoopEncapsulatedStringLiteral';
const NoopNumericLiteral = 'PhanNoopNumericLiteral';
const UnreachableCatch = 'PhanUnreachableCatch';
const UnreferencedClass = 'PhanUnreferencedClass';
const UnreferencedFunction = 'PhanUnreferencedFunction';
const UnreferencedPublicMethod = 'PhanUnreferencedPublicMethod';
const UnreferencedProtectedMethod = 'PhanUnreferencedProtectedMethod';
const UnreferencedPrivateMethod = 'PhanUnreferencedPrivateMethod';
const UnreferencedPublicProperty = 'PhanUnreferencedPublicProperty';
const UnreferencedProtectedProperty = 'PhanUnreferencedProtectedProperty';
const UnreferencedPrivateProperty = 'PhanUnreferencedPrivateProperty';
const ReadOnlyPublicProperty = 'PhanReadOnlyPublicProperty';
const ReadOnlyProtectedProperty = 'PhanReadOnlyProtectedProperty';
const ReadOnlyPrivateProperty = 'PhanReadOnlyPrivateProperty';
const WriteOnlyPublicProperty = 'PhanWriteOnlyPublicProperty';
const WriteOnlyProtectedProperty = 'PhanWriteOnlyProtectedProperty';
const WriteOnlyPrivateProperty = 'PhanWriteOnlyPrivateProperty';
const UnreferencedConstant = 'PhanUnreferencedConstant';
const UnreferencedPublicClassConstant = 'PhanUnreferencedPublicClassConstant';
const UnreferencedProtectedClassConstant = 'PhanUnreferencedProtectedClassConstant';
const UnreferencedPrivateClassConstant = 'PhanUnreferencedPrivateClassConstant';
const UnreferencedClosure = 'PhanUnreferencedClosure';
const UnreferencedUseNormal = 'PhanUnreferencedUseNormal';
const UnreferencedUseFunction = 'PhanUnreferencedUseFunction';
const UnreferencedUseConstant = 'PhanUnreferencedUseConstant';
const UnusedVariable = 'PhanUnusedVariable';
const UnusedPublicMethodParameter = 'PhanUnusedPublicMethodParameter';
const UnusedPublicFinalMethodParameter = 'PhanUnusedPublicFinalMethodParameter';
const UnusedProtectedMethodParameter = 'PhanUnusedProtectedMethodParameter';
const UnusedProtectedFinalMethodParameter = 'PhanUnusedProtectedFinalMethodParameter';
const UnusedPrivateMethodParameter = 'PhanUnusedPrivateMethodParameter';
const UnusedPrivateFinalMethodParameter = 'PhanUnusedPrivateFinalMethodParameter';
const UnusedClosureUseVariable = 'PhanUnusedClosureUseVariable';
const UnusedClosureParameter = 'PhanUnusedClosureParameter';
const UnusedGlobalFunctionParameter = 'PhanUnusedGlobalFunctionParameter';
const UnusedVariableValueOfForeachWithKey = 'PhanUnusedVariableValueOfForeachWithKey'; // has higher false positive rates than UnusedVariable
const UnusedVariableCaughtException = 'PhanUnusedVariableCaughtException'; // has higher false positive rates than UnusedVariable
// Issue::CATEGORY_REDEFINE
const RedefineClass = 'PhanRedefineClass';
const RedefineClassAlias = 'PhanRedefineClassAlias';
const RedefineClassInternal = 'PhanRedefineClassInternal';
const RedefineFunction = 'PhanRedefineFunction';
const RedefineFunctionInternal = 'PhanRedefineFunctionInternal';
const IncompatibleCompositionProp = 'PhanIncompatibleCompositionProp';
const IncompatibleCompositionMethod = 'PhanIncompatibleCompositionMethod';
const RedefinedUsedTrait = 'PhanRedefinedUsedTrait';
const RedefinedInheritedInterface = 'PhanRedefinedInheritedInterface';
const RedefinedExtendedClass = 'PhanRedefinedExtendedClass';
// Issue::CATEGORY_ACCESS
const AccessPropertyPrivate = 'PhanAccessPropertyPrivate';
const AccessPropertyProtected = 'PhanAccessPropertyProtected';
const AccessMethodPrivate = 'PhanAccessMethodPrivate';
const AccessMethodPrivateWithCallMagicMethod = 'PhanAccessMethodPrivateWithCallMagicMethod';
const AccessMethodProtected = 'PhanAccessMethodProtected';
const AccessMethodProtectedWithCallMagicMethod = 'PhanAccessMethodProtectedWithCallMagicMethod';
const AccessSignatureMismatch = 'PhanAccessSignatureMismatch';
const AccessSignatureMismatchInternal = 'PhanAccessSignatureMismatchInternal';
const PropertyAccessSignatureMismatch = 'PhanPropertyAccessSignatureMismatch';
const PropertyAccessSignatureMismatchInternal = 'PhanPropertyAccessSignatureMismatchInternal';
const AccessConstantSignatureMismatch = 'PhanConstantAccessSignatureMismatch';
const AccessConstantSignatureMismatchInternal = 'PhanConstantAccessSignatureMismatchInternal';
const AccessStaticToNonStatic = 'PhanAccessStaticToNonStatic';
const AccessNonStaticToStatic = 'PhanAccessNonStaticToStatic';
const AccessStaticToNonStaticProperty = 'PhanAccessStaticToNonStaticProperty';
const AccessNonStaticToStaticProperty = 'PhanAccessNonStaticToStaticProperty';
const AccessClassConstantPrivate = 'PhanAccessClassConstantPrivate';
const AccessClassConstantProtected = 'PhanAccessClassConstantProtected';
const AccessPropertyStaticAsNonStatic = 'PhanAccessPropertyStaticAsNonStatic';
const AccessPropertyNonStaticAsStatic = 'PhanAccessPropertyNonStaticAsStatic';
const AccessOwnConstructor = 'PhanAccessOwnConstructor';
const AccessConstantInternal = 'PhanAccessConstantInternal';
const AccessClassInternal = 'PhanAccessClassInternal';
const AccessClassConstantInternal = 'PhanAccessClassConstantInternal';
const AccessPropertyInternal = 'PhanAccessPropertyInternal';
const AccessMethodInternal = 'PhanAccessMethodInternal';
const AccessWrongInheritanceCategory = 'PhanAccessWrongInheritanceCategory';
const AccessWrongInheritanceCategoryInternal = 'PhanAccessWrongInheritanceCategoryInternal';
const AccessExtendsFinalClass = 'PhanAccessExtendsFinalClass';
const AccessExtendsFinalClassInternal = 'PhanAccessExtendsFinalClassInternal';
const AccessOverridesFinalMethod = 'PhanAccessOverridesFinalMethod';
const AccessOverridesFinalMethodInternal = 'PhanAccessOverridesFinalMethodInternal';
const AccessOverridesFinalMethodPHPDoc = 'PhanAccessOverridesFinalMethodPHPDoc';
// Issue::CATEGORY_COMPATIBLE
const CompatibleExpressionPHP7 = 'PhanCompatibleExpressionPHP7';
const CompatiblePHP7 = 'PhanCompatiblePHP7';
const CompatibleNullableTypePHP70 = 'PhanCompatibleNullableTypePHP70';
const CompatibleShortArrayAssignPHP70 = 'PhanCompatibleShortArrayAssignPHP70';
const CompatibleKeyedArrayAssignPHP70 = 'PhanCompatibleKeyedArrayAssignPHP70';
const CompatibleVoidTypePHP70 = 'PhanCompatibleVoidTypePHP70';
const CompatibleIterableTypePHP70 = 'PhanCompatibleIterableTypePHP70';
const CompatibleObjectTypePHP71 = 'PhanCompatibleNullableTypePHP71';
const CompatibleUseVoidPHP70 = 'PhanCompatibleUseVoidPHP70';
const CompatibleUseIterablePHP71 = 'PhanCompatibleUseIterablePHP71';
const CompatibleUseObjectPHP71 = 'PhanCompatibleUseObjectPHP71';
const CompatibleMultiExceptionCatchPHP70 = 'PhanCompatibleMultiExceptionCatchPHP70';
const CompatibleNegativeStringOffset = 'PhanCompatibleNegativeStringOffset';
// Issue::CATEGORY_GENERIC
const TemplateTypeConstant = 'PhanTemplateTypeConstant';
const TemplateTypeStaticMethod = 'PhanTemplateTypeStaticMethod';
const TemplateTypeStaticProperty = 'PhanTemplateTypeStaticProperty';
const GenericGlobalVariable = 'PhanGenericGlobalVariable';
const GenericConstructorTypes = 'PhanGenericConstructorTypes';
// Issue::CATEGORY_COMMENT
const InvalidCommentForDeclarationType = 'PhanInvalidCommentForDeclarationType';
const MisspelledAnnotation = 'PhanMisspelledAnnotation';
const UnextractableAnnotation = 'PhanUnextractableAnnotation';
const UnextractableAnnotationPart = 'PhanUnextractableAnnotationPart';
const UnextractableAnnotationSuffix = 'PhanUnextractableAnnotationSuffix';
const UnextractableAnnotationElementName = 'PhanUnextractableAnnotationElementName';
const CommentParamWithoutRealParam = 'PhanCommentParamWithoutRealParam';
const CommentParamOnEmptyParamList = 'PhanCommentParamOnEmptyParamList';
const CommentOverrideOnNonOverrideMethod = 'PhanCommentOverrideOnNonOverrideMethod';
const CommentOverrideOnNonOverrideConstant = 'PhanCommentOverrideOnNonOverrideConstant';
const CommentParamOutOfOrder = 'PhanCommentParamOutOfOrder';
const ThrowTypeAbsent = 'PhanThrowTypeAbsent';
const ThrowTypeAbsentForCall = 'PhanThrowTypeAbsentForCall';
const ThrowTypeMismatch = 'PhanThrowTypeMismatch';
const ThrowTypeMismatchForCall = 'PhanThrowTypeMismatchForCall';
const CommentAmbiguousClosure = 'PhanCommentAmbiguousClosure';
const CommentDuplicateParam = 'PhanCommentDuplicateParam';
const CommentDuplicateMagicMethod = 'PhanCommentDuplicateMagicMethod';
const CommentDuplicateMagicProperty = 'PhanCommentDuplicateMagicProperty';
// phpcs:enable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
// end of issue name constants
const CATEGORY_ACCESS = 1 << 1;
const CATEGORY_ANALYSIS = 1 << 2;
const CATEGORY_COMPATIBLE = 1 << 3;
const CATEGORY_CONTEXT = 1 << 4;
const CATEGORY_DEPRECATED = 1 << 5;
const CATEGORY_NOOP = 1 << 6;
const CATEGORY_PARAMETER = 1 << 7;
const CATEGORY_REDEFINE = 1 << 8;
const CATEGORY_STATIC = 1 << 9;
const CATEGORY_TYPE = 1 << 10;
const CATEGORY_UNDEFINED = 1 << 11;
const CATEGORY_VARIABLE = 1 << 12;
const CATEGORY_PLUGIN = 1 << 13;
const CATEGORY_GENERIC = 1 << 14;
const CATEGORY_INTERNAL = 1 << 15;
const CATEGORY_COMMENT = 1 << 16;
const CATEGORY_SYNTAX = 1 << 17;
const CATEGORY_NAME = [
self::CATEGORY_ACCESS => 'AccessError',
self::CATEGORY_ANALYSIS => 'Analysis',
self::CATEGORY_COMMENT => 'CommentError',
self::CATEGORY_COMPATIBLE => 'CompatError',
self::CATEGORY_CONTEXT => 'Context',
self::CATEGORY_DEPRECATED => 'DeprecatedError',
self::CATEGORY_GENERIC => 'Generic',
self::CATEGORY_INTERNAL => 'Internal',
self::CATEGORY_NOOP => 'NOOPError',
self::CATEGORY_PARAMETER => 'ParamError',
self::CATEGORY_PLUGIN => 'Plugin',
self::CATEGORY_REDEFINE => 'RedefineError',
self::CATEGORY_STATIC => 'StaticCallError',
self::CATEGORY_SYNTAX => 'Syntax',
self::CATEGORY_TYPE => 'TypeError',
self::CATEGORY_UNDEFINED => 'UndefError',
self::CATEGORY_VARIABLE => 'VarError',
];
/** Low severity. E.g. documentation errors or code that would cause a (typically harmless) PHP notice. */
const SEVERITY_LOW = 0;
/** Normal severity. E.g. something that may cause a minor bug. */
const SEVERITY_NORMAL = 5;
/** Highest severity. Likely to cause an uncaught Error, Exception, or fatal error at runtime. */
const SEVERITY_CRITICAL = 10;
// See https://docs.codeclimate.com/v1.0/docs/remediation
// TODO: Decide on a way to estimate these and bring these up to date once codeclimate updates phan.
// Right now, almost everything is REMEDIATION_B.
const REMEDIATION_A = 1000000;
const REMEDIATION_B = 3000000;
/** @suppress PhanUnreferencedPublicClassConstant */
const REMEDIATION_C = 6000000;
/** @suppress PhanUnreferencedPublicClassConstant */
const REMEDIATION_D = 12000000;
/** @suppress PhanUnreferencedPublicClassConstant */
const REMEDIATION_E = 16000000;
/** @suppress PhanUnreferencedPublicClassConstant */
const REMEDIATION_F = 18000000;
// type id constants.
const TYPE_ID_UNKNOWN = 999;
// Keep sorted and in sync with Colorizing::default_color_for_template
const UNCOLORED_FORMAT_STRING_FOR_TEMPLATE = [
'CLASS' => '%s',
'CLASSLIKE' => '%s',
'CODE' => '%s', // A snippet from the code
'COMMENT' => '%s', // contents of a phpdoc comment
'CONST' => '%s',
'COUNT' => '%d',
'DETAILS' => '%s', // additional details about an error
'FILE' => '%s',
'FUNCTIONLIKE' => '%s',
'FUNCTION' => '%s',
'INDEX' => '%d',
'INTERFACE' => '%s',
'ISSUETYPE' => '%s', // used by Phan\Output\Printer, for minor issues.
'ISSUETYPE_CRITICAL' => '%s', // for critical issues
'ISSUETYPE_NORMAL' => '%s', // for normal issues
'LINE' => '%d',
'METHOD' => '%s',
'NAMESPACE' => '%s',
'OPERATOR' => '%s',
'PARAMETER' => '%s',
'PROPERTY' => '%s',
'SCALAR' => '%s', // A scalar from the code
'STRING_LITERAL' => '%s', // A string literal from the code
'SUGGESTION' => '%s',
'TYPE' => '%s',
'TRAIT' => '%s',
'VARIABLE' => '%s',
];
/** @var string */
private $type;
/** @var int */
private $type_id;
/** @var int */
private $category;
/** @var int */
private $severity;
/** @var string - Used for colorizing option. */
private $template_raw;
/** @var string */
private $template;
/** @var int */
private $remediation_difficulty;
/**
* @param string $type
* @param int $category
* @param int $severity
* @param string $template_raw - Contains a mix of {CLASS} and %s/%d annotations.
* @param int $remediation_difficulty
* @param int $type_id (unique integer id for $type)
*/
public function __construct(
string $type,
int $category,
int $severity,
string $template_raw,
int $remediation_difficulty,
int $type_id
) {
$this->type = $type;
$this->category = $category;
$this->severity = $severity;
$this->template_raw = $template_raw;
$this->template = self::templateToFormatString($template_raw);
$this->remediation_difficulty = $remediation_difficulty;
$this->type_id = $type_id;
}
private static function templateToFormatString(
string $template
) : string {
/** @param array<int,string> $matches */
return preg_replace_callback('/{([A-Z_]+)}/', function (array $matches) use ($template): string {
$key = $matches[1];
$replacement_exists = \array_key_exists($key, self::UNCOLORED_FORMAT_STRING_FOR_TEMPLATE);
if (!$replacement_exists) {
error_log(sprintf(
"No coloring info for issue message (%s), key {%s}. Valid template types: %s",
$template,
$key,
implode(', ', array_keys(self::UNCOLORED_FORMAT_STRING_FOR_TEMPLATE))
));
return '%s';
}
return self::UNCOLORED_FORMAT_STRING_FOR_TEMPLATE[$key];
}, $template);
}
/**
* @return array<string,Issue>
*/
public static function issueMap()
{
static $error_map;
if (!empty($error_map)) {
return $error_map;
}
// phpcs:disable Generic.Files.LineLength
/**
* @var array<int,Issue>
* Note: All type ids should be unique, and be grouped by the category.
* (E.g. If the category is (1 << x), then the type_id should be x*1000 + y
* If new type ids are added, existing ones should not be changed.
*/
$error_list = [
// Issue::CATEGORY_SYNTAX
new Issue(
self::SyntaxError,
self::CATEGORY_SYNTAX,
self::SEVERITY_CRITICAL,
"%s",
self::REMEDIATION_A,
17000
),
new Issue(
self::InvalidConstantExpression,
self::CATEGORY_SYNTAX,
self::SEVERITY_CRITICAL,
"Constant expression contains invalid operations",
self::REMEDIATION_A,
17001
),
new Issue(
self::InvalidNode,
self::CATEGORY_SYNTAX,
self::SEVERITY_CRITICAL,
"%s",
self::REMEDIATION_A,
17002
),
new Issue(
self::InvalidWriteToTemporaryExpression,
self::CATEGORY_SYNTAX,
self::SEVERITY_CRITICAL,
"Cannot use temporary expression (of type {TYPE}) in write context",
self::REMEDIATION_A,
17003
),
// Issue::CATEGORY_UNDEFINED
new Issue(
self::EmptyFile,
self::CATEGORY_UNDEFINED,
self::SEVERITY_LOW,
"Empty file {FILE}",
self::REMEDIATION_B,
11000
),
new Issue(
self::ParentlessClass,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Reference to parent of class {CLASS} that does not extend anything",
self::REMEDIATION_B,
11001
),
new Issue(
self::UndeclaredClass,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Reference to undeclared class {CLASS}",
self::REMEDIATION_B,
11002
),
new Issue(
self::UndeclaredExtendedClass,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Class extends undeclared class {CLASS}",
self::REMEDIATION_B,
11003
),
new Issue(
self::UndeclaredInterface,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Class implements undeclared interface {INTERFACE}",
self::REMEDIATION_B,
11004
),
new Issue(
self::UndeclaredTrait,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Class uses undeclared trait {TRAIT}",
self::REMEDIATION_B,
11005
),
new Issue(
self::UndeclaredClassCatch,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Catching undeclared class {CLASS}",
self::REMEDIATION_B,
11006
),
new Issue(
self::UndeclaredClassConstant,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Reference to constant {CONST} from undeclared class {CLASS}",
self::REMEDIATION_B,
11007
),
new Issue(
self::UndeclaredClassInstanceof,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Checking instanceof against undeclared class {CLASS}",
self::REMEDIATION_B,
11008
),
new Issue(
self::UndeclaredClassMethod,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Call to method {METHOD} from undeclared class {CLASS}",
self::REMEDIATION_B,
11009
),
new Issue(
self::UndeclaredClassReference,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared class {CLASS}",
self::REMEDIATION_B,
11010
),
new Issue(
self::UndeclaredConstant,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared constant {CONST}",
self::REMEDIATION_B,
11011
),
new Issue(
self::UndeclaredFunction,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Call to undeclared function {FUNCTION}",
self::REMEDIATION_B,
11012
),
new Issue(
self::UndeclaredMethod,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Call to undeclared method {METHOD}",
self::REMEDIATION_B,
11013
),
new Issue(
self::UndeclaredStaticMethod,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Static call to undeclared method {METHOD}",
self::REMEDIATION_B,
11014
),
new Issue(
self::UndeclaredProperty,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared property {PROPERTY}",
self::REMEDIATION_B,
11015
),
new Issue(
self::UndeclaredStaticProperty,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Static property '{PROPERTY}' on {CLASS} is undeclared",
self::REMEDIATION_B,
11016
),
new Issue(
self::TraitParentReference,
self::CATEGORY_UNDEFINED,
self::SEVERITY_LOW,
"Reference to parent from trait {TRAIT}",
self::REMEDIATION_B,
11017
),
new Issue(
self::UndeclaredVariable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Variable \${VARIABLE} is undeclared",
self::REMEDIATION_B,
11018
),
new Issue(
self::UndeclaredTypeParameter,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Parameter of undeclared type {TYPE}",
self::REMEDIATION_B,
11019
),
new Issue(
self::UndeclaredTypeProperty,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Property {PROPERTY} has undeclared type {TYPE}",
self::REMEDIATION_B,
11020
),
new Issue(
self::UndeclaredClosureScope,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared class {CLASS} in @phan-closure-scope",
self::REMEDIATION_B,
11021
),
new Issue(
self::ClassContainsAbstractMethod,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"non-abstract class {CLASS} contains abstract method {METHOD} declared at {FILE}:{LINE}",
self::REMEDIATION_B,
11022
),
new Issue(
self::ClassContainsAbstractMethodInternal,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"non-abstract class {CLASS} contains abstract internal method {METHOD}",
self::REMEDIATION_B,
11023
),
new Issue(
self::UndeclaredAliasedMethodOfTrait,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Alias {METHOD} was defined for a method {METHOD} which does not exist in trait {TRAIT}",
self::REMEDIATION_B,
11024
),
new Issue(
self::RequiredTraitNotAdded,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Required trait {TRAIT} for trait adaptation was not added to class",
self::REMEDIATION_B,
11025
),
new Issue(
self::AmbiguousTraitAliasSource,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Trait alias {METHOD} has an ambiguous source method {METHOD} with more than one possible source trait. Possibilities: {TRAIT}",
self::REMEDIATION_B,
11026
),
new Issue(
self::UndeclaredVariableDim,
self::CATEGORY_UNDEFINED,
self::SEVERITY_LOW,
"Variable \${VARIABLE} was undeclared, but array fields are being added to it.",
self::REMEDIATION_B,
11027
),
new Issue(
self::UndeclaredVariableAssignOp,
self::CATEGORY_UNDEFINED,
self::SEVERITY_LOW,
"Variable \${VARIABLE} was undeclared, but it is being used as the left hand side of an assignment operation",
self::REMEDIATION_B,
11037
),
new Issue(
self::UndeclaredTypeReturnType,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Return type of {METHOD} is undeclared type {TYPE}",
self::REMEDIATION_B,
11028
),
new Issue(
self::UndeclaredTypeThrowsType,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"@throws type of {METHOD} has undeclared type {TYPE}",
self::REMEDIATION_B,
11034
),
new Issue(
self::UndeclaredClassAliasOriginal,
self::CATEGORY_UNDEFINED,
self::SEVERITY_CRITICAL,
"Reference to undeclared class {CLASS} for the original class of a class_alias for {CLASS}",
self::REMEDIATION_B,
11029
),
new Issue(
self::UndeclaredClassInCallable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared class {CLASS} in callable {METHOD}",
self::REMEDIATION_B,
11030
),
new Issue(
self::UndeclaredStaticMethodInCallable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Reference to undeclared static method {METHOD} in callable",
self::REMEDIATION_B,
11031
),
new Issue(
self::UndeclaredFunctionInCallable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Call to undeclared function {FUNCTION} in callable",
self::REMEDIATION_B,
11032
),
new Issue(
self::UndeclaredMethodInCallable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Call to undeclared method {METHOD} in callable. Possible object type(s) for that method are {TYPE}",
self::REMEDIATION_B,
11033
),
new Issue(
self::EmptyFQSENInCallable,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Possible call to a function '{FUNCTIONLIKE}' with an empty FQSEN.",
self::REMEDIATION_B,
11035
),
new Issue(
self::EmptyFQSENInClasslike,
self::CATEGORY_UNDEFINED,
self::SEVERITY_NORMAL,
"Possible use of a classlike '{CLASSLIKE}' with an empty FQSEN.",
self::REMEDIATION_B,
11036
),
// Issue::CATEGORY_ANALYSIS
new Issue(
self::Unanalyzable,
self::CATEGORY_ANALYSIS,
self::SEVERITY_LOW,
"Expression is unanalyzable or feature is unimplemented. Please create an issue at https://github.com/phan/phan/issues/new.",
self::REMEDIATION_B,
2000
),
new Issue(
self::UnanalyzableInheritance,
self::CATEGORY_ANALYSIS,
self::SEVERITY_LOW,
"Unable to determine the method(s) which {METHOD} overrides, but Phan inferred that it did override something earlier. Please create an issue at https://github.com/phan/phan/issues/new with a test case.",
self::REMEDIATION_B,
2001
),
// Issue::CATEGORY_TYPE
new Issue(
self::TypeMismatchProperty,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Assigning {TYPE} to property but {PROPERTY} is {TYPE}",
self::REMEDIATION_B,
10001
),
new Issue(
self::PartialTypeMismatchProperty,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Assigning {TYPE} to property but {PROPERTY} is {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10063
),
new Issue(
self::PossiblyNullTypeMismatchProperty,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Assigning {TYPE} to property but {PROPERTY} is {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10064
),
new Issue(
self::PossiblyFalseTypeMismatchProperty,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Assigning {TYPE} to property but {PROPERTY} is {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10065
),
new Issue(
self::TypeMismatchDefault,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Default value for {TYPE} \${VARIABLE} can't be {TYPE}",
self::REMEDIATION_B,
10002
),
new Issue(
self::TypeMismatchVariadicComment,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"{PARAMETER} is variadic in comment, but not variadic in param ({PARAMETER})",
self::REMEDIATION_B,
10021
),
new Issue(
self::TypeMismatchVariadicParam,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"{PARAMETER} is not variadic in comment, but variadic in param ({PARAMETER})",
self::REMEDIATION_B,
10023
),
new Issue(
self::TypeMismatchArgument,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
10003
),
new Issue(
self::TypeMismatchArgumentInternal,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE}",
self::REMEDIATION_B,
10004
),
new Issue(
self::TypeMismatchGeneratorYieldValue,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Yield statement has a value with type {TYPE} but {FUNCTIONLIKE}() is declared to yield values of type {TYPE} in {TYPE}",
self::REMEDIATION_B,
10067
),
new Issue(
self::TypeMismatchGeneratorYieldKey,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Yield statement has a key with type {TYPE} but {FUNCTIONLIKE}() is declared to yield keys of type {TYPE} in {TYPE}",
self::REMEDIATION_B,
10068
),
new Issue(
self::TypeInvalidYieldFrom,
self::CATEGORY_TYPE,
self::SEVERITY_CRITICAL,
"Yield from statement was passed an invalid expression of type {TYPE} (expected Traversable/array)",
self::REMEDIATION_B,
10069
),
new Issue(
self::PartialTypeMismatchArgument,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
10054
),
new Issue(
self::PartialTypeMismatchArgumentInternal,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10055
),
new Issue(
self::PossiblyNullTypeArgument,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
10056
),
new Issue(
self::PossiblyNullTypeArgumentInternal,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10057
),
new Issue(
self::PossiblyFalseTypeArgument,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
10058
),
new Issue(
self::PossiblyFalseTypeArgumentInternal,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({VARIABLE}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10059
),
new Issue(
self::TypeMismatchReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Returning type {TYPE} but {FUNCTIONLIKE}() is declared to return {TYPE}",
self::REMEDIATION_B,
10005
),
new Issue(
self::PartialTypeMismatchReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Returning type {TYPE} but {FUNCTIONLIKE}() is declared to return {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10060
),
new Issue(
self::PossiblyNullTypeReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Returning type {TYPE} but {FUNCTIONLIKE}() is declared to return {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10061
),
new Issue(
self::PossiblyFalseTypeReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Returning type {TYPE} but {FUNCTIONLIKE}() is declared to return {TYPE} ({TYPE} is incompatible)",
self::REMEDIATION_B,
10062
),
new Issue(
self::TypeMismatchDeclaredReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Doc-block of {METHOD} contains declared return type {TYPE} which is incompatible with the return type {TYPE} declared in the signature",
self::REMEDIATION_B,
10020
),
new Issue(
self::TypeMismatchDeclaredReturnNullable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Doc-block of {METHOD} has declared return type {TYPE} which is not a permitted replacement of the nullable return type {TYPE} declared in the signature ('?T' should be documented as 'T|null' or '?T')",
self::REMEDIATION_B,
10028
),
new Issue(
self::TypeMismatchDeclaredParam,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Doc-block of \${VARIABLE} in {METHOD} contains phpdoc param type {TYPE} which is incompatible with the param type {TYPE} declared in the signature",
self::REMEDIATION_B,
10022
),
new Issue(
self::TypeMismatchDeclaredParamNullable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Doc-block of \${VARIABLE} in {METHOD} is phpdoc param type {TYPE} which is not a permitted replacement of the nullable param type {TYPE} declared in the signature ('?T' should be documented as 'T|null' or '?T')",
self::REMEDIATION_B,
10027
),
new Issue(
self::TypeMissingReturn,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Method {METHOD} is declared to return {TYPE} but has no return value",
self::REMEDIATION_B,
10006
),
new Issue(
self::TypeMismatchForeach,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"{TYPE} passed to foreach instead of array",
self::REMEDIATION_B,
10007
),
new Issue(
self::TypeArrayOperator,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid array operator between types {TYPE} and {TYPE}",
self::REMEDIATION_B,
10008
),
new Issue(
self::TypeArraySuspicious,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Suspicious array access to {TYPE}",
self::REMEDIATION_B,
10009
),
new Issue(
self::TypeArrayUnsetSuspicious,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Suspicious attempt to unset an offset of a value of type {TYPE}",
self::REMEDIATION_B,
10048
),
new Issue(
self::TypeComparisonToArray,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"{TYPE} to array comparison",
self::REMEDIATION_B,
10010
),
new Issue(
self::TypeComparisonFromArray,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"array to {TYPE} comparison",
self::REMEDIATION_B,
10011
),
new Issue(
self::TypeConversionFromArray,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"array to {TYPE} conversion",
self::REMEDIATION_B,
10012
),
new Issue(
self::TypeInstantiateAbstract,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Instantiation of abstract class {CLASS}",
self::REMEDIATION_B,
10013
),
new Issue(
self::TypeInstantiateInterface,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Instantiation of interface {INTERFACE}",
self::REMEDIATION_B,
10014
),
new Issue(
self::TypeInvalidClosureScope,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid @phan-closure-scope: expected a class name, got {TYPE}",
self::REMEDIATION_B,
10024
),
new Issue(
self::TypeInvalidRightOperand,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: left operand is array and right is not",
self::REMEDIATION_B,
10015
),
new Issue(
self::TypeInvalidLeftOperand,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: right operand is array and left is not",
self::REMEDIATION_B,
10016
),
new Issue(
self::TypeInvalidRightOperandOfAdd,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: right operand is {TYPE} (expected array or number)",
self::REMEDIATION_B,
10070
),
new Issue(
self::TypeInvalidLeftOperandOfAdd,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: left operand is {TYPE} (expected array or number)",
self::REMEDIATION_B,
10071
),
new Issue(
self::TypeInvalidRightOperandOfNumericOp,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: right operand is {TYPE} (expected number)",
self::REMEDIATION_B,
10072
),
new Issue(
self::TypeInvalidLeftOperandOfNumericOp,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: left operand is {TYPE} (expected number)",
self::REMEDIATION_B,
10073
),
new Issue(
self::TypeInvalidUnaryOperandNumeric,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: unary operand of {STRING_LITERAL} is {TYPE} (expected number)",
self::REMEDIATION_B,
10075
),
new Issue(
self::TypeInvalidUnaryOperandBitwiseNot,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid operator: unary operand of {STRING_LITERAL} is {TYPE} (expected number or string)",
self::REMEDIATION_B,
10076
),
new Issue(
self::TypeParentConstructorCalled,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Must call parent::__construct() from {CLASS} which extends {CLASS}",
self::REMEDIATION_B,
10017
),
new Issue(
self::TypeNonVarPassByRef,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Only variables can be passed by reference at argument {INDEX} of {FUNCTIONLIKE}()",
self::REMEDIATION_B,
10018
),
new Issue(
self::NonClassMethodCall,
self::CATEGORY_TYPE,
self::SEVERITY_CRITICAL,
"Call to method {METHOD} on non-class type {TYPE}",
self::REMEDIATION_B,
10019
),
new Issue(
self::TypeVoidAssignment,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
"Cannot assign void return value",
self::REMEDIATION_B,
10000
),
new Issue(
self::TypeSuspiciousIndirectVariable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Indirect variable ${(expr)} has invalid inner expression type {TYPE}, expected string/integer',
self::REMEDIATION_B,
10025
),
new Issue(
self::TypeMagicVoidWithReturn,
self::CATEGORY_TYPE,
self::SEVERITY_LOW,
'Found a return statement with a value in the implementation of the magic method {METHOD}, expected void return type',
self::REMEDIATION_B,
10026
),
new Issue(
self::TypeInvalidInstanceof,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Found an instanceof class name of type {TYPE}, but class name must be a valid object or a string',
self::REMEDIATION_B,
10029
),
new Issue(
self::TypeMismatchDimAssignment,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'When appending to a value of type {TYPE}, found an array access index of type {TYPE}, but expected the index to be of type {TYPE}',
self::REMEDIATION_B,
10030
),
new Issue(
self::TypeMismatchDimEmpty,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Assigning to an empty array index of a value of type {TYPE}, but expected the index to exist and be of type {TYPE}',
self::REMEDIATION_B,
10031
),
new Issue(
self::TypeMismatchDimFetch,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'When fetching an array index from a value of type {TYPE}, found an array index of type {TYPE}, but expected the index to be of type {TYPE}',
self::REMEDIATION_B,
10032
),
new Issue(
self::TypeMismatchDimFetchNullable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'When fetching an array index from a value of type {TYPE}, found an array index of type {TYPE}, but expected the index to be of the non-nullable type {TYPE}',
self::REMEDIATION_B,
10044
),
new Issue(
self::TypeInvalidCallableArraySize,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'In a place where phan was expecting a callable, saw an array of size {COUNT}, but callable arrays must be of size 2',
self::REMEDIATION_B,
10033
),
new Issue(
self::TypeInvalidCallableArrayKey,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'In a place where phan was expecting a callable, saw an array with an unexpected key for element #{INDEX} (expected [$class_or_expr, $method_name])',
self::REMEDIATION_B,
10034
),
new Issue(
self::TypeInvalidCallableObjectOfMethod,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'In a place where phan was expecting a callable, saw a two-element array with a class or expression with an unexpected type {TYPE} (expected a class type or string). Method name was {METHOD}',
self::REMEDIATION_B,
10035
),
new Issue(
self::TypeExpectedObject,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Expected an object instance but saw expression with type {TYPE}',
self::REMEDIATION_B,
10036
),
new Issue(
self::TypeExpectedObjectOrClassName,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Expected an object instance or the name of a class but saw expression with type {TYPE}',
self::REMEDIATION_B,
10037
),
new Issue(
self::TypeExpectedObjectOrClassNameInvalidName,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Expected an object instance or the name of a class but saw an invalid class name \'{STRING_LITERAL}\'',
self::REMEDIATION_B,
10074
),
new Issue(
self::TypeExpectedObjectPropAccess,
self::CATEGORY_TYPE,
self::SEVERITY_CRITICAL,
'Expected an object instance when accessing an instance property, but saw an expression with type {TYPE}',
self::REMEDIATION_B,
10038
),
new Issue(
self::TypeExpectedObjectStaticPropAccess,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Expected an object instance or a class name when accessing a static property, but saw an expression with type {TYPE}',
self::REMEDIATION_B,
10039
),
new Issue(
self::TypeExpectedObjectPropAccessButGotNull,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Expected an object instance when accessing an instance property, but saw an expression with type {TYPE}',
self::REMEDIATION_B,
10040
),
new Issue(
self::TypeMismatchUnpackKey,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'When unpacking a value of type {TYPE}, the value\'s keys were of type {TYPE}, but the keys should be consecutive integers starting from 0',
self::REMEDIATION_B,
10041
),
new Issue(
self::TypeMismatchUnpackValue,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Attempting to unpack a value of type {TYPE} which does not contain any subtypes of iterable (such as array or Traversable)',
self::REMEDIATION_B,
10042
),
new Issue(
self::TypeMismatchArrayDestructuringKey,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
'Attempting an array destructing assignment with a key of type {TYPE} but the only key types of the right hand side are of type {TYPE}',
self::REMEDIATION_B,
10043
),
new Issue(
self::TypeArraySuspiciousNullable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Suspicious array access to nullable {TYPE}",
self::REMEDIATION_B,
10045
),
new Issue(
self::TypeInvalidDimOffset,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid offset {SCALAR} of array type {TYPE}",
self::REMEDIATION_B,
10046
),
new Issue(
self::TypeInvalidDimOffsetArrayDestructuring,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid offset {SCALAR} of array type {TYPE} in an array destructuring assignment",
self::REMEDIATION_B,
10047
),
new Issue(
self::TypeInvalidExpressionArrayDestructuring,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Invalid value of type {TYPE} in an array destructuring assignment, expected {TYPE}",
self::REMEDIATION_B,
10077
),
new Issue(
self::TypeSuspiciousEcho,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Suspicious argument {TYPE} for an echo/print statement",
self::REMEDIATION_B,
10049
),
new Issue(
self::TypeInvalidThrowsNonObject,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"@throws annotation of {FUNCTIONLIKE} has invalid non-object type {TYPE}, expected a class",
self::REMEDIATION_B,
10050
),
new Issue(
self::TypeInvalidThrowsIsTrait,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"@throws annotation of {FUNCTIONLIKE} has invalid trait type {TYPE}, expected a class",
self::REMEDIATION_B,
10051
),
new Issue(
self::TypeInvalidThrowsIsInterface,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"@throws annotation of {FUNCTIONLIKE} has suspicious interface type {TYPE} for an @throws annotation, expected class (PHP allows interfaces to be caught, so this might be intentional)",
self::REMEDIATION_B,
10052
),
new Issue(
self::TypeInvalidThrowsNonThrowable,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"@throws annotation of {FUNCTIONLIKE} has suspicious class type {TYPE}, which does not extend Error/Exception",
self::REMEDIATION_B,
10053
),
new Issue(
self::TypeSuspiciousStringExpression,
self::CATEGORY_TYPE,
self::SEVERITY_NORMAL,
"Suspicious type {TYPE} of a variable or expression encapsulated within a string. (Expected this to be able to cast to a string)",
self::REMEDIATION_B,
10066
),
// Issue::CATEGORY_VARIABLE
new Issue(
self::VariableUseClause,
self::CATEGORY_VARIABLE,
self::SEVERITY_NORMAL,
"Non-variables not allowed within use clause",
self::REMEDIATION_B,
12000
),
// Issue::CATEGORY_STATIC
new Issue(
self::StaticCallToNonStatic,
self::CATEGORY_STATIC,
self::SEVERITY_NORMAL,
"Static call to non-static method {METHOD} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
9000
),
// Issue::CATEGORY_CONTEXT
new Issue(
self::ContextNotObject,
self::CATEGORY_CONTEXT,
self::SEVERITY_CRITICAL,
"Cannot access {CLASS} when not in object context",
self::REMEDIATION_B,
4000
),
new Issue(
self::ContextNotObjectInCallable,
self::CATEGORY_CONTEXT,
self::SEVERITY_NORMAL,
"Cannot access {CLASS} when not in object context, but code is using callable {METHOD}",
self::REMEDIATION_B,
4001
),
new Issue(
self::ContextNotObjectUsingSelf,
self::CATEGORY_CONTEXT,
self::SEVERITY_NORMAL,
'Cannot use {CLASS} as type when not in object context in {FUNCTION}',
self::REMEDIATION_B,
4002
),
// Issue::CATEGORY_DEPRECATED
new Issue(
self::DeprecatedFunction,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Call to deprecated function {FUNCTIONLIKE}() defined at {FILE}:{LINE}",
self::REMEDIATION_B,
5000
),
new Issue(
self::DeprecatedFunctionInternal,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Call to deprecated function {FUNCTIONLIKE}()",
self::REMEDIATION_B,
5005
),
new Issue(
self::DeprecatedClass,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Call to deprecated class {CLASS} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
5001
),
new Issue(
self::DeprecatedProperty,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Reference to deprecated property {PROPERTY} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
5002
),
new Issue(
self::DeprecatedInterface,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Using a deprecated interface {INTERFACE} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
5003
),
new Issue(
self::DeprecatedTrait,
self::CATEGORY_DEPRECATED,
self::SEVERITY_NORMAL,
"Using a deprecated trait {TRAIT} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
5004
),
// Issue::CATEGORY_PARAMETER
new Issue(
self::ParamReqAfterOpt,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Required argument follows optional",
self::REMEDIATION_B,
7000
),
new Issue(
self::ParamTooMany,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() which only takes {COUNT} arg(s) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
7001
),
new Issue(
self::ParamTooManyInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() which only takes {COUNT} arg(s)",
self::REMEDIATION_B,
7002
),
new Issue(
self::ParamTooManyCallable,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() (As a provided callable) which only takes {COUNT} arg(s) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
7043
),
new Issue(
self::ParamTooFew,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() which requires {COUNT} arg(s) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
7003
),
new Issue(
self::ParamTooFewInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() which requires {COUNT} arg(s)",
self::REMEDIATION_B,
7004
),
new Issue(
self::ParamTooFewCallable,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Call with {COUNT} arg(s) to {FUNCTIONLIKE}() (as a provided callable) which requires {COUNT} arg(s) defined at {FILE}:{LINE}",
self::REMEDIATION_B,
7044
),
new Issue(
self::ParamSpecial1,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({PARAMETER}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} when argument {INDEX} is {TYPE}",
self::REMEDIATION_B,
7005
),
new Issue(
self::ParamSpecial2,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Argument {INDEX} ({PARAMETER}) is {TYPE} but {FUNCTIONLIKE}() takes {TYPE} when passed only one argument",
self::REMEDIATION_B,
7006
),
new Issue(
self::ParamSpecial3,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"The last argument to {FUNCTIONLIKE} must be of type {TYPE}",
self::REMEDIATION_B,
7007
),
new Issue(
self::ParamSpecial4,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"The second to last argument to {FUNCTIONLIKE} must be of type {TYPE}",
self::REMEDIATION_B,
7008
),
new Issue(
self::ParamTypeMismatch,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Argument {INDEX} is {TYPE} but {FUNCTIONLIKE}() takes {TYPE}",
self::REMEDIATION_B,
7009
),
new Issue(
self::ParamSignatureMismatch,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7010
),
new Issue(
self::ParamSignatureMismatchInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD}",
self::REMEDIATION_B,
7011
),
new Issue(
self::ParamRedefined,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Redefinition of parameter {PARAMETER}",
self::REMEDIATION_B,
7012
),
// TODO: Optionally, change the other message to say that it's based off of phpdoc and LSP in a future PR.
// NOTE: Incompatibilities in the param list are SEVERITY_NORMAL, because the php interpreter emits a notice.
// Incompatibilities in the return types are SEVERITY_CRITICAL, because the php interpreter will throw an Error.
new Issue(
self::ParamSignatureRealMismatchReturnType,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Declaration of {METHOD} should be compatible with {METHOD} (method returning '{TYPE}' cannot override method returning '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7013
),
new Issue(
self::ParamSignatureRealMismatchReturnTypeInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (method returning '{TYPE}' cannot override method returning '{TYPE}')",
self::REMEDIATION_B,
7014
),
new Issue(
self::ParamSignaturePHPDocMismatchReturnType,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (method returning '{TYPE}' cannot override method returning '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7033
),
new Issue(
self::ParamSignatureRealMismatchParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} of type '{TYPE}' cannot replace original parameter of type '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7015
),
new Issue(
self::ParamSignatureRealMismatchParamTypeInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} of type '{TYPE}' cannot replace original parameter of type '{TYPE}')",
self::REMEDIATION_B,
7016
),
new Issue(
self::ParamSignaturePHPDocMismatchParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} of type '{TYPE}' cannot replace original parameter of type '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7034
),
new Issue(
self::ParamSignatureRealMismatchHasParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_CRITICAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} has type '{TYPE}' which cannot replace original parameter with no type) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7017
),
new Issue(
self::ParamSignatureRealMismatchHasParamTypeInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} has type '{TYPE}' which cannot replace original parameter with no type)",
self::REMEDIATION_B,
7018
),
new Issue(
self::ParamSignaturePHPDocMismatchHasParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} has type '{TYPE}' which cannot replace original parameter with no type) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7035
),
new Issue(
self::ParamSignatureRealMismatchHasNoParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} with no type cannot replace original parameter with type '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7019
),
new Issue(
self::ParamSignatureRealMismatchHasNoParamTypeInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} with no type cannot replace original parameter with type '{TYPE}')",
self::REMEDIATION_B,
7020
),
new Issue(
self::ParamSignaturePHPDocMismatchHasNoParamType,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} with no type cannot replace original parameter with type '{TYPE}') defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7036
),
new Issue(
self::ParamSignatureRealMismatchParamVariadic,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} is a variadic parameter replacing a non-variadic parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7021
),
new Issue(
self::ParamSignatureRealMismatchParamVariadicInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} is a variadic parameter replacing a non-variadic parameter)",
self::REMEDIATION_B,
7022
),
new Issue(
self::ParamSignaturePHPDocMismatchParamVariadic,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} is a variadic parameter replacing a non-variadic parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7037
),
new Issue(
self::ParamSignatureRealMismatchParamNotVariadic,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} is a non-variadic parameter replacing a variadic parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7023
),
new Issue(
self::ParamSignatureRealMismatchParamNotVariadicInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} is a non-variadic parameter replacing a variadic parameter)",
self::REMEDIATION_B,
7024
),
new Issue(
self::ParamSignaturePHPDocMismatchParamNotVariadic,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} is a non-variadic parameter replacing a variadic parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7038
),
new Issue(
self::ParamSignatureRealMismatchParamIsReference,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} is a reference parameter overriding a non-reference parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7025
),
new Issue(
self::ParamSignatureRealMismatchParamIsReferenceInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} is a reference parameter overriding a non-reference parameter)",
self::REMEDIATION_B,
7026
),
new Issue(
self::ParamSignaturePHPDocMismatchParamIsReference,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} is a reference parameter overriding a non-reference parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7039
),
new Issue(
self::ParamSignatureRealMismatchParamIsNotReference,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (parameter #{INDEX} is a non-reference parameter overriding a reference parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7027
),
new Issue(
self::ParamSignatureRealMismatchParamIsNotReferenceInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (parameter #{INDEX} is a non-reference parameter overriding a reference parameter)",
self::REMEDIATION_B,
7028
),
new Issue(
self::ParamSignaturePHPDocMismatchParamIsNotReference,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (parameter #{INDEX} is a non-reference parameter overriding a reference parameter) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7040
),
new Issue(
self::ParamSignatureRealMismatchTooFewParameters,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (the method override accepts {COUNT} parameter(s), but the overridden method can accept {COUNT}) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7029
),
new Issue(
self::ParamSignatureRealMismatchTooFewParametersInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (the method override accepts {COUNT} parameter(s), but the overridden method can accept {COUNT})",
self::REMEDIATION_B,
7030
),
new Issue(
self::ParamSignaturePHPDocMismatchTooFewParameters,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (the method override accepts {COUNT} parameter(s), but the overridden method can accept {COUNT}) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7041
),
new Issue(
self::ParamSignatureRealMismatchTooManyRequiredParameters,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with {METHOD} (the method override requires {COUNT} parameter(s), but the overridden method requires only {COUNT}) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7031
),
new Issue(
self::ParamSignatureRealMismatchTooManyRequiredParametersInternal,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} should be compatible with internal {METHOD} (the method override requires {COUNT} parameter(s), but the overridden method requires only {COUNT})",
self::REMEDIATION_B,
7032
),
new Issue(
self::ParamSignaturePHPDocMismatchTooManyRequiredParameters,
self::CATEGORY_PARAMETER,
self::SEVERITY_LOW,
"Declaration of real/@method {METHOD} should be compatible with real/@method {METHOD} (the method override requires {COUNT} parameter(s), but the overridden method requires only {COUNT}) defined in {FILE}:{LINE}",
self::REMEDIATION_B,
7042
),
new Issue(
self::ParamSuspiciousOrder,
self::CATEGORY_PARAMETER,
self::SEVERITY_NORMAL,
"Argument #{INDEX} of this call to {FUNCTIONLIKE} is typically a literal or constant but isn't, but argument #{INDEX} (which is typically a variable) is a literal or constant. The arguments may be in the wrong order.",
self::REMEDIATION_B,
7045
),
// Issue::CATEGORY_NOOP
new Issue(
self::NoopProperty,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused property",
self::REMEDIATION_B,
6000
),
new Issue(
self::NoopArray,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused array",
self::REMEDIATION_B,
6001
),
new Issue(
self::NoopConstant,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused constant",
self::REMEDIATION_B,
6002
),
new Issue(
self::NoopClosure,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused closure",
self::REMEDIATION_B,
6003
),
new Issue(
self::NoopVariable,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused variable",
self::REMEDIATION_B,
6004
),
new Issue(
self::NoopUnaryOperator,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused result of a unary '{OPERATOR}' operator",
self::REMEDIATION_B,
6020
),
new Issue(
self::NoopBinaryOperator,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused result of a binary '{OPERATOR}' operator",
self::REMEDIATION_B,
6021
),
new Issue(
self::NoopStringLiteral,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused result of a string literal {STRING_LITERAL} near this line",
self::REMEDIATION_B,
6029
),
new Issue(
self::NoopEncapsulatedStringLiteral,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused result of an encapsulated string literal",
self::REMEDIATION_B,
6030
),
new Issue(
self::NoopNumericLiteral,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
"Unused result of a numeric literal {STRING_LITERAL} near this line",
self::REMEDIATION_B,
6031
),
new Issue(
self::UnreferencedClass,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to class {CLASS}",
self::REMEDIATION_B,
6005
),
new Issue(
self::UnreferencedConstant,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to global constant {CONST}",
self::REMEDIATION_B,
6008
),
new Issue(
self::UnreferencedFunction,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to function {FUNCTION}",
self::REMEDIATION_B,
6009
),
new Issue(
self::UnreferencedClosure,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to closure {FUNCTION}",
self::REMEDIATION_B,
6010
),
new Issue(
self::UnreferencedPublicMethod,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to public method {METHOD}",
self::REMEDIATION_B,
6011
),
new Issue(
self::UnreferencedProtectedMethod,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to protected method {METHOD}",
self::REMEDIATION_B,
6012
),
new Issue(
self::UnreferencedPrivateMethod,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to private method {METHOD}",
self::REMEDIATION_B,
6013
),
new Issue(
self::UnreferencedPublicProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to public property {PROPERTY}",
self::REMEDIATION_B,
6014
),
new Issue(
self::UnreferencedProtectedProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to protected property {PROPERTY}",
self::REMEDIATION_B,
6015
),
new Issue(
self::UnreferencedPrivateProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to private property {PROPERTY}",
self::REMEDIATION_B,
6016
),
new Issue(
self::ReadOnlyPublicProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero write references to public property {PROPERTY}",
self::REMEDIATION_B,
6032
),
new Issue(
self::ReadOnlyProtectedProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero write references to protected property {PROPERTY}",
self::REMEDIATION_B,
6033
),
new Issue(
self::ReadOnlyPrivateProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero write references to private property {PROPERTY}",
self::REMEDIATION_B,
6034
),
new Issue(
self::WriteOnlyPublicProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero read references to public property {PROPERTY}",
self::REMEDIATION_B,
6025
),
new Issue(
self::WriteOnlyProtectedProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero read references to protected property {PROPERTY}",
self::REMEDIATION_B,
6026
),
new Issue(
self::WriteOnlyPrivateProperty,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero read references to private property {PROPERTY}",
self::REMEDIATION_B,
6027
),
new Issue(
self::UnreferencedPublicClassConstant,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to public class constant {CONST}",
self::REMEDIATION_B,
6017
),
new Issue(
self::UnreferencedProtectedClassConstant,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to protected class constant {CONST}",
self::REMEDIATION_B,
6018
),
new Issue(
self::UnreferencedPrivateClassConstant,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to public class constant {CONST}",
self::REMEDIATION_B,
6019
),
new Issue(
self::UnreferencedUseNormal,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to use statement for classlike/namespace {CLASSLIKE} ({CLASSLIKE})",
self::REMEDIATION_B,
6022
),
new Issue(
self::UnreferencedUseFunction,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to use statement for function {FUNCTION} ({FUNCTION})",
self::REMEDIATION_B,
6023
),
new Issue(
self::UnreferencedUseConstant,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Possibly zero references to use statement for constant {CONST} ({CONST})",
self::REMEDIATION_B,
6024
),
new Issue(
self::UnreachableCatch,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
"Catch statement for {CLASSLIKE} is unreachable. An earlier catch statement at line {LINE} caught the ancestor class/interface {CLASSLIKE}",
self::REMEDIATION_B,
6028
),
new Issue(
self::UnusedVariable,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Unused definition of variable ${VARIABLE}',
self::REMEDIATION_B,
6035
),
new Issue(
self::UnusedPublicMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6036
),
new Issue(
self::UnusedPublicFinalMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6037
),
new Issue(
self::UnusedProtectedMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6038
),
new Issue(
self::UnusedProtectedFinalMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6039
),
new Issue(
self::UnusedPrivateMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6040
),
new Issue(
self::UnusedPrivateFinalMethodParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6041
),
new Issue(
self::UnusedClosureUseVariable,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Closure use variable ${VARIABLE} is never used',
self::REMEDIATION_B,
6042
),
new Issue(
self::UnusedClosureParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6043
),
new Issue(
self::UnusedGlobalFunctionParameter,
self::CATEGORY_NOOP,
self::SEVERITY_NORMAL,
'Parameter ${PARAMETER} is never used',
self::REMEDIATION_B,
6044
),
new Issue(
self::UnusedVariableValueOfForeachWithKey,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
'Unused definition of variable ${VARIABLE} as the value of a foreach loop that included keys',
self::REMEDIATION_B,
6045
),
new Issue(
self::UnusedVariableCaughtException,
self::CATEGORY_NOOP,
self::SEVERITY_LOW,
'Unused definition of variable ${VARIABLE} as a caught exception',
self::REMEDIATION_B,
6046
),
// Issue::CATEGORY_REDEFINE
new Issue(
self::RedefineClass,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} defined at {FILE}:{LINE} was previously defined as {CLASS} at {FILE}:{LINE}",
self::REMEDIATION_B,
8000
),
new Issue(
self::RedefineClassInternal,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} defined at {FILE}:{LINE} was previously defined as {CLASS} internally",
self::REMEDIATION_B,
8001
),
new Issue(
self::RedefineFunction,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"Function {FUNCTION} defined at {FILE}:{LINE} was previously defined at {FILE}:{LINE}",
self::REMEDIATION_B,
8002
),
new Issue(
self::RedefineFunctionInternal,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"Function {FUNCTION} defined at {FILE}:{LINE} was previously defined internally",
self::REMEDIATION_B,
8003
),
new Issue(
self::IncompatibleCompositionProp,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{TRAIT} and {TRAIT} define the same property ({PROPERTY}) in the composition of {CLASS}. However, the definition differs and is considered incompatible. Class was composed in {FILE} on line {LINE}",
self::REMEDIATION_B,
8004
),
new Issue(
self::IncompatibleCompositionMethod,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"Declaration of {METHOD} must be compatible with {METHOD} in {FILE} on line {LINE}",
self::REMEDIATION_B,
8005
),
new Issue(
self::RedefineClassAlias,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} aliased at {FILE}:{LINE} was previously defined as {CLASS} at {FILE}:{LINE}",
self::REMEDIATION_B,
8006
),
new Issue(
self::RedefinedUsedTrait,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} uses {TRAIT} declared at {FILE}:{LINE} which is also declared at {FILE}:{LINE}. This may lead to confusing errors.",
self::REMEDIATION_B,
8007
),
new Issue(
self::RedefinedInheritedInterface,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} inherits {INTERFACE} declared at {FILE}:{LINE} which is also declared at {FILE}:{LINE}. This may lead to confusing errors.",
self::REMEDIATION_B,
8008
),
new Issue(
self::RedefinedExtendedClass,
self::CATEGORY_REDEFINE,
self::SEVERITY_NORMAL,
"{CLASS} extends {CLASS} declared at {FILE}:{LINE} which is also declared at {FILE}:{LINE}. This may lead to confusing errors.",
self::REMEDIATION_B,
8009
),
// Issue::CATEGORY_ACCESS
new Issue(
self::AccessPropertyProtected,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access protected property {PROPERTY}",
self::REMEDIATION_B,
1000
),
new Issue(
self::AccessPropertyPrivate,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access private property {PROPERTY}",
self::REMEDIATION_B,
1001
),
new Issue(
self::AccessMethodProtected,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access protected method {METHOD} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
1002
),
new Issue(
self::AccessMethodPrivate,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access private method {METHOD} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
1003
),
new Issue(
self::AccessSignatureMismatch,
self::CATEGORY_ACCESS,
self::SEVERITY_NORMAL,
"Access level to {METHOD} must be compatible with {METHOD} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
1004
),
new Issue(
self::AccessSignatureMismatchInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_NORMAL,
"Access level to {METHOD} must be compatible with internal {METHOD}",
self::REMEDIATION_B,
1005
),
new Issue(
self::PropertyAccessSignatureMismatch,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Access level to {PROPERTY} must be compatible with {PROPERTY} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
1022
),
new Issue(
self::PropertyAccessSignatureMismatchInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Access level to {PROPERTY} must be compatible with internal {PROPERTY}",
self::REMEDIATION_B,
1023
),
new Issue(
self::AccessConstantSignatureMismatch,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Access level to {CONST} must be compatible with {CONST} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
1024
),
new Issue(
self::AccessConstantSignatureMismatchInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Access level to {CONST} must be compatible with internal {CONST}",
self::REMEDIATION_B,
1025
),
new Issue(
self::AccessStaticToNonStaticProperty,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot make static property {PROPERTY} into the non static property {PROPERTY}",
self::REMEDIATION_B,
1026
),
new Issue(
self::AccessNonStaticToStaticProperty,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot make non static property {PROPERTY} into the static property {PROPERTY}",
self::REMEDIATION_B,
1027
),
new Issue(
self::AccessStaticToNonStatic,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot make static method {METHOD}() non static",
self::REMEDIATION_B,
1006
),
new Issue(
self::AccessNonStaticToStatic,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot make non static method {METHOD}() static",
self::REMEDIATION_B,
1007
),
new Issue(
self::AccessClassConstantPrivate,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access private class constant {CONST} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
1008
),
new Issue(
self::AccessClassConstantProtected,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access protected class constant {CONST} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
1009
),
new Issue(
self::AccessPropertyStaticAsNonStatic,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Accessing static property {PROPERTY} as non static",
self::REMEDIATION_B,
1010
),
new Issue(
self::AccessOwnConstructor,
self::CATEGORY_ACCESS,
self::SEVERITY_NORMAL,
"Accessing own constructor directly via {CLASS}::__construct",
self::REMEDIATION_B,
1020
),
new Issue(
self::AccessMethodProtectedWithCallMagicMethod,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access protected method {METHOD} defined at {FILE}:{LINE} (if this call should be handled by __call, consider adding a @method tag to the class)",
self::REMEDIATION_B,
1011
),
new Issue(
self::AccessMethodPrivateWithCallMagicMethod,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Cannot access private method {METHOD} defined at {FILE}:{LINE} (if this call should be handled by __call, consider adding a @method tag to the class)",
self::REMEDIATION_B,
1012
),
new Issue(
self::AccessWrongInheritanceCategory,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Attempting to inherit {CLASSLIKE} defined at {FILE}:{LINE} as if it were a {CLASSLIKE}",
self::REMEDIATION_B,
1013
),
new Issue(
self::AccessWrongInheritanceCategoryInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Attempting to inherit internal {CLASSLIKE} as if it were a {CLASSLIKE}",
self::REMEDIATION_B,
1014
),
new Issue(
self::AccessExtendsFinalClass,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Attempting to extend from final class {CLASS} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
1015
),
new Issue(
self::AccessExtendsFinalClassInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Attempting to extend from final internal class {CLASS}",
self::REMEDIATION_B,
1016
),
new Issue(
self::AccessOverridesFinalMethod,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Declaration of method {METHOD} overrides final method {METHOD} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
1017
),
new Issue(
self::AccessOverridesFinalMethodInternal,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Declaration of method {METHOD} overrides final internal method {METHOD}",
self::REMEDIATION_B,
1018
),
new Issue(
self::AccessOverridesFinalMethodPHPDoc,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Declaration of phpdoc method {METHOD} is an unnecessary override of final method {METHOD} defined in {FILE}:{LINE}",
self::REMEDIATION_B,
1019
),
new Issue(
self::AccessPropertyNonStaticAsStatic,
self::CATEGORY_ACCESS,
self::SEVERITY_CRITICAL,
"Accessing non static property {PROPERTY} as static",
self::REMEDIATION_B,
1021
),
// Issue::CATEGORY_COMPATIBLE
new Issue(
self::CompatiblePHP7,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_NORMAL,
"Expression may not be PHP 7 compatible",
self::REMEDIATION_B,
3000
),
new Issue(
self::CompatibleExpressionPHP7,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_NORMAL,
"{CLASS} expression may not be PHP 7 compatible",
self::REMEDIATION_B,
3001
),
new Issue(
self::CompatibleNullableTypePHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Nullable type '{TYPE}' is not compatible with PHP 7.0",
self::REMEDIATION_B,
3002
),
new Issue(
self::CompatibleShortArrayAssignPHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Square bracket syntax for an array destructuring assignment is not compatible with PHP 7.0",
self::REMEDIATION_A,
3003
),
new Issue(
self::CompatibleKeyedArrayAssignPHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Using array keys in an array destructuring assignment is not compatible with PHP 7.0",
self::REMEDIATION_B,
3004
),
new Issue(
self::CompatibleVoidTypePHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Return type '{TYPE}' means the absence of a return value starting in PHP 7.1. In PHP 7.0, void refers to a class/interface with the name 'void'",
self::REMEDIATION_B,
3005
),
new Issue(
self::CompatibleIterableTypePHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Return type '{TYPE}' means a Traversable/array value starting in PHP 7.1. In PHP 7.0, iterable refers to a class/interface with the name 'iterable'",
self::REMEDIATION_B,
3006
),
new Issue(
self::CompatibleObjectTypePHP71,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Type '{TYPE}' refers to any object starting in PHP 7.2. In PHP 7.1 and earlier, it refers to a class/interface with the name 'object'",
self::REMEDIATION_B,
3007
),
new Issue(
self::CompatibleUseVoidPHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Using '{TYPE}' as void will be a syntax error in PHP 7.1 (void becomes the absence of a return type).",
self::REMEDIATION_B,
3008
),
new Issue(
self::CompatibleUseIterablePHP71,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Using '{TYPE}' as iterable will be a syntax error in PHP 7.2 (iterable becomes a native type with subtypes Array and Iterator).",
self::REMEDIATION_B,
3009
),
new Issue(
self::CompatibleUseObjectPHP71,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Using '{TYPE}' as object will be a syntax error in PHP 7.2 (object becomes a native type that accepts any class instance).",
self::REMEDIATION_B,
3010
),
new Issue(
self::CompatibleMultiExceptionCatchPHP70,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_CRITICAL,
"Catching multiple exceptions is not supported before PHP 7.1",
self::REMEDIATION_B,
3011
),
new Issue(
self::CompatibleNegativeStringOffset,
self::CATEGORY_COMPATIBLE,
self::SEVERITY_NORMAL,
"Using negative string offsets is not supported before PHP 7.1 (emits an 'Uninitialized string offset' notice)",
self::REMEDIATION_B,
3012
),
// Issue::CATEGORY_GENERIC
new Issue(
self::TemplateTypeConstant,
self::CATEGORY_GENERIC,
self::SEVERITY_NORMAL,
"constant {CONST} may not have a template type",
self::REMEDIATION_B,
14000
),
new Issue(
self::TemplateTypeStaticMethod,
self::CATEGORY_GENERIC,
self::SEVERITY_NORMAL,
"static method {METHOD} may not use template types",
self::REMEDIATION_B,
14001
),
new Issue(
self::TemplateTypeStaticProperty,
self::CATEGORY_GENERIC,
self::SEVERITY_NORMAL,
"static property {PROPERTY} may not have a template type",
self::REMEDIATION_B,
14002
),
new Issue(
self::GenericGlobalVariable,
self::CATEGORY_GENERIC,
self::SEVERITY_NORMAL,
"Global variable {VARIABLE} may not be assigned an instance of a generic class",
self::REMEDIATION_B,
14003
),
new Issue(
self::GenericConstructorTypes,
self::CATEGORY_GENERIC,
self::SEVERITY_NORMAL,
"Missing template parameters {PARAMETER} on constructor for generic class {CLASS}",
self::REMEDIATION_B,
14004
),
// Issue::CATEGORY_INTERNAL
new Issue(
self::AccessConstantInternal,
self::CATEGORY_INTERNAL,
self::SEVERITY_NORMAL,
"Cannot access internal constant {CONST} of namepace {NAMESPACE} defined at {FILE}:{LINE} from namespace {NAMESPACE}",
self::REMEDIATION_B,
15000
),
new Issue(
self::AccessClassInternal,
self::CATEGORY_INTERNAL,
self::SEVERITY_NORMAL,
"Cannot access internal {CLASS} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
15001
),
new Issue(
self::AccessClassConstantInternal,
self::CATEGORY_INTERNAL,
self::SEVERITY_NORMAL,
"Cannot access internal class constant {CONST} defined at {FILE}:{LINE}",
self::REMEDIATION_B,
15002
),
new Issue(
self::AccessPropertyInternal,
self::CATEGORY_INTERNAL,
self::SEVERITY_NORMAL,
"Cannot access internal property {PROPERTY} of namespace {NAMESPACE} defined at {FILE}:{LINE} from namespace {NAMESPACE}",
self::REMEDIATION_B,
15003
),
new Issue(
self::AccessMethodInternal,
self::CATEGORY_INTERNAL,
self::SEVERITY_NORMAL,
"Cannot access internal method {METHOD} of namespace {NAMESPACE} defined at {FILE}:{LINE} from namespace {NAMESPACE}",
self::REMEDIATION_B,
15004
),
// Issue::CATEGORY_COMMENT
new Issue(
self::InvalidCommentForDeclarationType,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"The phpdoc comment for {COMMENT} cannot occur on a {TYPE}",
self::REMEDIATION_B,
16000
),
new Issue(
self::MisspelledAnnotation,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw misspelled annotation {COMMENT}, should be one of {COMMENT}",
self::REMEDIATION_B,
16001
),
new Issue(
self::UnextractableAnnotation,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw unextractable annotation for comment '{COMMENT}'",
self::REMEDIATION_B,
16002
),
new Issue(
self::UnextractableAnnotationPart,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw unextractable annotation for a fragment of comment '{COMMENT}': '{COMMENT}'",
self::REMEDIATION_B,
16003
),
new Issue(
self::UnextractableAnnotationSuffix,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw a token Phan may have failed to parse after '{COMMENT}': after {TYPE}, saw '{COMMENT}'",
self::REMEDIATION_B,
16009
),
new Issue(
self::UnextractableAnnotationElementName,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw possibly unextractable annotation for a fragment of comment '{COMMENT}': after {TYPE}, did not see an element name (will guess based on comment order)",
self::REMEDIATION_B,
16010
),
new Issue(
self::CommentParamWithoutRealParam,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw an @param annotation for {VARIABLE}, but it was not found in the param list of {FUNCTIONLIKE}",
self::REMEDIATION_B,
16004
),
new Issue(
self::CommentParamOnEmptyParamList,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw an @param annotation for {VARIABLE}, but the param list of {FUNCTIONLIKE} is empty",
self::REMEDIATION_B,
16005
),
new Issue(
self::CommentOverrideOnNonOverrideMethod,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw an @override annotation for method {METHOD}, but could not find an overridden method and it is not a magic method",
self::REMEDIATION_B,
16006
),
new Issue(
self::CommentOverrideOnNonOverrideConstant,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Saw an @override annotation for class constant {CONST}, but could not find an overridden constant",
self::REMEDIATION_B,
16007
),
new Issue(
self::CommentParamOutOfOrder,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"Expected @param annotation for {VARIABLE} to be before the @param annotation for {VARIABLE}",
self::REMEDIATION_A,
16008
),
new Issue(
self::ThrowTypeAbsent,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"{METHOD}() can throw {TYPE} here, but has no '@throws' declarations for that class",
self::REMEDIATION_A,
16011
),
new Issue(
self::ThrowTypeAbsentForCall,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"{METHOD}() can throw {TYPE} because it calls {FUNCTIONLIKE}(), but has no '@throws' declarations for that class",
self::REMEDIATION_A,
16012
),
new Issue(
self::ThrowTypeMismatch,
self::CATEGORY_COMMENT,
self::SEVERITY_LOW,
"{METHOD}() throws {TYPE}, but it only has declarations of '@throws {TYPE}'",
self::REMEDIATION_A,