---
title: "format/casts/short-scalar"
pagination: false
---

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

<RuleId id="format/casts/short-scalar" />

In the [`format-laravel`](/docs/rules/presets/format-laravel) and [`format-psr12`](/docs/rules/presets/format-psr12) presets. Safe fix.

## What it does

Cast `(boolean)` and `(integer)` should be written as `(bool)` and `(int)`, `(double)` and `(real)` as `(float)`, `(binary)` as `(string)`.

## Configuration

```toml title="pun.toml"
[format.rules]
"casts/short-scalar" = true
```

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

## Replaces

- [`short_scalar_cast`](https://cs.symfony.com/doc/rules/cast_notation/short_scalar_cast.html) (php-cs-fixer)
- [`DeprecatedCastRule`](https://phpstan.org/error-identifiers/cast.deprecated) (phpstan-classes)
- [`deprecated-cast`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#deprecated-cast) (mago-linter)
- [`cast.deprecated`](https://phpstan.org/error-identifiers/cast.deprecated) (phpstan)

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