Fork me on GitHub
a Sensio Labs Product

Remote Void (v2.18.1) edition

List of Available Rules

Alias

Array Notation

Basic

  • braces

    The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.

  • encoding

    PHP code MUST use only UTF-8 without BOM (remove BOM).

  • non_printable_character (risky)

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

  • psr0 (deprecated, risky)

    Classes must be in a path that matches their namespace, be at least one namespace deep and the class name should match the file name.

  • psr4 (deprecated, risky)

    Class names should match the file name.

  • psr_autoloading (risky)

    Classes must be in a path that matches their namespace, be at least one namespace deep and the class name should match the file name.

Casing

Cast Notation

  • cast_spaces

    A single space or none should be between cast and variable.

  • lowercase_cast

    Cast should be written in lower case.

  • modernize_types_casting (risky)

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

  • no_short_bool_cast

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

  • no_unset_cast

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

  • short_scalar_cast

    Cast (boolean) and (integer) should be written as (bool) and (int), (double) and (real) as (float), (binary) as (string).

Class Notation

Class Usage

Comment

Constant Notation

  • native_constant_invocation (risky)

    Add leading \ before constant invocation of internal constant to speed up resolving. Constant name match is case-sensitive, except for null, false and true.

Control Structure

Doctrine Annotation

Function Notation

  • combine_nested_dirname (risky)

    Replace multiple nested calls of dirname by only one call with second $level parameter. Requires PHP >= 7.0.

  • fopen_flag_order (risky)

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

  • fopen_flags (risky)

    The flags in fopen calls must omit t, and b must be omitted or included consistently.

  • function_declaration

    Spaces should be properly placed in a function declaration.

  • function_typehint_space

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

  • implode_call (risky)

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

  • lambda_not_used_import

    Lambda must not import variables it doesn’t use.

  • method_argument_space

    In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma. Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line.

  • native_function_invocation (risky)

    Add leading \ before function invocation to speed up resolving.

  • 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.

  • no_unreachable_default_argument_value (risky)

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

  • no_useless_sprintf (risky)

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

  • nullable_type_declaration_for_default_null_value

    Adds or removes ? before type declarations for parameters with a default null value.

  • phpdoc_to_param_type (risky)

    EXPERIMENTAL: Takes @param annotations of non-mixed types and adjusts accordingly the function signature. Requires PHP >= 7.0.

  • phpdoc_to_return_type (risky)

    EXPERIMENTAL: Takes @return annotation of non-mixed types and adjusts accordingly the function signature. Requires PHP >= 7.0.

  • regular_callable_call (risky)

    Callables must be called without using call_user_func* when possible.

  • return_type_declaration

    There should be one or no space before colon, and one space after it in return type declarations, according to configuration.

  • single_line_throw

    Throwing exception must be done in single line.

  • static_lambda (risky)

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

  • use_arrow_functions (risky)

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

  • void_return (risky)

    Add void return type to functions with missing or empty return statements, but priority is given to @return annotations. Requires PHP >= 7.1.

Import

Language Construct

List Notation

  • list_syntax

    List (array destructuring) assignment should be declared using the configured syntax. Requires PHP >= 7.1.

Namespace Notation

Naming

  • no_homoglyph_names (risky)

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

Operator

PHP Tag

  • 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.

  • echo_tag_syntax

    Replaces short-echo <?= with long format <?php echo/<?php print syntax, or vice-versa.

  • full_opening_tag

    PHP code must use the long <?php tags or short-echo <?= tags and not other tag variations.

  • linebreak_after_opening_tag

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

  • no_closing_tag

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

  • no_short_echo_tag (deprecated)

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

PHPUnit

PHPDoc

Return Notation

  • blank_line_before_return (deprecated)

    An empty line feed should precede a return statement.

  • no_useless_return

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

  • return_assignment

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

  • simplified_null_return

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

Semicolon

Strict

String Notation

Whitespace

The logo is © 2010-2014 Sensio Labs