StyleCI

PHP Fixers

Our PHP fixing works by applying single-purposed transformations to files that fix specific issues.

Depending upon the preset, a default set of fixers will be included. If you want more granular control, you can enable or disable specific fixers by adding them to your configuration:

preset: recommended
enabled:
  - no_superfluous_phpdoc_tags
  - declare_strict_types
disabled:
  - align_double_arrow
  - include

{danger} If you want to use our PHP header checking facility, you must configure that part on the settings page; it's the only part of the configuration not available through the .styleci.yml file.

align_comments

Align all multiline phpdoc and comments to match their first line.

{warn} This fixer cannot be enabled at the same time as the align_phpdoc fixer.

align_double_arrow

Align double arrow symbols in consecutive lines.

{warn} This fixer cannot be enabled at the same time as the align_double_arrow_minimal or unalign_double_arrow fixers.

align_double_arrow_minimal

Minimally align double arrow symbols in consecutive lines.

{warn} This fixer cannot be enabled at the same time as the align_double_arrow or unalign_double_arrow fixers.

align_equals

Align equals symbols in consecutive lines.

{warn} This fixer cannot be enabled at the same time as the align_equals_minimal or unalign_equals fixers.

align_equals_minimal

Minimally align equals symbols in consecutive lines.

{warn} This fixer cannot be enabled at the same time as the align_equals or unalign_equals fixers.

align_phpdoc

Align all multiline comments to match their first line.

{warn} This fixer cannot be enabled at the same time as the align_comments fixer.

alpha_ordered_imports

Import use statements MUST be sorted alphabetically.

{info} This fixer can also be enabled using its old names of ordered_imports or ordered_use.

{warn} This fixer cannot be enabled at the same time as the length_ordered_imports fixer.

alpha_ordered_traits

Trait use statements MUST be sorted alphabetically.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

array_indentation

Each element of an array must be indented exactly once.

array_push

Converts simple usages of array_push($x, $y) to $x[] = $y.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

backtick_to_shell_exec

Converts backtick operators to shell_exec calls.

binary_operator_spaces

Binary operators MUST be surrounded by at exactly one space.

{info} This fixer can also be enabled using its old name of operators_spaces.

blank_line_after_namespace

There MUST be one blank line after the namespace declaration.

{info} This fixer can also be enabled using its old name of line_after_namespace.

blank_line_after_opening_tag

Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line.

{info} This fixer can also be enabled using its old name of blankline_after_open_tag.

blank_line_before_break

An empty line feed MUST precede a break statement.

blank_line_before_cases

An empty line feed MUST precede a case or default statement.

blank_line_before_continue

An empty line feed MUST precede a continue statement.

blank_line_before_declare

An empty line feed MUST precede a declare statement.

blank_line_before_do

An empty line feed MUST precede a do statement.

blank_line_before_exit

An empty line feed MUST precede a die or exit statement.

blank_line_before_for

An empty line feed MUST precede a for or foreach statement.

blank_line_before_goto

An empty line feed MUST precede a goto statement.

blank_line_before_if

An empty line feed MUST precede an if statement.

blank_line_before_include

An empty line feed MUST precede an include or require statement.

blank_line_before_return

An empty line feed MUST precede a return statement.

{info} This fixer can also be enabled using its old name of return.

blank_line_before_switch

An empty line feed MUST precede a switch statement.

blank_line_before_throw

An empty line feed MUST precede a throw statement.

blank_line_before_try

An empty line feed MUST precede a try statement.

blank_line_before_while

An empty line feed MUST precede a while statement.

blank_line_before_yield

An empty line feed MUST precede a yield statement.

boolean_operator_linebreak_beginning

Multiline expressions MUST have their boolean operators at the beginning of each line.

{warn} This fixer cannot be enabled at the same time as the boolean_operator_linebreak_end, operator_linebreak_beginning, or operator_linebreak_end fixers.

boolean_operator_linebreak_end

Multiline expressions MUST have their boolean operators at the end of each line.

