---
title: "lint/style/prefer-cast-over-intval"
pagination: false
---

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

<RuleId id="lint/style/prefer-cast-over-intval" />

Not in any set. Unsafe fix: it can change behaviour.

## What it does

Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting operator.

## Configuration

```toml title="pun.toml"
[lint.rules]
"style/prefer-cast-over-intval" = "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.

## Replaces

- [`modernize_types_casting`](https://cs.symfony.com/doc/rules/cast_notation/modernize_types_casting.html) (php-cs-fixer, risky)

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