8000 Apply fixes from StyleCI by taylorotwell · Pull Request #31036 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Apply fixes from StyleCI #31036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2020
Merged
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
Apply fixes from StyleCI
[ci skip] [skip ci]
  • Loading branch information
taylorotwell authored and StyleCIBot committed Jan 5, 2020
commit 67ee31ac4a2a857260449b3322a3b398fccba95a
17 changes: 9 additions & 8 deletions src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,11 @@ protected function castAttribute($key, $value)
}

/**
* Cast the given attribute using a custom cast class.
*
* @param string $key
* @return mixed
*/
* Cast the given attribute using a custom cast class.
*
* @param string $key
* @return mixed
*/
protected function getClassCastableAttribute($key)
{
if (isset($this->classCastCache[$key])) {
Expand Down Expand Up @@ -705,7 +705,8 @@ protected function setClassCastableAttribute($key, $value)
{
if (is_null($value)) {
$this->attributes = array_merge($this->attributes, array_map(
function () { return null; },
function () {
},
$this->normalizeCastClassResponse($key, $this->resolveCasterClass($key)->set(
$this, $key, $this->{$key}, $this->attributes
))
Expand All @@ -719,7 +720,7 @@ function () { return null; },
);
}

unset($this->classCastCache[$key]);
unset($this->classCastCache[$key]);
}

/**
Expand Down Expand Up @@ -1031,7 +1032,7 @@ protected function isJsonCastable($key)
*/
protected function isClassCastable($key)
{
return array_key_exists($key, $this->getCasts()) &&
return array_key_exists($key, $this->getCasts()) &&
class_exists($class = $this->getCasts()[$key]) &&
! in_array($class, static::$primitiveCastTypes);
}
Expand Down
24 changes: 12 additions & 12 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1681,18 +1681,18 @@ public function __toString()
}

/**
* Prepare the object for serialization.
*
* @return array
*/
public function __sleep()
{
$this->mergeAttributesFromClassCasts();

$this->classCastCache = [];

return array_keys(get_object_vars($this));
}
* Prepare the object for serialization.
*
* @return array
*/
public function __sleep()
{
$this->mergeAttributesFromClassCasts();

$this->classCastCache = [];

return array_keys(get_object_vars($this));
}

/**
* When a model is being unserialized, check if it needs to be booted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;

/**
* @group integration
Expand Down
0