{warn} This fixer cannot be enabled at the same time as the boolean_operator_linebreak_beginning, operator_linebreak_beginning, or operator_linebreak_end fixers.

cast_spaces

A single space MUST be between cast and variable.

{info} This fixer can also be enabled using its old name of spaces_cast.

class_definition

Whitespace around the keywords of a class, trait or interfaces definition should be one space.

class_keyword_remove

Converts ::class keywords to FQCN strings.

clean_namespace

Namespace must not contain spacing, comments or PHPDoc.

combine_consecutive_issets

Using isset($var) && multiple times should be done in one call.

combine_consecutive_unsets

Calling unset on multiple items should be done in one call.

combine_nested_dirname

Replace multiple nested calls of dirname by only one call with second $level parameter.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

comment_to_phpdoc

Comments with annotation should be docblock when used on structural elements.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

compact_nullable_typehint

Remove extra spaces in a nullable typehint.

concat_with_spaces

Concatenation should be used with at least one whitespace around.

{warn} This fixer cannot be enabled at the same time as the concat_without_spaces fixer.

concat_without_spaces

Concatenation should be used without spaces.

{warn} This fixer cannot be enabled at the same time as the concat_with_spaces fixer.

const_separation

Constants MUST be separated with one blank line.

const_visibility_required

Visibility MUST be declared on all constants.

date_time_immutable

Class DateTimeImmutable should be used instead of DateTime.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

declare_equal_normalize

Equal sign in declare statement MUST NOT be surrounded by spaces.

declare_strict_types

Force strict types declaration in all files.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

die_to_exit

Converts die language construct to exit if possible.

dir_constant

Replaces dirname(__FILE__) expression with equivalent __DIR__ constant.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

doctrine_annotation_array_assignment

Normalizes Doctrine operator assignment in arrays.

doctrine_annotation_braces

Normalizes Doctrine annotations without arguments.

doctrine_annotation_indentation

Doctrine annotations must be indented with four spaces.

doctrine_annotation_spaces

Fixes spaces in Doctrine annotations.

echo_to_print

Converts echo language construct to print if possible.

{warn} This fixer cannot be enabled at the same time as the print_to_echo fixer.

elseif

The keyword elseif should be used instead of else if so that all control keywords look like single words.

encoding

PHP files MUST use only UTF-8 without BOM.

ereg_to_preg

Replace deprecated ereg regular expression functions with preg.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

error_suppression

Error control operator should be added to deprecation notices and/or removed from other cases.

{info} This fixer can also be enabled using its old name of silenced_deprecation_error.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

escape_implicit_backslashes

Escape implicit backslashes in strings and heredocs.

explicit_indirect_variable

Add curly braces to indirect variables to make them clear to understand.

explicit_string_variable

Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax.

final_internal_class

Internal classes should be final.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

final_public_method_for_abstract_class

All public methods of abstract classes should be final.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

final_static_access

Converts static access to self access in final classes.

fopen_flag_order

Order the flags in fopen calls, b and t must be last.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

fopen_flags

The flags in fopen calls MUST omit t.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

full_opening_tag

Code MUST use either the long <?php ?> tags or the short-echo <?= ?> tags.

{info} This fixer can also be enabled using its old name of short_tag.

fully_qualified_strict_types

Transforms imported FQCN parameters and return types in function arguments to short version.

function_declaration

Spaces should be properly placed in a function declaration.

function_to_constant

Replace core functions calls returning constants with the constants.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

function_typehint_space

Ensure single space between function's argument and its typehint.

group_import

There MUST be group use for the same namespaces.

hash_to_slash_comment

Single line comments MUST use double slashes and not a hash.

heredoc_indentation

Heredoc and nowdoc content MUST be properly indented.

heredoc_to_nowdoc

Convert heredoc to nowdoc where possible.

implode_call

Function implode must be called with 2 arguments in the documented order.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

include

The include and require keywords should be followed by exactly one space and then a file path.

indentation

Code MUST use the specified indentation style.

{info} This fixer can also be enabled using its old name of no_tab_indentation.

