---
title: "analyse/types/invalid-comparison"
pagination: false
---

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

<RuleId id="analyse/types/invalid-comparison" />

In the [`analyse-essential`](/docs/rules/presets/analyse-essential) preset and every stricter one. Report only.

## Configuration

```toml title="pun.toml"
[analyse.rules]
"types/invalid-comparison" = "on"
```

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

## Replaces

- [`InvalidComparisonOperationRule`](https://phpstan.org/error-identifiers/class.notFound) (phpstan-classes)
- [`assignOp.invalid`](https://phpstan.org/error-identifiers/assignOp.invalid) (phpstan)
- [`binaryOp.invalid`](https://phpstan.org/error-identifiers/binaryOp.invalid) (phpstan)
- [`empty.expr`](https://phpstan.org/error-identifiers/empty.expr) (phpstan)
- [`equal.invalid`](https://phpstan.org/error-identifiers/equal.invalid) (phpstan)
- [`greater.invalid`](https://phpstan.org/error-identifiers/greater.invalid) (phpstan)
- [`greaterOrEqual.invalid`](https://phpstan.org/error-identifiers/greaterOrEqual.invalid) (phpstan)
- [`isset.expr`](https://phpstan.org/error-identifiers/isset.expr) (phpstan)
- [`notEqual.invalid`](https://phpstan.org/error-identifiers/notEqual.invalid) (phpstan)
- [`nullCoalesce.expr`](https://phpstan.org/error-identifiers/nullCoalesce.expr) (phpstan)
- [`postDec.expr`](https://phpstan.org/error-identifiers/postDec.expr) (phpstan)
- [`postInc.expr`](https://phpstan.org/error-identifiers/postInc.expr) (phpstan)
- [`preDec.expr`](https://phpstan.org/error-identifiers/preDec.expr) (phpstan)
- [`preInc.expr`](https://phpstan.org/error-identifiers/preInc.expr) (phpstan)
- [`smaller.invalid`](https://phpstan.org/error-identifiers/smaller.invalid) (phpstan)
- [`smallerOrEqual.invalid`](https://phpstan.org/error-identifiers/smallerOrEqual.invalid) (phpstan)
- [`spaceship.invalid`](https://phpstan.org/error-identifiers/spaceship.invalid) (phpstan)

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