[13.x] Use ::class syntax instead of get_class()#59192
Open
sumaiazaman wants to merge 1 commit intolaravel:masterfrom
Open
[13.x] Use ::class syntax instead of get_class()#59192sumaiazaman wants to merge 1 commit intolaravel:masterfrom
sumaiazaman wants to merge 1 commit intolaravel:masterfrom
Conversation
Co-Authored-By: Sumai Azaman <sumaiazaman@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces
get_class($this)with the modern$this::classsyntax available since PHP 8.0, across 14 files.The
::classsyntax 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::classwhich is guaranteed safe since$thisis always an object.Files modified: GuardsAttributes, HasAttributes, HasRelationships, HasUniqueStringIds, TransformsToResource, Model, Seeder, Kernel, EventServiceProvider, CollectsResources, Mailable, SerializesModels, ServiceProvider, Component