is_null

Replaces is_null($var) expression with null === $var.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

laravel_braces

Structural bodies MUST be enclosed by braces and properly indented. Braces MUST be properly placed, allowing empty anonymous classes.

{warn} This fixer cannot be enabled at the same time as the psr12_braces, psr2_braces, or symfony_braces fixers.

length_ordered_imports

Import use statements MUST be sorted by length.

{warn} This fixer cannot be enabled at the same time as the alpha_ordered_imports fixer.

linebreak_after_opening_tag

Ensure there is no code on the same line as the PHP open tag.

{info} This fixer can also be enabled using its old name of newline_after_open_tag.

logical_operators

Use && and || logical operators instead of and and or.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

long_array_syntax

Arrays MUST use the long syntax.

{warn} This fixer cannot be enabled at the same time as the short_array_syntax fixer.

long_list_syntax

Destructuring assignment should use the long syntax.

{warn} This fixer cannot be enabled at the same time as the short_list_syntax fixer.

lowercase_cast

Cast should be written in lower case.

lowercase_constants

The PHP constants true, false, and null MUST be in lower case.

{warn} This fixer cannot be enabled at the same time as the uppercase_constants fixer.

lowercase_keywords

PHP keywords MUST be in lower case.

lowercase_static_reference

Class static references self, static and parent MUST be in lower case.

magic_constant_casing

Magic constants should be referred to using the correct casing.

magic_method_casing

Magic method definitions and calls must be using the correct casing.

mb_str_functions

Replace non multibyte-safe functions with corresponding mb function.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

method_argument_space

In arguments and calls, there MUST be 0 spaces before and 1 space after each comma.

{warn} This fixer cannot be enabled at the same time as the method_argument_space_strict fixer.

method_argument_space_strict

In arguments and calls, there MUST be 0 spaces before and 1 space after each comma, and multiline statements MUST be strictly so.

{warn} This fixer cannot be enabled at the same time as the method_argument_space fixer.

method_chaining_indentation

Method chaining MUST be properly indented. Method chaining with different levels of indentation is not supported.

method_separation

Methods MUST be separated with one blank line.

method_visibility_required

Visibility MUST be declared on all methods, with abstract and final declared before the visibility, and static declared after.

{info} This fixer can also be enabled using its old names of visibility or visibility_required.

modernize_types_casting

Replaces intval, floatval, doubleval, strval and boolval function calls with according type casting operator.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

multiline_comment_opening_closing

The start and end of multiline comments and phpdoc MUST be correctly formatted.

native_constant_invocation

Add leading slash before constant invocation of internal constants to speed up resolving.

{info} This fixer can also be enabled using its old name of native_constant_invocation_symfony.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

native_function_casing

Function defined by PHP should be called using the correct casing.

native_function_invocation

Add leading slash before internal function invocation to speed up resolving.

{warn} This fixer cannot be enabled at the same time as the native_function_invocation_symfony fixer.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

native_function_invocation_symfony

Add leading slash before optimized function invocation to speed up resolving.

{warn} This fixer cannot be enabled at the same time as the native_function_invocation fixer.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

native_function_type_declaration_casing

Native type hints for functions should use the correct case.

new_with_braces

All instances created with new keyword must be followed by braces.

newline_before_semicolons_chained

Ensure that there is a newline and then a semicolin in chained function calls.

{warn} This fixer cannot be enabled at the same time as the no_multiline_whitespace_before_semicolons fixer.

no_alias_functions

Master functions shall be used instead of aliases.

{info} This fixer can also be enabled using its old names of alias_functions or join_function.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_alternative_syntax

Replace control structure alternative syntax to use braces.

no_binary_string

There should not be a binary flag before strings.

no_blank_lines_after_class_opening

There should be no empty lines after class opening brace.

no_blank_lines_after_phpdoc

There should not be blank lines between docblock and the documented element.

{info} This fixer can also be enabled using its old name of no_empty_lines_after_phpdocs.

no_blank_lines_after_return

Removes empty lines following a return statement.

