---
title: "lint/style/prefer-class-keyword-on-object"
pagination: false
---

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

<RuleId id="lint/style/prefer-class-keyword-on-object" />

In the [`modernize`](/docs/rules/sets/modernize) set. Unsafe fix: it can change behaviour.

## What it does

Replace `get_class` calls on object variables with class keyword syntax.

## Configuration

```toml title="pun.toml"
[lint.rules]
"style/prefer-class-keyword-on-object" = "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

- [`get_class_to_class_keyword`](https://cs.symfony.com/doc/rules/language_construct/get_class_to_class_keyword.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)
