---
title: "format/arrays"
pagination: false
---

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

Array literals, list() destructuring and array access. Also in [lint](/docs/rules/lint/arrays) (2) and [analyse](/docs/rules/analyse/arrays) (3).

**[indentation](/docs/rules/format/arrays/indentation)**

Each element of an array must be indented exactly once.

In the `format-laravel` preset. Safe fix.

**[index-brace](/docs/rules/format/arrays/index-brace)**

Array index should always be written by using square braces.

In the `format-laravel` preset. Safe fix.

**[list-syntax](/docs/rules/format/arrays/list-syntax)**

List (`array` destructuring) assignment should be declared using the configured syntax.

In the `format-laravel` preset. Safe fix.

**[no-multiline-double-arrow](/docs/rules/format/arrays/no-multiline-double-arrow)**

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

In the `format-laravel` preset. Safe fix.

**[no-space-around-offset](/docs/rules/format/arrays/no-space-around-offset)**

There MUST NOT be spaces around offset braces.

In the `format-laravel` preset. Safe fix.

**[no-space-before-comma](/docs/rules/format/arrays/no-space-before-comma)**

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

In the `format-laravel` preset. Safe fix.

**[no-space-in-empty](/docs/rules/format/arrays/no-space-in-empty)**

Empty arrays should not contain only whitespace.

Not in any preset. Safe fix.

**[no-trailing-comma-single-line](/docs/rules/format/arrays/no-trailing-comma-single-line)**

If a list of values separated by a comma is contained on a single line, then the last item MUST NOT have a trailing comma.

In the `format-laravel` preset. Safe fix.

**[space-after-comma](/docs/rules/format/arrays/space-after-comma)**

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

In the `format-laravel` preset. Safe fix.

**[syntax](/docs/rules/format/arrays/syntax)**

PHP arrays should be declared using the configured syntax.

In the `format-laravel` preset. Safe fix.

**[trailing-comma-multiline](/docs/rules/format/arrays/trailing-comma-multiline)**

Arguments lists, array destructuring lists, arrays that are multi-line, `match`-lines and parameters lists must have a trailing comma.

In the `format-laravel` preset. Safe fix.

**[trim-spaces](/docs/rules/format/arrays/trim-spaces)**

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

In the `format-laravel` preset. Safe fix.