no_blank_lines_after_throw

Removes empty lines following a throw statement.

no_blank_lines_around_break

Removes empty lines around a break statement.

no_blank_lines_around_cases

Removes empty lines around a case and default statements.

no_blank_lines_around_continue

Removes empty lines around a continue statement.

no_blank_lines_around_switch

Removes empty lines around a switch statement.

no_blank_lines_before_namespace

There should be no blank lines before a namespace declaration.

{warn} This fixer cannot be enabled at the same time as the single_blank_line_before_namespace fixer.

no_blank_lines_between_imports

Removes empty lines inbetween import use statements.

{info} This fixer can also be enabled using its old names of no_blank_lines_between_uses or remove_lines_between_uses.

no_blank_lines_between_traits

Removes empty lines inbetween trait use statements.

no_break_comment

There must be a comment when fall-through is intentional in a non-empty case body.

no_closing_tag

The closing ?> tag MUST be omitted from files containing only PHP.

{info} This fixer can also be enabled using its old name of php_closing_tag.

no_empty_comment

There should not be any empty comments.

no_empty_phpdoc

There should not be empty PHPDoc blocks.

no_empty_statement

Removes empty statements such as additional semicolons.

{info} This fixer can also be enabled using its old names of duplicate_semicolon or no_duplicate_semicolons.

no_extra_block_blank_lines

Removes extra empty lines inside statements directly wrapped in blocks.

no_extra_consecutive_blank_lines

Removes extra consecutive empty lines.

{info} This fixer can also be enabled using its old name of extra_empty_lines.

no_homoglyph_names

Replace accidental usage of homoglyphs (non ascii characters) in names.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_leading_import_slash

Remove leading slashes in use clauses.

{info} This fixer can also be enabled using its old name of remove_leading_slash_use.

no_leading_namespace_whitespace

The namespace declaration line shouldn't contain leading whitespace.

{info} This fixer can also be enabled using its old name of namespace_no_leading_whitespace.

no_multiline_whitespace_around_double_arrow

Operator => should not be surrounded by multi-line whitespaces.

{info} This fixer can also be enabled using its old names of double_arrow_multiline_whitespaces or double_arrow_no_multiline_whitespace.

no_multiline_whitespace_before_semicolons

There MUST NOT be a newline before a semicolon.

{info} This fixer can also be enabled using its old name of multiline_spaces_before_semicolon.

{warn} This fixer cannot be enabled at the same time as the newline_before_semicolons_chained fixer.

no_null_property_initialization

Properties MUST not be explicitly initialized with null except when they have a type declaration (PHP 7.4).

no_nullable_type_declarations

There MUST NOT be a ? in the type declaration of a parameter with a null default.

{warn} This fixer cannot be enabled at the same time as the nullable_type_declarations fixer.

no_php4_constructor

Convert PHP4-style constructors to __construct.

{info} This fixer can also be enabled using its old name of php4_constructor.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_short_bool_cast

Short cast bool using double exclamation mark should not be used.

{info} This fixer can also be enabled using its old name of short_bool_cast.

no_short_echo_tag

Replaces short-echo <?= with long format <?php echo syntax.

{info} This fixer can also be enabled using its old name of short_echo_tag.

no_single_line_asterisk_comment

Single line comments MUST use double slashes and not asterisk style.

no_singleline_whitespace_before_semicolons

Single-line whitespace before closing semicolon are prohibited.

{info} This fixer can also be enabled using its old name of spaces_before_semicolon.

no_spaces_after_function_name

When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis.

{info} This fixer can also be enabled using its old name of function_call_space.

no_spaces_inside_offset

There MUST NOT be spaces between the offset square braces and its contained values.

{info} This fixer can also be enabled using its old name of no_spaces_inside_ofsset.

no_spaces_inside_parenthesis

There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis.

{info} This fixer can also be enabled using its old name of parenthesis.

no_spaces_outside_offset

There MUST NOT be spaces directly ouside offset square braces.

{info} This fixer can also be enabled using its old name of no_spaces_outside_ofsset.

