mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
php8 兼容
This commit is contained in:
@@ -360,6 +360,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @param mixed $offset 键名
|
* @param mixed $offset 键名
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset)
|
||||||
{
|
{
|
||||||
return array_key_exists($offset, $this->items);
|
return array_key_exists($offset, $this->items);
|
||||||
@@ -371,6 +372,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @param mixed $offset 键名
|
* @param mixed $offset 键名
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetGet($offset)
|
public function offsetGet($offset)
|
||||||
{
|
{
|
||||||
return $this->items[$offset];
|
return $this->items[$offset];
|
||||||
@@ -383,6 +385,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @param mixed $value 值
|
* @param mixed $value 值
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value)
|
||||||
{
|
{
|
||||||
if (is_null($offset)) {
|
if (is_null($offset)) {
|
||||||
@@ -398,6 +401,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @param mixed $offset 键名
|
* @param mixed $offset 键名
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset)
|
||||||
{
|
{
|
||||||
unset($this->items[$offset]);
|
unset($this->items[$offset]);
|
||||||
@@ -408,6 +412,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @access public
|
* @access public
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function count()
|
public function count()
|
||||||
{
|
{
|
||||||
return count($this->items);
|
return count($this->items);
|
||||||
@@ -418,6 +423,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @access public
|
* @access public
|
||||||
* @return ArrayIterator
|
* @return ArrayIterator
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function getIterator()
|
public function getIterator()
|
||||||
{
|
{
|
||||||
return new ArrayIterator($this->items);
|
return new ArrayIterator($this->items);
|
||||||
@@ -428,6 +434,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
|||||||
* @access public
|
* @access public
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
|
|||||||
@@ -2268,27 +2268,32 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// JsonSerializable
|
// JsonSerializable
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ArrayAccess
|
// ArrayAccess
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetSet($name, $value)
|
public function offsetSet($name, $value)
|
||||||
{
|
{
|
||||||
$this->setAttr($name, $value);
|
$this->setAttr($name, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetExists($name)
|
public function offsetExists($name)
|
||||||
{
|
{
|
||||||
return $this->__isset($name);
|
return $this->__isset($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetUnset($name)
|
public function offsetUnset($name)
|
||||||
{
|
{
|
||||||
$this->__unset($name);
|
$this->__unset($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetGet($name)
|
public function offsetGet($name)
|
||||||
{
|
{
|
||||||
return $this->getAttr($name);
|
return $this->getAttr($name);
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
* @return Traversable An instance of an object implementing <b>Iterator</b> or
|
* @return Traversable An instance of an object implementing <b>Iterator</b> or
|
||||||
* <b>Traversable</b>
|
* <b>Traversable</b>
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function getIterator()
|
public function getIterator()
|
||||||
{
|
{
|
||||||
return new ArrayIterator($this->items->all());
|
return new ArrayIterator($this->items->all());
|
||||||
@@ -314,6 +315,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
* @param mixed $offset
|
* @param mixed $offset
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset)
|
||||||
{
|
{
|
||||||
return $this->items->offsetExists($offset);
|
return $this->items->offsetExists($offset);
|
||||||
@@ -324,6 +326,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
* @param mixed $offset
|
* @param mixed $offset
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetGet($offset)
|
public function offsetGet($offset)
|
||||||
{
|
{
|
||||||
return $this->items->offsetGet($offset);
|
return $this->items->offsetGet($offset);
|
||||||
@@ -334,6 +337,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
* @param mixed $offset
|
* @param mixed $offset
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value)
|
||||||
{
|
{
|
||||||
$this->items->offsetSet($offset, $value);
|
$this->items->offsetSet($offset, $value);
|
||||||
@@ -345,6 +349,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
* @return void
|
* @return void
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset)
|
||||||
{
|
{
|
||||||
$this->items->offsetUnset($offset);
|
$this->items->offsetUnset($offset);
|
||||||
@@ -353,6 +358,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
/**
|
/**
|
||||||
* Count elements of an object
|
* Count elements of an object
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function count()
|
public function count()
|
||||||
{
|
{
|
||||||
return $this->items->count();
|
return $this->items->count();
|
||||||
@@ -388,6 +394,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||||||
/**
|
/**
|
||||||
* Specify data which should be serialized to JSON
|
* Specify data which should be serialized to JSON
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
|
|||||||
@@ -1091,7 +1091,7 @@ class Request
|
|||||||
foreach ($filters as $filter) {
|
foreach ($filters as $filter) {
|
||||||
if (is_callable($filter)) {
|
if (is_callable($filter)) {
|
||||||
// 调用函数或者方法过滤
|
// 调用函数或者方法过滤
|
||||||
$value = call_user_func($filter, $value);
|
$value = call_user_func($filter, $value ?? '');
|
||||||
} elseif (is_scalar($value)) {
|
} elseif (is_scalar($value)) {
|
||||||
if (false !== strpos($filter, '/')) {
|
if (false !== strpos($filter, '/')) {
|
||||||
// 正则过滤
|
// 正则过滤
|
||||||
|
|||||||
@@ -480,6 +480,7 @@ class Query
|
|||||||
$result = Cache::get($guid);
|
$result = Cache::get($guid);
|
||||||
}
|
}
|
||||||
if (false === $result) {
|
if (false === $result) {
|
||||||
|
$result = [];
|
||||||
if (isset($this->options['field'])) {
|
if (isset($this->options['field'])) {
|
||||||
unset($this->options['field']);
|
unset($this->options['field']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ trait Jump
|
|||||||
{
|
{
|
||||||
if (is_null($url) && !is_null(Request::instance()->server('HTTP_REFERER'))) {
|
if (is_null($url) && !is_null(Request::instance()->server('HTTP_REFERER'))) {
|
||||||
$url = Request::instance()->server('HTTP_REFERER');
|
$url = Request::instance()->server('HTTP_REFERER');
|
||||||
} elseif ('' !== $url && !strpos($url, '://') && 0 !== strpos($url, '/')) {
|
} elseif ('' !== $url && !strpos($url ?? '', '://') && 0 !== strpos($url ?? '', '/')) {
|
||||||
$url = Url::build($url);
|
$url = Url::build($url ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = $this->getResponseType();
|
$type = $this->getResponseType();
|
||||||
|
|||||||
Reference in New Issue
Block a user