Skip to content

Commit ae8b503

Browse files
authored
Replace get_class with class magic constant (#9088)
1 parent d3b3d76 commit ae8b503

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

collections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ The `collect` method is primarily useful for converting [lazy collections](#lazy
366366

367367
$collection = $lazyCollection->collect();
368368

369-
get_class($collection);
369+
$collection::class;
370370

371371
// 'Illuminate\Support\Collection'
372372

@@ -1367,7 +1367,7 @@ The `lazy` method returns a new [`LazyCollection`](#lazy-collections) instance f
13671367

13681368
$lazyCollection = collect([1, 2, 3, 4])->lazy();
13691369

1370-
get_class($lazyCollection);
1370+
$lazyCollection::class;
13711371

13721372
// Illuminate\Support\LazyCollection
13731373

container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ If a class has no dependencies or only depends on other concrete classes (not in
7171
}
7272

7373
Route::get('/', function (Service $service) {
74-
die(get_class($service));
74+
die($service::class);
7575
});
7676

7777
In this example, hitting your application's `/` route will automatically resolve the `Service` class and inject it into your route's handler. This is game changing. It means you can develop your application and take advantage of dependency injection without worrying about bloated configuration files.

eloquent-relationships.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ You may customize the behavior of lazy loading violations using the `handleLazyL
18561856

18571857
```php
18581858
Model::handleLazyLoadingViolationUsing(function (Model $model, string $relation) {
1859-
$class = get_class($model);
1859+
$class = $model::class;
18601860

18611861
info("Attempted to lazy load [{$relation}] on model [{$class}].");
18621862
});

0 commit comments

Comments
 (0)