no_superfluous_elseif

Replaces superfluous elseif with if.

no_superfluous_phpdoc_tags

Removes @param, @return and @var tags that do not provide any useful information.

{warn} This fixer cannot be enabled at the same time as the no_superfluous_phpdoc_tags_symfony fixer.

no_superfluous_phpdoc_tags_symfony

Removes inheritdoc and @param, @return and @var tags that do not provide any useful information.

{warn} This fixer cannot be enabled at the same time as the no_superfluous_phpdoc_tags fixer.

no_trailing_comma_in_list_call

Remove trailing commas in list function calls.

{info} This fixer can also be enabled using its old name of list_commas.

no_trailing_comma_in_singleline_array

PHP single-line arrays should not have trailing comma.

{info} This fixer can also be enabled using its old name of single_array_no_trailing_comma.

no_trailing_whitespace

Remove trailing whitespace at the end of non-blank lines.

{info} This fixer can also be enabled using its old name of trailing_spaces.

no_trailing_whitespace_in_comment

There MUST be no trailing spaces inside comment or PHPDoc.

no_trailing_whitespace_in_string

There must be no trailing whitespace in strings.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_unneeded_control_parentheses

Removes unneeded parentheses around control statements.

{info} This fixer can also be enabled using its old name of unneeded_control_parentheses.

no_unneeded_curly_braces

Removes unneeded curly braces that are superfluous and are not part of a control structure body.

no_unneeded_final_method

A final class must not have final methods and private methods must not be final.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_unreachable_default_argument_value

In function arguments there must not be arguments with default values before non-default ones.

{info} This fixer can also be enabled using its old name of method_argument_default_value.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_unset_cast

Variables must be set null instead of using (unset) casting.

no_unset_on_property

Properties should be set to null instead of using unset.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_unused_imports

Unused use statements must be removed.

{info} This fixer can also be enabled using its old name of unused_use.

no_unused_lambda_imports

There MUST NOT be unused variables imported by Closures.

no_useless_else

There should not be useless else cases.

no_useless_return

There should not be an empty return statement at the end of a function.

no_useless_sprintf

There must be no sprintf calls with only the first argument.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

no_whitespace_before_comma_in_array

In array declaration, there MUST NOT be a whitespace before each comma.

{info} This fixer can also be enabled using its old name of array_element_no_space_before_comma.

no_whitespace_in_blank_line

Remove trailing whitespace at the end of blank lines.

{info} This fixer can also be enabled using its old names of no_whitespace_in_blank_lines or whitespacy_lines.

non_printable_character

Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other invisible unicode symbols.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

normalize_index_brace

Array index should always be written by using square braces.

not_operator_with_space

Logical NOT operators (!) should have leading and trailing whitespaces.

{info} This fixer can also be enabled using its old names of logical_not_operators_with_spaces or not_operators_with_space.

not_operator_with_successor_space

Logical NOT operators (!) should have one trailing whitespace.

{info} This fixer can also be enabled using its old name of logical_not_operators_with_successor_space.

nullable_type_declarations

There MUST be a ? in the type declaration of a parameter with a null default.

{warn} This fixer cannot be enabled at the same time as the no_nullable_type_declarations fixer.

object_operator_without_whitespace

There should not be space before or after object operators -> and ?->.

{info} This fixer can also be enabled using its old name of object_operator.

operator_linebreak_beginning

Multiline expressions MUST have all their operators at the beginning of each line.

{warn} This fixer cannot be enabled at the same time as the boolean_operator_linebreak_beginning, boolean_operator_linebreak_end, or operator_linebreak_end fixers.

operator_linebreak_end

Multiline expressions MUST have all their operators at the end of each line.

{warn} This fixer cannot be enabled at the same time as the boolean_operator_linebreak_beginning, boolean_operator_linebreak_end, or operator_linebreak_beginning fixers.

ordered_class_elements

Orders the elements of classes/interfaces/traits.

php_unit_construct

