Skip to content

Commit

Permalink
Merge pull request #46 from sasha-b-a/master
Browse files Browse the repository at this point in the history
fix php 8.1 warnings
  • Loading branch information
jenssegers authored Jul 24, 2024
2 parents 2f91457 + 354187d commit 907f956
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/logs
phpunit.phar
composer.lock
.phpunit.result.cache
.idea
20 changes: 10 additions & 10 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public function isFillable($key)
* @param string $key
* @return bool
*/
public function isGuarded($key)
public function isGuarded($key): bool
{
return in_array($key, $this->guarded) || $this->guarded == ['*'];
}
Expand All @@ -420,7 +420,7 @@ public function isGuarded($key)
*
* @return bool
*/
public function totallyGuarded()
public function totallyGuarded(): bool
{
return count($this->fillable) == 0 && $this->guarded == ['*'];
}
Expand All @@ -431,7 +431,7 @@ public function totallyGuarded()
* @param int $options
* @return string
*/
public function toJson($options = 0)
public function toJson($options = 0): string
{
return json_encode($this->jsonSerialize(), $options);
}
Expand All @@ -441,7 +441,7 @@ public function toJson($options = 0)
*
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->toArray();
}
Expand Down Expand Up @@ -654,7 +654,7 @@ protected function isJsonCastable($key)
{
$castables = ['array', 'json', 'object', 'collection'];
return $this->hasCast($key) &&
in_array($this->getCastType($key), $castables, true);
in_array($this->getCastType($key), $castables, true);
}

/**
Expand Down Expand Up @@ -863,7 +863,7 @@ public function __set($key, $value)
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->$offset);
}
Expand All @@ -874,7 +874,7 @@ public function offsetExists($offset)
* @param mixed $offset
* @return mixed
*/
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->$offset;
}
Expand All @@ -886,7 +886,7 @@ public function offsetGet($offset)
* @param mixed $value
* @return void
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->$offset = $value;
}
Expand All @@ -897,7 +897,7 @@ public function offsetSet($offset, $value)
* @param mixed $offset
* @return void
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->$offset);
}
Expand All @@ -911,7 +911,7 @@ public function offsetUnset($offset)
public function __isset($key)
{
return (isset($this->attributes[$key]) || isset($this->relations[$key])) ||
($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key)));
($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key)));
}

/**
Expand Down

0 comments on commit 907f956

Please sign in to comment.