---
title: "lint/functions/no-required-after-optional"
pagination: false
---

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

<RuleId id="lint/functions/no-required-after-optional" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix.

## What it does

Report or fix optional parameters declared before required ones.

## Configuration

```toml title="pun.toml"
[lint.rules]
"functions/no-required-after-optional" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`OptionalParametersAfterRequired`](https://getrector.com/rule-detail/optional-parameters-after-required-rector) (rector)
- [`optional-param-order`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#optional-param-order) (mago-linter)
- [`parameter.requiredAfterOptional`](https://phpstan.org/error-identifiers/parameter.requiredAfterOptional) (phpstan)

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