PHPUnit assertion method calls like ->assertSame(true, $foo) should be written with dedicated method like ->assertTrue($foo).

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_dedicate_assert

PHPUnit assertions like assertInternalType, assertFileExists, should be used over assertTrue.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_dedicate_assert_internal_type

PHPUnit assertions like assertIsArray should be used over assertInternalType.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_expectation

Usages of ->setExpectedException* methods MUST be replaced by ->expectException* methods.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_fqcn_annotation

PHPUnit annotations should be a FQCNs including a root namespace.

php_unit_mock

The PHPUnit methods createMock or createPartialMock MUST be used instead of legacy variants.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_mock_short_will_return

Usage of PHPUnit's mock e.g. ->will($this->returnValue(..)) MUST be replaced by its shorter equivalent.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_namespaced

PHPUnit classes MUST be used in namespaced version, e.g. \PHPUnit\Framework\TestCase instead of \PHPUnit_Framework_TestCase.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_no_expectation_annotation

Usages of @expectedException* annotations MUST be replaced by ->setExpectedException* methods.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_ordered_covers

Order @covers annotation of PHPUnit tests.

php_unit_set_up_tear_down_visibility

Changes the visibility of the setUp() and tearDown() functions of PHPUnit to protected, to match the PHPUnit TestCase.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_strict

PHPUnit methods like assertSame should be used instead of assertEquals.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

php_unit_test_case_instance_method_calls

Calls to PHPUnit\Framework\TestCase static methods MUST be of the form $this->.

{warn} This fixer cannot be enabled at the same time as the php_unit_test_case_self_method_calls or php_unit_test_case_static_method_calls fixers.

php_unit_test_case_self_method_calls

Calls to PHPUnit\Framework\TestCase static methods MUST be of the form self::.

{warn} This fixer cannot be enabled at the same time as the php_unit_test_case_instance_method_calls or php_unit_test_case_static_method_calls fixers.

php_unit_test_case_static_method_calls

Calls to PHPUnit\Framework\TestCase static methods MUST be of the form static::.

{warn} This fixer cannot be enabled at the same time as the php_unit_test_case_instance_method_calls or php_unit_test_case_self_method_calls fixers.

php_unit_test_class_requires_covers

Adds a default @coversNothing annotation to PHPUnit test classes that have no @covers* annotation.

phpdoc_add_missing_param_annotation

PHPDoc should contain @param for all params.

phpdoc_align

All items of the given phpdoc tags MUST be aligned vertically.

{info} This fixer can also be enabled using its old name of phpdoc_params.

phpdoc_annotation_without_dot

PHPDoc annotation descriptions should not be a sentence.

phpdoc_indent

Docblocks should have the same indentation as the documented subject.

phpdoc_inline_inheritdoc

@inheritDoc and related tags MUST always be written in inline form.

{info} This fixer can also be enabled using its old name of phpdoc_inline_tag.

phpdoc_inline_tag_normalizer

PHPDoc tags written in inline form MUST be normalized.

phpdoc_link_to_see

@link MUST always be written as @see.

phpdoc_no_access

@access annotations MUST be omitted from phpdocs.

phpdoc_no_empty_return

@return void and @return null annotations should be omitted from PHPDoc.

{info} This fixer can also be enabled using its old name of phpdoc_no_simplified_null_return.

phpdoc_no_package

@package and @subpackage annotations MUST be omitted from phpdocs

phpdoc_no_useless_inheritdoc

Classy that does not inherit must not have @inheritdoc tags.

phpdoc_order

Annotations in phpdocs MUST be ordered so that @param annotations come first, then @throws, then @return.

phpdoc_property

@property tags MUST be used rather than other variants.

phpdoc_return_self_reference

@return annotations for reference to self MUST be normalized.

phpdoc_scalar

Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double.

phpdoc_separation

Annotations of the same type should immediately follow each other, and annotations of different types MUST be separated.

phpdoc_single_line_var_spacing

Single line @var PHPDoc should have proper spacing.

phpdoc_singular_inheritdoc

The singular @inheritDoc form should be preferred.

