---
title: "Rules"
pagination: false
mode: wide
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

1,214 rules: 164 format, 680 lint, 370 analyse. 764 have a fix. 23 are Planned and do not run yet. [Search all rules](#all-rules).

## Topic groups

**arrays · 17 rules**

Array literals, list() destructuring and array access.

[format: 12](/docs/rules/format/arrays) · [lint: 2](/docs/rules/lint/arrays) · [analyse: 3](/docs/rules/analyse/arrays)

**attributes · 17 rules**

PHP attributes (#[...]).

[format: 3](/docs/rules/format/attributes) · [analyse: 14](/docs/rules/analyse/attributes)

**casing · 10 rules**

The casing of keywords, constants, types and names.

[format: 9](/docs/rules/format/casing) · [analyse: 1](/docs/rules/analyse/casing)

**casts · 6 rules**

Type casts.

[format: 5](/docs/rules/format/casts) · [analyse: 1](/docs/rules/analyse/casts)

**classes · 87 rules**

Class, interface, trait and enum declarations and their members.

[format: 8](/docs/rules/format/classes) · [lint: 15](/docs/rules/lint/classes) · [analyse: 64](/docs/rules/analyse/classes)

**comments · 9 rules**

Comments other than PHPDoc, including ignore comments.

[format: 7](/docs/rules/format/comments) · [lint: 1](/docs/rules/lint/comments) · [analyse: 1](/docs/rules/analyse/comments)

**complexity · 56 rules**

Code that can be written more simply, and size and complexity limits.

[lint: 56](/docs/rules/lint/complexity)

**control-flow · 37 rules**

if, switch, match, loops, return and the other control structures.

[format: 13](/docs/rules/format/control-flow) · [lint: 16](/docs/rules/lint/control-flow) · [analyse: 8](/docs/rules/analyse/control-flow)

**dead-code · 97 rules**

Code that never runs, or whose result is never used.

[lint: 55](/docs/rules/lint/dead-code) · [analyse: 42](/docs/rules/analyse/dead-code)

**debug · 5 rules**

Type debugging helpers (dumpType, assertType).

[analyse: 5](/docs/rules/analyse/debug)

**deprecated · 8 rules**

Uses of something marked deprecated.

[analyse: 8](/docs/rules/analyse/deprecated)

**functions · 38 rules**

Function and method declarations, calls, arguments and closures.

[format: 8](/docs/rules/format/functions) · [lint: 14](/docs/rules/lint/functions) · [analyse: 16](/docs/rules/analyse/functions)

**imports · 15 rules**

Namespaces and use imports.

[format: 13](/docs/rules/format/imports) · [lint: 1](/docs/rules/lint/imports) · [analyse: 1](/docs/rules/analyse/imports)

**operators · 37 rules**

Operators and their operands.

[format: 15](/docs/rules/format/operators) · [lint: 7](/docs/rules/lint/operators) · [analyse: 15](/docs/rules/analyse/operators)

**performance · 4 rules**

Faster equivalents of slow constructs.

[lint: 4](/docs/rules/lint/performance)

**phpdoc · 71 rules**

PHPDoc blocks and tags.

[format: 25](/docs/rules/format/phpdoc) · [lint: 14](/docs/rules/lint/phpdoc) · [analyse: 32](/docs/rules/analyse/phpdoc)

**refactor · 19 rules**

Configurable codemods: they do nothing until configured.

[lint: 19](/docs/rules/lint/refactor)

**security · 13 rules**

Code that can be exploited, or that leaks or hides data.

[lint: 13](/docs/rules/lint/security)

**statements · 24 rules**

Statements, declare and semicolons.

[format: 15](/docs/rules/format/statements) · [lint: 3](/docs/rules/lint/statements) · [analyse: 6](/docs/rules/analyse/statements)

**strings · 16 rules**

String literals, heredoc and nowdoc.

[format: 9](/docs/rules/format/strings) · [lint: 5](/docs/rules/lint/strings) · [analyse: 2](/docs/rules/analyse/strings)

**style · 88 rules**

One consistent way to write the same thing.

[lint: 88](/docs/rules/lint/style)

**tags · 6 rules**

The PHP open and close tags.

[format: 5](/docs/rules/format/tags) · [lint: 1](/docs/rules/lint/tags)

**types · 201 rules**

Type declarations, type checks and inferred types.

[format: 6](/docs/rules/format/types) · [lint: 77](/docs/rules/lint/types) · [analyse: 118](/docs/rules/analyse/types)

**undefined · 18 rules**

References to something declared nowhere.

[analyse: 18](/docs/rules/analyse/undefined)

**whitespace · 9 rules**

Indentation, blank lines, line endings and trailing whitespace.

[format: 9](/docs/rules/format/whitespace)

## Ecosystem groups

**laravel · 113 rules**

Laravel (ecosystem: on when composer.lock has laravel/framework).

[format: 1](/docs/rules/format/laravel) · [lint: 97](/docs/rules/lint/laravel) · [analyse: 15](/docs/rules/analyse/laravel)

**pest · 58 rules**

Pest (ecosystem: on when composer.lock has pestphp/pest).

[lint: 58](/docs/rules/lint/pest)

**phpunit · 112 rules**

PHPUnit (ecosystem: on when composer.lock has phpunit/phpunit).

[format: 1](/docs/rules/format/phpunit) · [lint: 111](/docs/rules/lint/phpunit)

## Upgrade groups

**laravel-12 · 1 rules**

Upgrade to Laravel 12: code a newer Laravel removes, deprecates or does better.

[lint: 1](/docs/rules/lint/laravel-12)

**php-8.1 · 1 rules**

Upgrade to PHP 8.1: code a newer PHP removes, deprecates or does better.

[lint: 1](/docs/rules/lint/php-8.1)

**php-8.2 · 4 rules**

Upgrade to PHP 8.2: code a newer PHP removes, deprecates or does better.

[lint: 4](/docs/rules/lint/php-8.2)

**php-8.3 · 6 rules**

Upgrade to PHP 8.3: code a newer PHP removes, deprecates or does better.

[lint: 6](/docs/rules/lint/php-8.3)

**php-8.4 · 3 rules**

Upgrade to PHP 8.4: code a newer PHP removes, deprecates or does better.

[lint: 3](/docs/rules/lint/php-8.4)

**php-8.5 · 6 rules**

Upgrade to PHP 8.5: code a newer PHP removes, deprecates or does better.

[lint: 6](/docs/rules/lint/php-8.5)

**php-8.6 · 2 rules**

Upgrade to PHP 8.6: code a newer PHP removes, deprecates or does better.

[lint: 2](/docs/rules/lint/php-8.6)

## All rules

Search by Pun ID or upstream name.

<RulesDirectory />
