8000 Apply fixes from StyleCI (#31036) · laravel/framework@ae08973 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae08973

Browse files
authored
Apply fixes from StyleCI (#31036)
1 parent 6026ef2 commit ae08973

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,11 @@ protected function castAttribute($key, $value)
536536
}
537537

538538
/**
539-
* Cast the given attribute using a custom cast class.
540-
*
541-
* @param string $key
542-
* @return mixed
543-
*/
539+
* Cast the given attribute using a custom cast class.
540+
*
541+
* @param string $key
542+
* @return mixed
543+
*/
544544
protected function getClassCastableAttribute($key)
545545
{
546546
if (isset($this->classCastCache[$key])) {
@@ -705,7 +705,8 @@ protected function setClassCastableAttribute($key, $value)
705705
{
706706
if (is_null($value)) {
707707
$this->attributes = array_merge($this->attributes, array_map(
708-
function () { return null; },
708+
function () {
709+
},
709710
$this->normalizeCastClassResponse($key, $this->resolveCasterClass($key)->set(
710711
$this, $key, $this->{$key}, $this->attributes
711712
))
@@ -719,7 +720,7 @@ function () { return null; },
719720
);
720721
}
721722

722-
unset($this->classCastCache[$key]);
723+
unset($this->classCastCache[$key]);
723724
}
724725

725726
/**
@@ -1031,7 +1032,7 @@ protected function isJsonCastable($key)
10311032
*/
10321033
protected function isClassCastable($key)
10331034
{
1034-
return array_key_exists($key, $this->getCasts()) &&
1035+
return array_key_exists($key, $this->getCasts()) &&
10351036
class_exists($class = $this->getCasts()[$key]) &&
10361037
! in_array($class, static::$primitiveCastTypes);
10371038
}

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,18 +1681,18 @@ public function __toString()
16811681
}
16821682

16831683
/**
1684-
* Prepare the object for serialization.
1685-
*
1686-
* @return array
1687-
*/
1688-
public function __sleep()
1689-
{
1690-
$this->mergeAttributesFromClassCasts();
1691-
1692-
$this->classCastCache = [];
1693-
1694-
return array_keys(get_object_vars($this));
1695-
}
1684+
* Prepare the object for serialization.
1685+
*
1686+
* @return array
1687+
*/
1688+
public function __sleep()
1689+
{
1690+
$this->mergeAttributesFromClassCasts();
1691+
1692+
$this->classCastCache = [];
1693+
1694+
return array_keys(get_object_vars($this));
1695+
}
16961696

16971697
/**
16981698
* When a model is being unserialized, check if it needs to be booted.

tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
66
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;
77
use Illuminate\Database\Eloquent\Model;
8-
use Illuminate\Database\Schema\Blueprint;
9-
use Illuminate\Support\Carbon;
10-
use Illuminate\Support\Facades\Schema;
11-
use Illuminate\Support\Str;
128

139
/**
1410
* @group integration

0 commit comments

Comments
 (0)
0