phpdoc_summary

PHPDoc summary should end in either a full stop, exclamation mark, or question mark.

{info} This fixer can also be enabled using its old name of phpdoc_short_description.

phpdoc_to_comment

Docblocks should only be used on structural elements.

phpdoc_trim

PHPDoc should start and end with content, excluding the very first and last line of the docblocks.

phpdoc_trim_consecutive_blank_line_separation

Removes extra blank lines after summary and after description in PHPDoc.

phpdoc_type_to_var

@type MUST always be written as @var.

{warn} This fixer cannot be enabled at the same time as the phpdoc_var_to_type fixer.

phpdoc_types

The correct case must be used for standard PHP types in PHPDoc.

phpdoc_types_null_last

Moves null to the end of a phpdoc union type.

{warn} This fixer cannot be enabled at the same time as the phpdoc_types_order fixer.

phpdoc_types_order

Sorts phpdoc union types alphabetically and moves null to the end.

{warn} This fixer cannot be enabled at the same time as the phpdoc_types_null_last fixer.

phpdoc_var_to_type

@var MUST always be written as @type.

{warn} This fixer cannot be enabled at the same time as the phpdoc_type_to_var fixer.

phpdoc_var_without_name

@var and @type annotations of classy properties should not contain the name.

post_increment

Post incrementation/decrementation should be used if possible.

{warn} This fixer cannot be enabled at the same time as the pre_increment fixer.

pow_to_exponentiation

Converts pow to the ** operator.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

pre_increment

Pre incrementation/decrementation should be used if possible.

{warn} This fixer cannot be enabled at the same time as the post_increment fixer.

print_to_echo

Converts print language construct to echo if possible.

{warn} This fixer cannot be enabled at the same time as the echo_to_print fixer.

property_separation

Properties MUST be separated with one blank line.

property_visibility_required

Visibility MUST be declared on all properties, with static declared after the visibility.

protected_to_private

Converts protected variables and methods to private where possible.

psr12_braces

Structural bodies MUST be enclosed by braces and properly indented. Braces MUST be properly placed, allowing empty anonymous classes.

{info} This fixer can also be enabled using its old name of braces.

{warn} This fixer cannot be enabled at the same time as the laravel_braces, psr2_braces, or symfony_braces fixers.

psr2_braces

Structural bodies MUST be enclosed by braces and properly indented. Braces MUST be properly placed.

{warn} This fixer cannot be enabled at the same time as the laravel_braces, psr12_braces, or symfony_braces fixers.

psr4

Class names MUST match the file name.

{info} This fixer can also be enabled using its old name of psr0.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

random_api_migration

Replaces rand, srand, getrandmax functions calls with their mt_* analogs.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

regular_callable_call

Callables must be called without using call_user_func* when possible.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

return_assignment

Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method.

return_type_declaration

There should be no space before colon and one space after it in return type declaration.

self_accessor

Inside class or interface element self should be preferred to the class name itself.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

self_static_accessor

Inside a final class or anonymous class self should be preferred to static.

semicolon_after_instruction

Instructions must be terminated with a semicolon.

set_type_to_cast

Cast shall be used, not settype.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

short_array_syntax

Arrays MUST use the short syntax.

{warn} This fixer cannot be enabled at the same time as the long_array_syntax fixer.

short_list_syntax

Destructuring assignment MUST use the short syntax.

{warn} This fixer cannot be enabled at the same time as the long_list_syntax fixer.

short_scalar_cast

Casts (boolean), (integer), (double), (real), (float), and (binary) should be replaced with their canonical forms.

silenced_deprecation_error

Ensures deprecation notices are silenced.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

simple_to_complex_string_variable

