Compare commits

..

3 Commits

Author SHA1 Message Date
as2252258 5bf8a7feb1 1 2021-12-17 04:30:21 +08:00
as2252258 52d26c4481 1 2021-12-17 04:28:23 +08:00
as2252258 dd369d348c 1 2021-12-17 04:12:44 +08:00
2 changed files with 7 additions and 5 deletions
+4 -3
View File
@@ -17,6 +17,7 @@ use Kiri\ToArray;
use Exception; use Exception;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use ReturnTypeWillChange;
use Traversable; use Traversable;
/** /**
@@ -91,7 +92,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
*/ */
public function addItem($item) public function addItem($item)
{ {
array_push($this->_item, $item); $this->_item[] = $item;
} }
/** /**
@@ -143,7 +144,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
* @param mixed $offset * @param mixed $offset
* @param mixed $value * @param mixed $value
*/ */
public function offsetSet(mixed $offset, mixed $value) #[ReturnTypeWillChange] public function offsetSet(mixed $offset, mixed $value)
{ {
$this->_item[$offset] = $value; $this->_item[$offset] = $value;
} }
@@ -152,7 +153,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
/** /**
* @param mixed $offset * @param mixed $offset
*/ */
public function offsetUnset(mixed $offset) #[ReturnTypeWillChange] public function offsetUnset(mixed $offset)
{ {
if ($this->offsetExists($offset)) { if ($this->offsetExists($offset)) {
unset($this->_item[$offset]); unset($this->_item[$offset]);
+3 -2
View File
@@ -33,6 +33,7 @@ use Kiri\Exception\NotFindClassException;
use Kiri\Kiri; use Kiri\Kiri;
use Kiri\ToArray; use Kiri\ToArray;
use ReflectionException; use ReflectionException;
use ReturnTypeWillChange;
use validator\Validator; use validator\Validator;
/** /**
@@ -1000,7 +1001,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
* @param mixed $value * @param mixed $value
* @throws Exception * @throws Exception
*/ */
public function offsetSet(mixed $offset, mixed $value) #[ReturnTypeWillChange] public function offsetSet(mixed $offset, mixed $value)
{ {
$this->__set($offset, $value); $this->__set($offset, $value);
} }
@@ -1009,7 +1010,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
* @param mixed $offset * @param mixed $offset
* @throws Exception * @throws Exception
*/ */
public function offsetUnset(mixed $offset) #[ReturnTypeWillChange] public function offsetUnset(mixed $offset)
{ {
if (!isset($this->_attributes[$offset]) if (!isset($this->_attributes[$offset])
&& !isset($this->_oldAttributes[$offset])) { && !isset($this->_oldAttributes[$offset])) {