mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 23:39:58 +01:00
PHP 8.1 return type fixes
This commit is contained in:
@@ -248,6 +248,7 @@ abstract class BaseAsset extends PropertyObject
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ['type' => $this->getType(), 'elements' => $this->getElements()];
|
||||
|
||||
@@ -335,6 +335,7 @@ class Data implements DataInterface, ArrayAccess, \Countable, JsonSerializable,
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->items;
|
||||
|
||||
@@ -84,6 +84,7 @@ trait UserObjectLegacyTrait
|
||||
* @return int
|
||||
* @deprecated 1.6 Method makes no sense for user account.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
|
||||
|
||||
@@ -32,6 +32,7 @@ class Package extends BasePackage implements \JsonSerializable
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->data->toArray();
|
||||
|
||||
@@ -129,6 +129,7 @@ abstract class Getters implements ArrayAccess, Countable
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
if ($this->gettersVariable) {
|
||||
|
||||
@@ -30,6 +30,7 @@ class Header implements ArrayAccess, ExportInterface, JsonSerializable
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
|
||||
@@ -28,7 +28,7 @@ class Link implements RenderableInterface, MediaLinkInterface
|
||||
|
||||
/** @var array */
|
||||
protected $attributes = [];
|
||||
/** @var MediaObjectInterface */
|
||||
/** @var MediaObjectInterface|MediaLinkInterface */
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,7 +84,7 @@ class Page implements PageInterface
|
||||
protected $unpublish_date;
|
||||
/** @var string */
|
||||
protected $slug;
|
||||
/** @var string */
|
||||
/** @var string|null */
|
||||
protected $route;
|
||||
/** @var string|null */
|
||||
protected $raw_route;
|
||||
|
||||
@@ -295,6 +295,7 @@ class User extends Data implements UserInterface
|
||||
* @return int
|
||||
* @deprecated 1.6 Method makes no sense for user account.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
|
||||
|
||||
@@ -206,6 +206,7 @@ class Permissions implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
/**
|
||||
* @return ArrayIterator|Traversable
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->actions);
|
||||
|
||||
@@ -257,6 +257,7 @@ abstract class AbstractIndexCollection implements CollectionInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->entries);
|
||||
@@ -301,6 +302,7 @@ abstract class AbstractIndexCollection implements CollectionInterface
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->loadElements());
|
||||
@@ -468,6 +470,7 @@ abstract class AbstractIndexCollection implements CollectionInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->loadCollection()->jsonSerialize();
|
||||
|
||||
@@ -78,6 +78,7 @@ abstract class AbstractLazyCollection extends BaseAbstractLazyCollection impleme
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$this->initialize();
|
||||
|
||||
@@ -97,6 +97,7 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
|
||||
@@ -520,6 +520,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$elements = [];
|
||||
|
||||
@@ -656,6 +656,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->getElements();
|
||||
|
||||
@@ -176,6 +176,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->upload;
|
||||
|
||||
@@ -181,6 +181,7 @@ trait ObjectCollectionTrait
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->doSerialize();
|
||||
|
||||
@@ -172,6 +172,7 @@ trait ObjectTrait
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->doSerialize();
|
||||
|
||||
@@ -235,6 +235,7 @@ class AbstractPagination implements PaginationInterface
|
||||
/**
|
||||
* @return ArrayIterator
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
$this->loadItems();
|
||||
|
||||
@@ -392,6 +392,7 @@ class Session implements SessionInterface
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($_SESSION);
|
||||
|
||||
@@ -108,6 +108,7 @@ interface SessionInterface extends IteratorAggregate
|
||||
*
|
||||
* @return ArrayIterator Return an ArrayIterator of $_SESSION
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator();
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,13 +33,9 @@ parameters:
|
||||
dynamicConstantNames:
|
||||
- GRAV_CLI
|
||||
ignoreErrors:
|
||||
# New in phpstan 0.12, ignore them for now.
|
||||
# New in phpstan 1, ignore them for now.
|
||||
- '#Unsafe usage of new static\(\)#'
|
||||
- '#Cannot instantiate interface Grav\\Framework\\#'
|
||||
# TODO: phpstan bug #3875 (fixed, test if can be removed)
|
||||
-
|
||||
message: '#Unreachable statement - code above always terminates#'
|
||||
path: '*/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php'
|
||||
|
||||
# FIXME: Bugs that need to be fixed
|
||||
# FIXME: PHP 7.3 bug workaround
|
||||
@@ -84,12 +80,12 @@ parameters:
|
||||
-
|
||||
message: '#unknown class Grav\\Plugin\\Admin#'
|
||||
path: '*/system/src/Grav/Common/Flex/Pages/PageObject.php'
|
||||
-
|
||||
message: '#unknown class Grav\\Common\\Grav\\Plugin\\Form\\Forms#'
|
||||
path: '*/system/src/Grav/Common/Session.php'
|
||||
-
|
||||
message: '#unknown class Grav\\Plugin\\Admin\\Admin#'
|
||||
path: '*/system/src/Grav/Common/Flex/Types/Pages/PageObject.php'
|
||||
-
|
||||
message: '#unknown class Grav\\Plugin\\Form\\Forms#'
|
||||
path: '*/system/src/Grav/Common/Processors/PagesProcessor.php'
|
||||
|
||||
# Can be ignored, after fopen there's always an $http_response_header locally available
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user