PHP rules
tx0 checks .php and .phtml files with 323 rules, 99 of them in the default tier. Files that say a tool generated them are skipped. Each rule's page explains what it finds and what it leaves alone.
Default: 99 rules
Bugs and security problems with measured precision. They run without a tx0.toml.
-
tx0/php:abstract-and-finaldefaultA class or method is declared both
abstractandfinal -
tx0/php:abstract-class-instantiateddefaultAn abstract class, interface, trait or enum is instantiated with
new -
tx0/php:abstract-method-in-concrete-classdefaultA class that is not abstract declares an abstract method
-
tx0/php:abstract-private-methoddefaultA method of a class is both abstract and private
-
tx0/php:assert-string-codedefaultassertis given its condition as a string of code -
tx0/php:autoload-functiondefaultA global
__autoloadfunction is declared -
tx0/php:check-result-ignoreddefaultThe result of a check function is not used
-
tx0/php:class-from-requestdefaultA class to instantiate or call is chosen by request input
-
tx0/php:code-from-requestdefaultCode or a function to call is taken from request input
-
tx0/php:column-name-from-requestdefaultA column name in a query is taken from request input
-
tx0/php:command-from-requestdefaultA shell command is built from request input
-
tx0/php:comparison-result-as-onedefaultThe result of a string comparison function is compared with 1 or -1
-
tx0/php:constant-assignment-conditiondefaultA condition assigns a literal instead of comparing with it
-
tx0/php:constant-random-seeddefaultThe random number generator is seeded with a constant
-
tx0/php:continue-targets-switchdefaultcontinuein aswitchacts asbreak -
tx0/php:cors-origin-from-requestdefaultThe allowed CORS origin is copied from the request
-
tx0/php:crypt-without-saltdefaultcryptis called without a salt -
tx0/php:duplicate-array-keydefaultAn array literal gives the same key twice
-
tx0/php:duplicate-captured-variabledefaultA closure captures a variable twice or one named like its parameter
-
tx0/php:duplicate-casedefaultA switch or match lists the same value twice
-
tx0/php:duplicate-conditiondefaultA condition in an if-elseif chain repeats an earlier one
-
tx0/php:duplicate-enum-valuedefaultTwo cases of an enum have the same value
-
tx0/php:duplicate-match-armdefaultA
matcharm repeats a condition of an earlier arm -
tx0/php:duplicate-memberdefaultA class declares a member twice
-
tx0/php:duplicate-parameterdefaultA function has two parameters with the same name
-
tx0/php:enum-propertydefaultAn enum declares a property
-
tx0/php:exception-class-without-basedefaultA class named as an exception extends no other class
-
tx0/php:fetch-url-from-requestdefaultThe server fetches a URL taken from request input
-
tx0/php:finally-jumpdefaultA finally block returns or jumps out, which discards an exception in flight
-
tx0/php:foreach-reference-reuseddefaultA
foreachreference variable is reused as a value variable withoutunset -
tx0/php:format-argumentsdefaultA printf-style call has a different number of values than its format string asks for
-
tx0/php:hardcoded-encryption-keydefaultData is encrypted with a key written in the code
-
tx0/php:haystack-not-arraydefaultThe array argument of an array search is a scalar literal
-
tx0/php:identical-branchesdefaultEvery branch of a conditional does the same
-
tx0/php:identical-operandsdefaultA comparison or logical operator has the same operand on both sides
-
tx0/php:identical-replacementdefaultA replacement call replaces text with the same text
-
tx0/php:ignored-resultdefaultThe result of a function without side effects is dropped
-
tx0/php:implode-argument-orderdefaultimplodegets the array first and the separator second -
tx0/php:impossible-length-checkdefaultA count or length is compared with zero in a way that is always true or always false
-
tx0/php:instance-method-called-staticallydefaultA method that is not static is called statically from a static method
-
tx0/php:invalid-interface-methoddefaultAn interface method is declared in a way PHP does not accept
-
tx0/php:invalid-literal-argumentdefaultA function is called with a literal argument it always rejects
-
tx0/php:invalid-named-argumentsdefaultNamed arguments are repeated or followed by positional ones
-
tx0/php:invalid-readonly-propertydefaultA readonly property has no type, a default value or is static
-
tx0/php:jump-outside-loopdefaultbreakorcontinuehas no loop to leave at that level -
tx0/php:ldap-anonymous-binddefaultAn LDAP bind is made without a password
-
tx0/php:loop-condition-never-changesdefaultNothing in a
whileloop changes the variables of its condition -
tx0/php:loose-hash-comparisondefaultA hash is compared with
==or!= -
tx0/php:low-precedence-assignmentdefaultAn assignment is combined with
and,ororxor, which bind more loosely than= -
tx0/php:magic-method-signaturedefaultA magic method is declared with a signature PHP does not accept
-
tx0/php:mail-header-from-requestdefaultMail headers or sendmail options are built from request input
-
tx0/php:method-from-requestdefaultA method to call is chosen by request input
-
tx0/php:mktime-without-argumentsdefaultmktimeorgmmktimeis called without arguments -
tx0/php:nan-comparisondefaultA value is compared with
NAN, which equals nothing -
tx0/php:negation-before-comparisondefault!applies to the left operand of a comparison instead of the comparison -
tx0/php:overwritten-assignmentdefaultA variable is assigned twice in a row without the first value being used
-
tx0/php:parent-without-parent-classdefaultparent::is used in a class without a parent class -
tx0/php:parse-str-without-resultdefaultparse_stris called without the array for its result -
tx0/php:postfix-self-assignmentdefaultA variable is assigned its own postfix increment or decrement
-
tx0/php:prepare-without-placeholdersdefault$wpdb->prepareis called without placeholders or values -
tx0/php:regex-delimiterdefaultA literal pattern passed to a preg function has no valid delimiters
-
tx0/php:regex-eval-modifierdefaultA preg_replace pattern uses the removed modifier that evaluates the replacement as code
-
tx0/php:regex-exponential-backtrackingdefaultA regular expression takes exponential time on some inputs, confirmed with an input that shows it
-
tx0/php:remote-include-enableddefaultIncluding files from URLs is turned on
-
tx0/php:removed-castdefaultA cast is used that PHP 8 removed
-
tx0/php:removed-functiondefaultA function is called that current PHP versions no longer have
-
tx0/php:response-from-requestdefaultA response body is built from request input without escaping
-
tx0/php:rest-route-without-permissiondefaultA REST route is registered without a permission check
-
tx0/php:self-assignmentdefaultA variable is assigned to itself
-
tx0/php:self-outside-classdefaultself,staticorparentis used outside a class -
tx0/php:session-cookie-flag-disableddefaultThe
httponlyorsecureflag of the session cookie is turned off -
tx0/php:session-id-in-urldefaultSession ids are allowed in URLs
-
tx0/php:setting-from-requestdefaultA PHP setting or environment variable is set from request input
-
tx0/php:sort-result-useddefaultThe boolean result of an in-place sort is used as if it were the sorted array
-
tx0/php:sql-from-requestdefaultAn SQL query is built from request input
-
tx0/php:static-initialization-vectordefaultData is encrypted with an initialization vector fixed in the code
-
tx0/php:static-property-via-instancedefaultA static property is accessed through
$this-> -
tx0/php:stray-semicolon-bodydefaultAn if, elseif, else or foreach has an empty statement as its body
-
tx0/php:strict-types-not-firstdefaultdeclare(strict_types=1)is not the first statement -
tx0/php:string-arithmeticdefaultA string that is not a number is an operand of
+ -
tx0/php:this-in-static-closuredefault$thisis used in a static closure -
tx0/php:this-in-static-methoddefault$thisis used in a static method -
tx0/php:tls-verification-disableddefaultTLS certificate or host name verification is turned off
-
tx0/php:undeclared-property-readdefaultA property is read on
$thisthat the class never declares or assigns -
tx0/php:undefined-class-constantdefaultA constant of the own class is used that the class does not declare
-
tx0/php:undefined-method-on-thisdefaultA method is called on the own class that it does not declare
-
tx0/php:undefined-variabledefaultA variable is read in a function that never gives it a value
-
tx0/php:unreachable-catchdefaultA catch clause follows one for a parent class and is never reached
-
tx0/php:unreachable-codedefaultA statement follows a return, throw, exit, break or continue in the same block
-
tx0/php:unserialize-from-requestdefaultRequest input is unserialized
-
tx0/php:unthrown-exceptiondefaultAn exception is created and dropped without being thrown
-
tx0/php:upload-client-namedefaultAn uploaded file is stored under the name the client sent
-
tx0/php:value-returned-from-voiddefaultA function declared
voidorneverreturns -
tx0/php:variables-from-requestdefaultRequest input chooses the names of variables
-
tx0/php:weak-cipherdefaultData is encrypted with a broken cipher or in ECB mode
-
tx0/php:weak-password-costdefaultA password hash is made with a low work factor
-
tx0/php:weak-rsa-keydefaultA key pair is generated with fewer than 2048 bits
-
tx0/php:weak-tls-versiondefaultA connection is set to use SSL or TLS before 1.2
-
tx0/php:wrong-loop-directiondefaultA for loop's update moves its counter away from the bound of its condition
Recommended: 97 rules
Likely bugs, resource and performance problems.
-
tx0/php:ajax-handler-without-capabilityrecommendedA WordPress AJAX handler does not check the user's capabilities
-
tx0/php:ajax-handler-without-noncerecommendedA WordPress AJAX or admin-post handler does not check a nonce
-
tx0/php:all-proxies-trustedrecommendedEvery address is trusted as a proxy
-
tx0/php:array-merge-in-looprecommendedAn array is rebuilt with
array_mergeon every iteration of a loop -
tx0/php:assertion-after-expected-exceptionrecommendedAn assertion follows the call that is expected to throw, so it never runs
-
tx0/php:assertion-compares-value-to-itselfrecommendedAn assertion compares a value with itself, so it always passes or always fails
-
tx0/php:backtick-shell-operatorrecommendedA shell command is run with backticks
-
tx0/php:captured-variable-modifiedrecommendedA variable captured by value is updated inside the closure
-
tx0/php:case-terminated-by-semicolonrecommendedA
caselabel ends with a semicolon -
tx0/php:class-name-without-argumentrecommendedget_classorget_parent_classis called without an argument -
tx0/php:class-named-methodrecommendedA method named like its class is no longer run as the constructor
-
tx0/php:cleartext-ftprecommendedAn FTP connection is opened without encryption
-
tx0/php:cleartext-url-fetchrecommendedThe server fetches a URL over plain HTTP
-
tx0/php:concatenation-with-arithmeticrecommended.and+or-are mixed without parentheses -
tx0/php:constant-conditionrecommendedAn if condition is a literal
-
tx0/php:constructor-return-valuerecommendedA constructor returns a value, which
newdrops -
tx0/php:csrf-protection-disabledrecommendedProtection against cross-site request forgery is turned off
-
tx0/php:debug-mode-enabledrecommendedDebug mode is turned on in code or as a default
-
tx0/php:debug-outputrecommendedDebugging output such as
var_dumporphpinfois printed -
tx0/php:deprecated-constantrecommendedA constant is used that PHP has deprecated or removed
-
tx0/php:deprecated-functionrecommendedA function is called that PHP has deprecated
-
tx0/php:dollar-brace-interpolationrecommendedA string interpolates with the deprecated
${...}form -
tx0/php:duplicate-importrecommendedA name is imported twice with
use -
tx0/php:dynamic-property-creationrecommendedA property that the class does not declare is assigned on
$this -
tx0/php:echo-request-inputrecommendedRequest input is printed into the page without escaping
-
tx0/php:empty-blockrecommendedA branch or loop has an empty body
-
tx0/php:empty-catchrecommendedA catch block is empty and says nothing about why
-
tx0/php:env-outside-configrecommendedenv()is read outside the configuration files of a Laravel application -
tx0/php:eval-callrecommendedA string built at run time is run with
eval -
tx0/php:exception-cause-droppedrecommendedA
catchthrows a new exception without the caught one -
tx0/php:fatal-user-errorrecommendedtrigger_erroris called withE_USER_ERROR -
tx0/php:final-private-methodrecommendedA private method is declared
final -
tx0/php:for-counter-modified-in-bodyrecommendedThe counter of a
forloop is also changed in its body -
tx0/php:hardcoded-credentialrecommendedA password or secret key is written into the source as a literal
-
tx0/php:implicit-nullable-parameterrecommendedA parameter's type is nullable only through its
nulldefault -
tx0/php:include-from-requestrecommendedA file to include is chosen by request input
-
tx0/php:infinite-looprecommendedA loop with a constant true condition has no way out
-
tx0/php:iso-year-with-monthrecommendedA date format combines the ISO week year with a month or day
-
tx0/php:ldap-filter-from-requestrecommendedAn LDAP filter or base is built from request input
-
tx0/php:log-from-requestrecommendedRequest input is written to a log as it is
-
tx0/php:loop-runs-oncerecommendedA loop body always leaves the loop in its first iteration
-
tx0/php:main-query-replacedrecommendedThe main WordPress query is replaced with
query_posts -
tx0/php:mass-assignment-from-requestrecommendedAll request fields are written to a model at once
-
tx0/php:model-unguardedrecommendedMass assignment protection of a model is turned off
-
tx0/php:nested-named-functionrecommendedA named function is declared inside another function
-
tx0/php:non-canonical-castrecommendedA cast is written with a long name that PHP 8.5 deprecates
-
tx0/php:open-redirectrecommendedA script redirects to a location taken from the request without a check
-
tx0/php:option-name-from-requestrecommendedThe name of a setting to change is taken from request input
-
tx0/php:optional-before-requiredrecommendedA parameter with a default comes before one without, so the default is never used
-
tx0/php:override-only-calls-parentrecommendedA method only calls the parent method of the same name
-
tx0/php:path-from-requestrecommendedA file path or URL is taken from request input
-
tx0/php:permissive-umaskrecommendedThe file creation mask lets other users write new files
-
tx0/php:phpunit-fail-caughtrecommendedA test calls fail() inside a try whose catch swallows the failure, so the test cannot fail there
-
tx0/php:position-as-booleanrecommendedA string position or array key that can be 0 is tested for truth
-
tx0/php:predictable-secretrecommendedA token, password or key is made with a predictable random source
-
tx0/php:predictable-temp-filerecommendedA file with a fixed name is created in the shared temporary directory
-
tx0/php:preg-quote-without-delimiterrecommendedpreg_quotewithout a delimiter is put into a pattern delimited by/ -
tx0/php:raw-query-fragment-concatenationrecommendedA value is pasted into a raw query fragment
-
tx0/php:redirect-from-requestrecommendedA redirect target is taken from request input
-
tx0/php:redirect-without-exitrecommendedA redirect is not followed by
exit -
tx0/php:redundant-boolean-conditionalrecommendedA conditional expression picks between
trueandfalse -
tx0/php:regex-duplicate-alternativerecommendedAn alternative of a regular expression repeats an earlier one, so it can never be the one that matches
-
tx0/php:regex-empty-repeatrecommendedAn unbounded repetition in a regular expression repeats a part that can match nothing
-
tx0/php:regex-from-requestrecommendedA regular expression is built from request input
-
tx0/php:regex-lazy-at-endrecommendedA regular expression ends in a reluctant quantifier, which then matches as little as possible: nothing
-
tx0/php:regex-multibyte-without-utfrecommendedA regular expression without the u modifier puts a multibyte character in a class or under a quantifier, so it works on single bytes
-
tx0/php:regex-replacement-missing-grouprecommendedThe replacement of preg_replace refers to a group that the pattern does not have, which PHP replaces with nothing
-
tx0/php:request-path-in-file-accessrecommendedA file is opened, written or included at a path taken from an HTTP request without a check
-
tx0/php:request-url-fetchedrecommendedA server connects to an address taken from an incoming request without a check
-
tx0/php:request-value-deserializedrecommendedData taken from an HTTP request is passed to
unserialize -
tx0/php:request-value-in-commandrecommendedA command is run with a value taken from an HTTP request
-
tx0/php:request-value-in-pagerecommendedA value taken from an HTTP request is written into an HTML response without escaping
-
tx0/php:rethrow-only-catchrecommendedA catch block only rethrows what it caught
-
tx0/php:rsa-without-oaeprecommendedRSA encryption is used without OAEP padding
-
tx0/php:search-in-array-keysrecommendedin_arraysearches the result ofarray_keysorarray_values -
tx0/php:secret-compared-with-equalsrecommendedA token, signature or hash is compared with
==or=== -
tx0/php:serializable-without-magic-methodsrecommendedA class implements
Serializablewithout__serializeand__unserialize -
tx0/php:session-id-from-requestrecommendedThe session id is set from request input
-
tx0/php:sql-query-from-requestrecommendedThe text of an SQL query is built from a value taken from an HTTP request
-
tx0/php:switch-fallthroughrecommendedA case with statements falls through into the next case
-
tx0/php:throw-in-destructorrecommendedAn exception is thrown from a destructor
-
tx0/php:throw-in-finallyrecommendedAn exception is thrown in a
finallyblock -
tx0/php:twelve-hour-without-meridiemrecommendedA date format has a 12-hour clock hour but no am or pm
-
tx0/php:unconditional-recursionrecommendedA function calls itself on every path
-
tx0/php:unescaped-shell-argumentrecommendedA value is put into a shell command without escaping
-
tx0/php:unqualified-catch-in-namespacerecommendedA
catchin a namespace names a global exception class without\or an import -
tx0/php:unused-captured-variablerecommendedA variable captured by a closure's
useis never used in it -
tx0/php:unused-importrecommendedA name imported with
useis never mentioned -
tx0/php:unused-parameterrecommendedA parameter is never used in the function body
-
tx0/php:unused-private-constantrecommendedA private constant is never used in its class
-
tx0/php:unused-private-methodrecommendedA private method is never called in its class
-
tx0/php:unused-private-propertyrecommendedA private property is never used in its class
-
tx0/php:unused-variablerecommendedA local variable is assigned but never read
-
tx0/php:weak-password-hashrecommendedA password is hashed with a fast general-purpose hash
-
tx0/php:world-writable-permissionrecommendedA file is made writable by every user
-
tx0/php:xml-external-entitiesrecommendedXML parsing is set to load external entities
-
tx0/php:xpath-from-requestrecommendedAn XPath expression is built from request input
Strict: 54 rules
Code that can be written more plainly.
-
tx0/php:any-origin-allowedstrictA response allows every origin to read it across sites
-
tx0/php:assertion-arguments-swappedstrictAn assertion passes the actual value first and the expected literal second, so failures read backwards
-
tx0/php:builtin-argument-countstrictA built-in function is called with too few or too many arguments, which PHP 8 rejects
-
tx0/php:case-equal-to-earlier-casestrictA case of a switch is loosely equal to an earlier case, so it can never be reached
-
tx0/php:catch-generic-exceptionstrictA
catchcatchesException,ErrororThrowableas a whole -
tx0/php:commented-out-codestrictA comment holds code that was turned off
-
tx0/php:cookie-without-protectionstrictA cookie is set without the secure and httponly flags
-
tx0/php:count-in-loop-conditionstrictA for loop computes a count or length again in every iteration
-
tx0/php:dynamic-includestrictA file is included from a path that depends on a variable
-
tx0/php:error-suppressionstrictErrors of an expression are silenced with
@ -
tx0/php:errors-displayedstrictPHP is set to print error messages into the page
-
tx0/php:errors-silenced-globallystrictError reporting or logging is turned off for the whole script
-
tx0/php:exception-without-messagestrictA built-in exception is thrown without a message
-
tx0/php:exit-in-functionstrictA function ends the whole program with
exitordie -
tx0/php:extract-callstrictArray keys are turned into local variables with
extract -
tx0/php:float-equalitystrictA value is compared for equality with a floating-point literal
-
tx0/php:forwarded-ip-trustedstrictA client address is read from a header the client controls
-
tx0/php:global-statementstrictA function reaches global variables with
global -
tx0/php:goto-statementstrictA
gotojumps to a label -
tx0/php:grapheme-in-regex-classstrictA character class of a regular expression contains a combining mark or joiner, so it matches the parts of a character separately
-
tx0/php:hardcoded-ip-addressstrictAn IP address is written in the code
-
tx0/php:loose-equalitystrictValues are compared with
==or!=, which convert types first -
tx0/php:loose-null-comparisonstrictA value is compared with
nullby==or!= -
tx0/php:loose-searchstrictAn array is searched with loose comparison
-
tx0/php:missing-parent-constructor-callstrictA constructor of a subclass does not call the parent constructor
-
tx0/php:query-in-loopstrictA database query runs on every iteration of a loop
-
tx0/php:regex-anchor-binds-one-alternativestrictA ^ or $ in a regular expression applies only to the first or last alternative, not to all of them
-
tx0/php:regex-duplicate-class-memberstrictA bracket expression in a pattern names one character more than once
-
tx0/php:regex-empty-alternativestrictAn alternative of a regular expression is empty, so the choice also matches nothing at all
-
tx0/php:regex-empty-groupstrictA group of a regular expression is empty, so it matches nothing
-
tx0/php:regex-for-literalstrictA regular expression matches only a fixed string
-
tx0/php:regex-impossible-lookaheadstrictA lookahead in a regular expression contradicts the character that follows it, so the pattern never matches
-
tx0/php:regex-possessive-starvesstrictA possessive quantifier takes the characters that the next part of the regular expression needs, so it never matches
-
tx0/php:regex-unmatchable-anchorstrictA ^ or $ in a regular expression stands where it can never match, so the pattern never matches
-
tx0/php:regex-unmatched-backreferencestrictA pattern refers back to a capture that does not exist yet at that point
-
tx0/php:reluctant-any-before-delimiterstrictA regular expression matches up to a delimiter with a reluctant
.*?, where a negated class of the delimiter matches without backtracking -
tx0/php:request-value-loggedstrictA value taken from an HTTP request is written to a log as it is
-
tx0/php:shell-command-callstrictA shell command is run
-
tx0/php:sql-built-by-concatenationstrictAn SQL query is built by pasting values into its text
-
tx0/php:switch-without-defaultstrictA switch has no default case
-
tx0/php:test-method-not-publicstrictA method named like a test is not public, so PHPUnit never runs it
-
tx0/php:throw-generic-exceptionstrictA plain
ExceptionorErroris thrown -
tx0/php:todo-commentstrictA comment marks unfinished work with TODO, FIXME or XXX
-
tx0/php:unbounded-posts-querystrictA WordPress query loads all matching posts without a limit
-
tx0/php:unrestricted-unserializestrictData is unserialized without limiting the classes it may create
-
tx0/php:variable-variablestrictA variable is named by the value of another variable
-
tx0/php:weak-hash-functionstrictData is hashed with MD5 or SHA-1
-
tx0/php:wp-auto-update-disabledstrictAutomatic WordPress updates, security releases included, are turned off
-
tx0/php:wp-constant-after-settingsstrictA WordPress setting is defined after wp-settings.php is loaded, when it no longer has an effect
-
tx0/php:wp-hardening-disabledstrictA WordPress protection, such as the ban on editing code in the dashboard, is turned off
-
tx0/php:wp-misspelled-constantstrictA constant in a WordPress configuration is a misspelling of a setting WordPress reads, so it has no effect
-
tx0/php:wp-repair-enabledstrictThe WordPress database repair page is turned on, and it needs no login
-
tx0/php:wp-unfiltered-uploadsstrictWordPress is told to accept uploads of every file type
-
tx0/php:wp-weak-secret-keystrictA WordPress key or salt is the sample text, empty or short, so login cookies can be forged
: 73 rules
-
tx0/php:array-push-singleallarray_pushis called to append one value -
tx0/php:assignment-in-conditionallA variable is assigned in the condition of an
if -
tx0/php:boolean-expression-complexityallA boolean expression has more logical operators than the configured maximum
-
tx0/php:boolean-flag-parameterallA public function takes a boolean flag
-
tx0/php:boolean-literal-comparisonallA value is compared with
true, or loosely withfalse -
tx0/php:call-user-func-literalallcall_user_funcis called with a fixed function name -
tx0/php:class-dependency-countallA class depends on more classes than the configured maximum
-
tx0/php:class-file-name-mismatchallA class is declared in a file of another name
-
tx0/php:class-lengthallA class has more lines of code than the configured maximum
-
tx0/php:class-name-caseallA class name is not written in StudlyCaps
-
tx0/php:closing-tag-at-endallA file of only PHP code ends with a closing tag
-
tx0/php:cognitive-complexityallA function is harder to follow than the configured maximum
-
tx0/php:collapsible-ifallAn if statement holds only another if and could be joined with it
-
tx0/php:complex-regexallA regular expression has more parts than the limit, so it is hard to read and to change safely
-
tx0/php:compound-assignmentallAn assignment repeats its target where a compound operator would do
-
tx0/php:constant-name-caseallA class constant is not written in uppercase
-
tx0/php:control-without-bracesallThe body of a control structure is not in braces
-
tx0/php:cyclomatic-complexityallA function has more paths through it than the configured maximum
-
tx0/php:double-quotes-without-interpolationallA string in double quotes has nothing to interpolate
-
tx0/php:else-after-jumpallAn else follows a branch that always leaves
-
tx0/php:else-if-spacingallelse ifis written as two words -
tx0/php:empty-function-bodyallA function body is empty without a comment
-
tx0/php:empty-statementallA statement is empty
-
tx0/php:file-lengthallA file has more lines of code than the configured maximum
-
tx0/php:format-without-placeholderallsprintfis called with a format that has no placeholders -
tx0/php:func-get-args-callallA function reads its arguments with
func_get_args -
tx0/php:function-aliasallA function is called by an alias of its main name
-
tx0/php:function-lengthallA function body has more lines of code than the configured maximum
-
tx0/php:globals-array-accessallGlobal variables are used through
$GLOBALS -
tx0/php:is-null-callallis_null($x)is called instead of comparing withnull -
tx0/php:isset-ternaryallisset($x) ? $x : $yis written instead of$x ?? $y -
tx0/php:keyword-caseallA keyword is not written in lowercase
-
tx0/php:legacy-octal-literalallAn octal number is written with only a leading zero
-
tx0/php:line-lengthallA line is longer than the configured maximum
-
tx0/php:list-syntaxallAn array is destructured with
list(...)instead of[...] -
tx0/php:literal-concatenationallTwo string literals are concatenated on one line
-
tx0/php:long-array-syntaxallAn array is written with
array(...)instead of[...] -
tx0/php:magic-numberallA number is written in the code without a name
-
tx0/php:member-without-visibilityallA method or constant of a class has no visibility
-
tx0/php:method-countallA class has more methods than the configured maximum
-
tx0/php:method-name-caseallA method name is not written in camelCase
-
tx0/php:missing-final-newlineallThe file does not end with a line break
-
tx0/php:missing-parameter-typeallA parameter has no type
-
tx0/php:missing-property-typeallA property has no type
-
tx0/php:missing-return-typeallA function has no return type
-
tx0/php:missing-strict-typesallA file with declarations does not enable strict types
-
tx0/php:multiple-classes-per-fileallA file declares more than one class
-
tx0/php:multiple-statements-per-lineallTwo statements are written on one line
-
tx0/php:nested-conditionalallA conditional expression is nested in another
-
tx0/php:nesting-depthallControl structures are nested deeper than the configured maximum
-
tx0/php:parameter-countallA function has more parameters than the configured maximum
-
tx0/php:parameter-reassignedallA parameter is assigned a new value
-
tx0/php:position-check-for-containsallA string search is written with
strposand a comparison -
tx0/php:property-countallA class has more properties than the configured maximum
-
tx0/php:regex-backtracking-on-inputallA regular expression that takes super-linear time is matched against request input
-
tx0/php:regex-char-alternationallA choice between single characters in a regular expression is written with | instead of a class
-
tx0/php:regex-long-form-shorthandallA regular expression spells out a class or quantifier that has a short form, such as
{0,1}for? -
tx0/php:regex-polynomial-backtrackingallA regular expression takes quadratic or higher polynomial time on some inputs, confirmed with an input that shows it
-
tx0/php:regex-redundant-groupallA non-capturing group of a regular expression neither holds a choice nor is repeated, so it changes nothing
-
tx0/php:regex-redundant-quantifierallA regular expression has a quantifier {1}, which changes nothing, or {0}, which removes its part
-
tx0/php:regex-repeated-spacesallA regular expression holds several spaces in a row, which are hard to count
-
tx0/php:regex-single-member-classallA bracket expression in a pattern contains just one letter or digit
-
tx0/php:repeated-string-literalallThe same string literal is repeated in a file
-
tx0/php:return-countallA function has more return statements than the configured maximum
-
tx0/php:short-ternaryallThe short conditional operator
?:is used -
tx0/php:switch-too-few-casesallA
switchhas fewer than three labels -
tx0/php:tab-indentationallCode is indented with tabs
-
tx0/php:trailing-whitespaceallA line ends with spaces or tabs
-
tx0/php:unused-catch-variableallThe variable of a
catchis never used -
tx0/php:uppercase-literalalltrue,falseornullis not written in lowercase -
tx0/php:useless-returnallA function ends with an empty
return -
tx0/php:var-propertyallA property is declared with
varinstead of a visibility -
tx0/php:yoda-conditionallA comparison puts the literal before the variable