---
title: "lint/statements/require-strict-types"
pagination: false
---

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

<RuleId id="lint/statements/require-strict-types" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix where types prove it, unsafe otherwise. Intent: suspicious.

## What it does

Force a strict types mode in all files.

## Configuration

```toml title="pun.toml"
[lint.rules]
"statements/require-strict-types" = "error"
```

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

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `preserve-existing-declaration` | `bool` | Any | `false` | `preserve_existing_declaration` |
| `strategy` | `enum` | `remove`, `add-when-missing`, `enforce` | `"enforce"` | `strategy` |

## Replaces

- [`declare_strict_types`](https://cs.symfony.com/doc/rules/strict/declare_strict_types.html) (php-cs-fixer, risky)
- [`strict-types`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#strict-types) (mago-linter)

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