---
title: "lint/operators/no-loose-equality"
pagination: false
---

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

<RuleId id="lint/operators/no-loose-equality" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Report only. Intent: suspicious. Upstream gates: `strictRules.disallowedLooseComparison`.

## What it does

Disallows the loose comparison operators `==` and `!=`; use `===` and `!==`.

## Configuration

```toml title="pun.toml"
[lint.rules]
"operators/no-loose-equality" = "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

- [`DisallowedLooseComparisonRule`](https://github.com/phpstan/phpstan-strict-rules#readme) (phpstan-classes)
- [`equal.notAllowed`](https://phpstan.org/error-identifiers/equal.notAllowed) (phpstan-strict-rules)
- [`notEqual.notAllowed`](https://phpstan.org/error-identifiers/notEqual.notAllowed) (phpstan-strict-rules)

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