Skip to content

[13.x] Use ::class syntax instead of get_class()#59192

Open
sumaiazaman wants to merge 1 commit intolaravel:masterfrom
sumaiazaman:use-class-keyword-syntax
Open

[13.x] Use ::class syntax instead of get_class()#59192
sumaiazaman wants to merge 1 commit intolaravel:masterfrom
sumaiazaman:use-class-keyword-syntax

Conversation

@sumaiazaman
Copy link
Contributor

This PR replaces get_class($this) with the modern $this::class syntax available since PHP 8.0, across 14 files.

The ::class syntax on objects is cleaner, more concise, and consistent with how class names are typically referenced in modern PHP.

Changes

All replacements are get_class($this)$this::class which is guaranteed safe since $this is always an object.

Files modified: GuardsAttributes, HasAttributes, HasRelationships, HasUniqueStringIds, TransformsToResource, Model, Seeder, Kernel, EventServiceProvider, CollectsResources, Mailable, SerializesModels, ServiceProvider, Component

Co-Authored-By: Sumai Azaman <sumaiazaman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant