mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
优化PHP8.4兼容性
This commit is contained in:
@@ -263,7 +263,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
* @param callable|null $callback 回调函数
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback = null)
|
||||
public function filter(?callable $callback = null)
|
||||
{
|
||||
return new static(array_filter($this->items, $callback ?: null));
|
||||
}
|
||||
@@ -317,7 +317,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
* @param callable|null $callback 回调函数
|
||||
* @return static
|
||||
*/
|
||||
public function sort(callable $callback = null)
|
||||
public function sort(?callable $callback = null)
|
||||
{
|
||||
$items = $this->items;
|
||||
$callback = $callback ?: function ($a, $b) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class Controller
|
||||
* @access public
|
||||
* @param Request $request Request 对象
|
||||
*/
|
||||
public function __construct(Request $request = null)
|
||||
public function __construct(?Request $request = null)
|
||||
{
|
||||
$this->view = View::instance(Config::get('template'), Config::get('view_replace_str'));
|
||||
$this->request = is_null($request) ? Request::instance() : $request;
|
||||
|
||||
@@ -16,7 +16,7 @@ class HttpException extends \RuntimeException
|
||||
private $statusCode;
|
||||
private $headers;
|
||||
|
||||
public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0)
|
||||
public function __construct($statusCode, $message = null, ?\Exception $previous = null, array $headers = [], $code = 0)
|
||||
{
|
||||
$this->statusCode = $statusCode;
|
||||
$this->headers = $headers;
|
||||
|
||||
Reference in New Issue
Block a user