Converts explicit variables in double-quoted strings and heredoc syntax from simple to complex format (${ to {$).

simplified_if_return

Simplify if control structures that return the boolean result of their condition.

simplified_null_return

A return statement wishing to return void should not return null.

{info} This fixer can also be enabled using its old name of empty_return.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

single_blank_line_at_eof

A PHP file without end tag must always end with a single empty line feed.

{info} This fixer can also be enabled using its old name of eof_ending.

single_blank_line_before_namespace

There should be exactly one blank line before a namespace declaration.

{warn} This fixer cannot be enabled at the same time as the no_blank_lines_before_namespace fixer.

single_class_element_per_statement

There MUST NOT be more than one property or constant declared per statement.

single_import_per_statement

There MUST be one use keyword per declaration.

{info} This fixer can also be enabled using its old name of multiple_use.

single_line_after_imports

Each namespace use MUST go on its own line and there MUST be one blank line after the use statements block.

single_line_class_definition

Class declarations MUST span only one line.

single_line_throw

Throwing exception must be done in single line.

single_quote

Convert double quotes to single quotes for simple strings.

single_space_after_construct

There MUST be exactly one space after language constructs.

single_trait_insert_per_statement

Each trait use must be done as single statement.

space_after_semicolon

Remove trailing whitespace after a semicolon.

{info} This fixer can also be enabled using its old name of spaces_after_semicolon.

standardize_increment

Increment and decrement operators should be used if possible.

standardize_not_equals

Replace all <> with !=.

{info} This fixer can also be enabled using its old name of standardize_not_equal.

static_lambda

Lambdas not (indirect) referencing $this must be declared static.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

strict_comparison

Comparisons should be strict.

{info} This fixer can also be enabled using its old name of strict.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

strict_param

Functions should be used with $strict param set to true.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

string_line_ending

All multi-line strings must use correct line ending.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

switch_case_semicolon_to_colon

A case should be followed by a colon and not a semicolon.

switch_case_space

Removes extra spaces between colon and case value.

switch_continue_to_break

Switch case must not be ended with continue but with break.

symfony_braces

Structural bodies MUST be enclosed by braces and properly indented. Braces MUST be properly placed, allowing empty anonymous classes and single-line closures.

{warn} This fixer cannot be enabled at the same time as the laravel_braces, psr12_braces, or psr2_braces fixers.

ternary_operator_spaces

Standardize spaces around ternary operator.

{info} This fixer can also be enabled using its old name of ternary_spaces.

ternary_to_elvis_operator

Use the Elvis operator ?: where possible.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

ternary_to_null_coalescing

The null coalescing operator ?? MUST be used where possible in place of ternary style.

trailing_comma_in_multiline_array

Multiline arrays MUST have a trailing comma.

{info} This fixer can also be enabled using its old name of multiline_array_trailing_comma.

trailing_comma_in_multiline_call

Multiline calls MUST have a trailing comma.

trim_array_spaces

Arrays should be formatted like function/method arguments, without leading or trailing single line space.

unalign_double_arrow

Unalign double arrow symbols.

{warn} This fixer cannot be enabled at the same time as the align_double_arrow or align_double_arrow_minimal fixers.

unalign_equals

Unalign equals symbols.

{warn} This fixer cannot be enabled at the same time as the align_equals or align_equals_minimal fixers.

unary_operator_spaces

Unary operators should be placed adjacent to their operands.

{info} This fixer can also be enabled using its old name of unary_operators_spaces.

unix_line_endings

All PHP files MUST use the Unix LF line ending.

{info} This fixer can also be enabled using its old name of linefeed.

uppercase_constants

The PHP constants true, false, and null MUST be in upper case.

{warn} This fixer cannot be enabled at the same time as the lowercase_constants fixer.

use_arrow_functions

Anonymous functions with one-liner return statement must use arrow functions.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

void_return

Add the void return type to functions with missing or empty return statements.

{danger} This is a "risky" heuristic fixer, and could change code behavior!

whitespace_after_comma_in_array

In array declaration, there MUST be a whitespace after each comma.

{info} This fixer can also be enabled using its old name of array_element_white_space_after_comma.

yoda_style

Boolean comparison expressions MUST be written in the Yoda style.


Please note that much of the content on this page is Copyright (c) 2012-2021 Fabien Potencier and Dariusz Rumiński, licensed under The MIT License.