---
title: "format/operators/unary-spacing"
pagination: false
---

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

<RuleId id="format/operators/unary-spacing" />

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

## What it does

Unary operators should be placed adjacent to their operands.

## Configuration

```toml title="pun.toml"
[format.rules]
"operators/unary-spacing" = true
```

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

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `only-dec-inc` | `bool` | Any | `false` | `only_dec_inc` |

## Replaces

- [`unary_operator_spaces`](https://cs.symfony.com/doc/rules/operator/unary_operator_spaces.html) (php-cs-fixer)

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