---
title: "format/attributes/ordered"
pagination: false
---

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

<RuleId id="format/attributes/ordered" />

Not in any preset. Safe fix.

## What it does

Sorts attributes using the configured sort algorithm.

## Configuration

```toml title="pun.toml"
[format.rules]
"attributes/ordered" = true
```

To skip it in some files, add a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `order` | `list` | Any | `[]` | `order` |
| `sort` | `enum` | `alphabetical`, `custom` | `"alphabetical"` | `sort_algorithm` |

## Replaces

- [`ordered_attributes`](https://cs.symfony.com/doc/rules/attribute_notation/ordered_attributes.html) (php-cs-fixer)

[More format/attributes rules](/docs/rules/format/attributes) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
