Skip to content

Commit

Permalink
clean up from IDE changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmastech committed Nov 12, 2024
1 parent 3b80435 commit 8fc95ef
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function __construct(array $attributes = [])
*/
protected function bootIfNotBooted()
{
if (!isset(static::$booted[static::class])) {
if (! isset(static::$booted[static::class])) {
static::$booted[static::class] = true;

$this->fireModelEvent('booting', false);
Expand Down Expand Up @@ -324,7 +324,7 @@ protected static function bootTraits()
foreach (class_uses_recursive($class) as $trait) {
$method = 'boot'.class_basename($trait);

if (method_exists($class, $method) && !in_array($method, $booted)) {
if (method_exists($class, $method) && ! in_array($method, $booted)) {
forward_static_call([$class, $method]);

$booted[] = $method;
Expand Down Expand Up @@ -413,7 +413,7 @@ public static function isIgnoringTouch($class = null)
{
$class = $class ?: static::class;

if (!get_class_vars($class)['timestamps'] || !$class::UPDATED_AT) {
if (! get_class_vars($class)['timestamps'] || ! $class::UPDATED_AT) {
return true;
}

Expand Down Expand Up @@ -586,7 +586,7 @@ public function fill(array $attributes)
*/
public function forceFill(array $attributes)
{
return static::unguarded(fn() => $this->fill($attributes));
return static::unguarded(fn () => $this->fill($attributes));
}

/**
Expand Down Expand Up @@ -746,7 +746,7 @@ public function load($relations)
*/
public function loadMorph($relation, $relations)
{
if (!$this->{$relation}) {
if (! $this->{$relation}) {
return $this;
}

Expand Down Expand Up @@ -870,7 +870,7 @@ public function loadExists($relations)
*/
public function loadMorphAggregate($relation, $relations, $column, $function = null)
{
if (!$this->{$relation}) {
if (! $this->{$relation}) {
return $this;
}

Expand Down Expand Up @@ -982,7 +982,7 @@ protected function decrement($column, $amount = 1, array $extra = [])
*/
protected function incrementOrDecrement($column, $amount, $extra, $method)
{
if (!$this->exists) {
if (! $this->exists) {
return $this->newQueryWithoutRelationships()->{$method}($column, $amount, $extra);
}

Expand All @@ -1000,14 +1000,13 @@ protected function incrementOrDecrement($column, $amount, $extra, $method)
$amount = (clone $this)->setAttribute($column, $amount)->getAttributeFromArray($column);
}

return tap($this->setKeysForSaveQuery($this->newQueryWithoutScopes())->{$method}($column, $amount, $extra),
function () use ($column) {
$this->syncChanges();
return tap($this->setKeysForSaveQuery($this->newQueryWithoutScopes())->{$method}($column, $amount, $extra), function () use ($column) {
$this->syncChanges();

$this->fireModelEvent('updated', false);
$this->fireModelEvent('updated', false);

$this->syncOriginalAttribute($column);
});
$this->syncOriginalAttribute($column);
});
}

/**
Expand All @@ -1019,7 +1018,7 @@ function () use ($column) {
*/
public function update(array $attributes = [], array $options = [])
{
if (!$this->exists) {
if (! $this->exists) {
return false;
}

Expand All @@ -1037,7 +1036,7 @@ public function update(array $attributes = [], array $options = [])
*/
public function updateOrFail(array $attributes = [], array $options = [])
{
if (!$this->exists) {
if (! $this->exists) {
return false;
}

Expand All @@ -1053,7 +1052,7 @@ public function updateOrFail(array $attributes = [], array $options = [])
*/
public function updateQuietly(array $attributes = [], array $options = [])
{
if (!$this->exists) {
if (! $this->exists) {
return false;
}

Expand Down Expand Up @@ -1098,7 +1097,7 @@ protected function decrementQuietly($column, $amount = 1, array $extra = [])
public function push()
{
return $this->withoutRecursion(function () {
if (!$this->save()) {
if (! $this->save()) {
return false;
}

Expand All @@ -1110,7 +1109,7 @@ public function push()
? $models->all() : [$models];

foreach (array_filter($models) as $model) {
if (!$model->push()) {
if (! $model->push()) {
return false;
}
}
Expand All @@ -1127,7 +1126,7 @@ public function push()
*/
public function pushQuietly()
{
return static::withoutEvents(fn() => $this->push());
return static::withoutEvents(fn () => $this->push());
}

/**
Expand All @@ -1138,7 +1137,7 @@ public function pushQuietly()
*/
public function saveQuietly(array $options = [])
{
return static::withoutEvents(fn() => $this->save($options));
return static::withoutEvents(fn () => $this->save($options));
}

/**
Expand Down Expand Up @@ -1174,7 +1173,7 @@ public function save(array $options = [])
else {
$saved = $this->performInsert($query);

if (!$this->getConnectionName() &&
if (! $this->getConnectionName() &&
$connection = $query->getConnection()) {
$this->setConnection($connection->getName());
}
Expand All @@ -1200,7 +1199,7 @@ public function save(array $options = [])
*/
public function saveOrFail(array $options = [])
{
return $this->getConnection()->transaction(fn() => $this->save($options));
return $this->getConnection()->transaction(fn () => $this->save($options));
}

/**
Expand Down Expand Up @@ -1429,7 +1428,7 @@ public function delete()
// If the model doesn't exist, there is nothing to delete so we'll just return
// immediately and not do anything else. Otherwise, we will continue with a
// deletion process on the model, firing the proper events, and so forth.
if (!$this->exists) {
if (! $this->exists) {
return;
}

Expand Down Expand Up @@ -1459,7 +1458,7 @@ public function delete()
*/
public function deleteQuietly()
{
return static::withoutEvents(fn() => $this->delete());
return static::withoutEvents(fn () => $this->delete());
}

/**
Expand All @@ -1471,11 +1470,11 @@ public function deleteQuietly()
*/
public function deleteOrFail()
{
if (!$this->exists) {
if (! $this->exists) {
return false;
}

return $this->getConnection()->transaction(fn() => $this->delete());
return $this->getConnection()->transaction(fn () => $this->delete());
}

/**
Expand Down Expand Up @@ -1674,8 +1673,8 @@ public function callNamedScope($scope, array $parameters = [])
public function toArray()
{
return $this->withoutRecursion(
fn() => array_merge($this->attributesToArray(), $this->relationsToArray()),
fn() => $this->attributesToArray(),
fn () => array_merge($this->attributesToArray(), $this->relationsToArray()),
fn () => $this->attributesToArray(),
);
}

Expand Down Expand Up @@ -1716,7 +1715,7 @@ public function jsonSerialize(): mixed
*/
public function fresh($with = [])
{
if (!$this->exists) {
if (! $this->exists) {
return;
}

Expand All @@ -1733,7 +1732,7 @@ public function fresh($with = [])
*/
public function refresh()
{
if (!$this->exists) {
if (! $this->exists) {
return $this;
}

Expand Down Expand Up @@ -1791,7 +1790,7 @@ public function replicate(?array $except = null)
*/
public function replicateQuietly(?array $except = null)
{
return static::withoutEvents(fn() => $this->replicate($except));
return static::withoutEvents(fn () => $this->replicate($except));
}

/**
Expand All @@ -1802,7 +1801,7 @@ public function replicateQuietly(?array $except = null)
*/
public function is($model)
{
return !is_null($model) &&
return ! is_null($model) &&
$this->getKey() === $model->getKey() &&
$this->getTable() === $model->getTable() &&
$this->getConnectionName() === $model->getConnectionName();
Expand All @@ -1816,7 +1815,7 @@ public function is($model)
*/
public function isNot($model)
{
return !$this->is($model);
return ! $this->is($model);
}

/**
Expand Down Expand Up @@ -2027,7 +2026,7 @@ public function getQueueableRelations()
$relations = [];

foreach ($this->getRelations() as $key => $relation) {
if (!method_exists($this, $key)) {
if (! method_exists($this, $key)) {
continue;
}

Expand Down Expand Up @@ -2312,7 +2311,7 @@ public function __set($key, $value)
public function offsetExists($offset): bool
{
try {
return !is_null($this->getAttribute($offset));
return ! is_null($this->getAttribute($offset));
} catch (MissingAttributeException) {
return false;
}
Expand Down

0 comments on commit 8fc95ef

Please sign in to comment.