From 22fc19053ca0372763ab0301334df527f08f257c Mon Sep 17 00:00:00 2001 From: Derek Date: Sat, 23 Jul 2022 22:11:39 -0400 Subject: [PATCH] Add #[ReturnTypeWillChange] to internal PHP methods Suppress PHP 8.0+ deprecation notices from internal methods missing explicit return types. This copies "laravel/framework" 8.x file Illuminate\Database\Eloquent\Model. --- .github/workflows/ci.yml | 2 +- .travis.yml | 1 + src/Model.php | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc3b987..843482e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [7.1, 7.2, 7.3, 8.0] + php: [7.1, 7.2, 7.3, 8.0, 8.1] steps: - uses: actions/checkout@v2 - uses: shivammathur/setup-php@v2 diff --git a/.travis.yml b/.travis.yml index 9178883..d56377f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ php: - 7.2 - 7.3 - 8.0 + - 8.1 sudo: false diff --git a/src/Model.php b/src/Model.php index cfc73a0..9e6063d 100644 --- a/src/Model.php +++ b/src/Model.php @@ -441,6 +441,7 @@ public function toJson($options = 0) * * @return array */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray(); @@ -863,6 +864,7 @@ public function __set($key, $value) * @param mixed $offset * @return bool */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->$offset); @@ -874,6 +876,7 @@ public function offsetExists($offset) * @param mixed $offset * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->$offset; @@ -886,6 +889,7 @@ public function offsetGet($offset) * @param mixed $value * @return void */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->$offset = $value; @@ -897,6 +901,7 @@ public function offsetSet($offset, $value) * @param mixed $offset * @return void */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->$offset);