Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Contracts\JsonableInterface;
use Illuminate\Support\Contracts\ArrayableInterface;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\Relations\MorphMany;
Expand All @@ -27,7 +27,7 @@
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\ConnectionResolverInterface as Resolver;

abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterface, JsonSerializable {
abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable {

/**
* The connection name for the model.
Expand Down Expand Up @@ -265,19 +265,19 @@ protected static function bootTraits(): void
/**
* Register a new global scope on the model.
*
* @param ScopeInterface $scope
* @param Scope $scope
*
* @return void
*/
public static function addGlobalScope(ScopeInterface $scope): void
public static function addGlobalScope(Scope $scope): void
{
static::$globalScopes[get_called_class()][get_class($scope)] = $scope;
}

/**
* Determine if a model has a global scope.
*
* @param ScopeInterface $scope
* @param Scope $scope
*
* @return bool
*/
Expand All @@ -289,11 +289,11 @@ public static function hasGlobalScope($scope): bool
/**
* Get a global scope registered with the model.
*
* @param ScopeInterface $scope
* @param Scope $scope
*
* @return ScopeInterface|null
* @return Scope|null
*/
public static function getGlobalScope($scope): ?ScopeInterface
public static function getGlobalScope($scope): ?Scope
{
return Arr::first(static::$globalScopes[get_called_class()], function($value, $key) use ($scope)
{
Expand All @@ -304,7 +304,7 @@ public static function getGlobalScope($scope): ?ScopeInterface
/**
* Get the global scopes for this class instance.
*
* @return ScopeInterface[]
* @return Scope[]
*/
public function getGlobalScopes(): array
{
Expand Down Expand Up @@ -1740,7 +1740,7 @@ public function newQuery()
/**
* Get a new query instance without a given scope.
*
* @param ScopeInterface $scope
* @param Scope $scope
*
* @return Builder
*/
Expand Down Expand Up @@ -2317,7 +2317,7 @@ public function relationsToArray():array
// If the values implements the Arrayable interface we can just call this
// toArray method on the instances which will convert both models and
// collections to their proper array form and we'll set the values.
if ($value instanceof ArrayableInterface)
if ($value instanceof Arrayable)
{
$relation = $value->toArray();
}
Expand Down Expand Up @@ -2515,7 +2515,7 @@ protected function mutateAttributeForArray($key, $value)
{
$value = $this->mutateAttribute($key, $value);

return $value instanceof ArrayableInterface ? $value->toArray() : $value;
return $value instanceof Arrayable ? $value->toArray() : $value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Illuminate\Database\Eloquent;

interface ScopeInterface {
interface Scope {

/**
* Apply the scope to a given Eloquent query builder.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Illuminate\Database\Eloquent;

trait SoftDeletingTrait {
trait SoftDeletes {

/**
* Indicates if the model is currently force deleting.
Expand All @@ -14,7 +14,7 @@ trait SoftDeletingTrait {
*
* @return void
*/
public static function bootSoftDeletingTrait()
public static function bootSoftDeletes()
{
static::addGlobalScope(new SoftDeletingScope);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/SoftDeletingScope.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Illuminate\Database\Eloquent;

class SoftDeletingScope implements ScopeInterface {
class SoftDeletingScope implements Scope {

/**
* All of the extensions to be added to the builder.
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseEloquentBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,15 @@ public function scopeApproved($query)
}

class EloquentBuilderTestWithTrashedStub extends Illuminate\Database\Eloquent\Model {
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
protected string $table = 'table';
#[\Override]
public function getKeyName(): string { return 'foo'; }
}

class EloquentBuilderTestNestedStub extends Illuminate\Database\Eloquent\Model {
protected string $table = 'table';
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
}

class EloquentBuilderTestListsStub {
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseSoftDeletingTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testRestoreCancel()


class DatabaseSoftDeletingTraitStub {
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
public $deleted_at;
public function newQuery()
{
Expand Down
Loading