PHP

PHP

Made by DeepSource
Invalid class instantiation PHP-W1012
Bug risk
Critical

The class has been incorrectly instantiated, which would cause a runtime error.

Invalid assignment PHP-W1032
Bug risk
Critical

The assignment is not valid and would raise an error during the runtime.

Syntax error PHP-E1111
Bug risk
Critical

Syntax error found in this file. Please refer to the error message for more information.

Invalid use of increment/decrement operators PHP-E1006
Bug risk
Major

This issue is raised when increment/decrement operators are used on any other type of variable than numbers or strings.

throw expression used in PHP < 8.0 PHP-W1017
Bug risk
Critical

throw expression is allowed only in PHP >= 8.0. Trying to use it in earlier PHP versions will give you an error.

Call with inconsistent number of parameters PHP-W1025
Bug risk
Critical

This issue is raised when the number of parameters passed to sprintf / sscanf / fscanf doesn't match the number of placeholders. It is recommended to make sure the number of placeholders and parameters are the same.

Undefined function call detected PHP-E1000
Bug risk
Critical

A function has been called, but not defined. This will result in a run time fatal error.

Exception being raised is not from a valid exception class PHP-E1001
Bug risk
Critical

The Exception class you are trying to use seems to be invalid. This will result in a run time fatal error.

Method is called but not defined PHP-E1002
Bug risk
Critical

The method you are trying to call is not defined, which can result in a fatal error.

Invalid static method call detected PHP-E1003
Bug risk
Critical

Invalid call to a static method. This would lead to a run time error.

Missing return statement in method/function PHP-E1004
Bug risk
Critical

This issue is raised if a method with a return type does not have a return statement of an appropriate type.

Invalid use of class method overriding PHP-E1005
Bug risk
Critical

The method you are trying to override cannot be overridden in the child class. This would result in a runtime error which can break the execution flow.

Class used with instanceof is not of valid type PHP-E1009
Bug risk
Major

A class that you are trying to check against using instanceof keyword is not of valid class object type. This will result in fatal runtime error.

Found class constants inside a trait PHP-E1113
Bug risk
Critical

One or more class constants have been defined inside a trait. The class constants can only be defined inside a class. Defining class constants outside a class can lead to runtime errors.

switch statement contains multiple default cases PHP-E1114
Bug risk
Critical

default case in a switch statement is invoked when none of the cases specified matches the switch condition. It is therefore recommended to have only one default case. Having more than one default case would result in a runtime error.

Abstract method defined in a non-abstract class PHP-E1115
Bug risk
Critical

One or more abstract methods have been defined in a class that is not abstract. Declaring abstract methods are only supported inside an abstract class.

An abstract class is a superclass which provides a blueprint for derived classes and set some rules what the derived classes must implement when they inherit an abstract class.

Invalid options array while creating a cookie PHP-E1116
Bug risk
Critical

One or more keys used in the options array contains an invalid key in the setcookie/setrawcookie function. Starting from PHP 7.3.0, setcookie and setrawcookie functions provide the ability to set cookie options via passing an associative array to a third parameter.

An associative array only allows the use of expires, path, domain, secure, httponly, and samesite keys to be present. Using anything other than these would raise a warning for PHP > 8.0, and a fatal error for PHP >= 8.0 during the runtime.

Abstract method has definition PHP-E1118
Bug risk
Critical

Abstract methods should not have a definition. They are used to define a contract that derived classes must implement. Therefore implementing an abstract method itself violates the meaning of defining the method as abstract.

Invalid typehint detected in arrow function PHP-T1000
Bug risk
Critical

The issue is raised when an arrow function has an invalid parameter and/or return type hint. This can result in type errors at the runtime.