Skip to content

Commit

Permalink
Implement ReturnTypeWillChange for Countable (#38221)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Aug 3, 2021
1 parent e08367a commit 76380cf
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 38 deletions.
3 changes: 1 addition & 2 deletions src/Illuminate/Bus/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use JsonSerializable;
use ReturnTypeWillChange;
use Throwable;

class Batch implements Arrayable, JsonSerializable
Expand Down Expand Up @@ -460,7 +459,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Illuminate\Support\HigherOrderCollectionProxy;
use Illuminate\Support\HigherOrderWhenProxy;
use JsonSerializable;
use ReturnTypeWillChange;
use Symfony\Component\VarDumper\VarDumper;
use Traversable;

Expand Down Expand Up @@ -834,7 +833,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return array_map(function ($value) {
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Container/RewindableGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getIterator()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
if (is_callable($count = $this->count)) {
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Database/Eloquent/Casts/ArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use ArrayObject as BaseArrayObject;
use Illuminate\Contracts\Support\Arrayable;
use JsonSerializable;
use ReturnTypeWillChange;

class ArrayObject extends BaseArrayObject implements Arrayable, JsonSerializable
{
Expand Down Expand Up @@ -34,7 +33,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->getArrayCopy();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Illuminate\Support\Traits\ForwardsCalls;
use JsonSerializable;
use LogicException;
use ReturnTypeWillChange;

abstract class Model implements Arrayable, ArrayAccess, HasBroadcastChannel, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
{
Expand Down Expand Up @@ -1427,7 +1426,7 @@ public function toJson($options = 0)
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Http/Resources/Json/JsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Illuminate\Http\Resources\ConditionallyLoadsAttributes;
use Illuminate\Http\Resources\DelegatesToResource;
use JsonSerializable;
use ReturnTypeWillChange;

class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRoutable
{
Expand Down Expand Up @@ -227,7 +226,7 @@ public function toResponse($request)
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->resolve(Container::getInstance()->make('request'));
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Http/Resources/Json/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function withQuery(array $query)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->collection->count();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Pagination/CursorPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
use ReturnTypeWillChange;

class CursorPaginator extends AbstractCursorPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract
{
Expand Down Expand Up @@ -143,7 +142,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Pagination/LengthAwarePaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
use ReturnTypeWillChange;

class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, LengthAwarePaginatorContract
{
Expand Down Expand Up @@ -214,7 +213,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Pagination/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
use ReturnTypeWillChange;

class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract
{
Expand Down Expand Up @@ -159,7 +158,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
13 changes: 6 additions & 7 deletions src/Illuminate/Session/ArraySessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Illuminate\Session;

use Illuminate\Support\InteractsWithTime;
use ReturnTypeWillChange;
use SessionHandlerInterface;

class ArraySessionHandler implements SessionHandlerInterface
Expand Down Expand Up @@ -38,7 +37,7 @@ public function __construct($minutes)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
{
return true;
Expand All @@ -47,7 +46,7 @@ public function open($savePath, $sessionName)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function close()
{
return true;
Expand All @@ -56,7 +55,7 @@ public function close()
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function read($sessionId)
{
if (! isset($this->storage[$sessionId])) {
Expand All @@ -77,7 +76,7 @@ public function read($sessionId)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function write($sessionId, $data)
{
$this->storage[$sessionId] = [
Expand All @@ -91,7 +90,7 @@ public function write($sessionId, $data)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function destroy($sessionId)
{
if (isset($this->storage[$sessionId])) {
Expand All @@ -104,7 +103,7 @@ public function destroy($sessionId)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function gc($lifetime)
{
$expiration = $this->calculateExpiration($lifetime);
Expand Down
13 changes: 6 additions & 7 deletions src/Illuminate/Session/NullSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

namespace Illuminate\Session;

use ReturnTypeWillChange;
use SessionHandlerInterface;

class NullSessionHandler implements SessionHandlerInterface
{
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
{
return true;
Expand All @@ -19,7 +18,7 @@ public function open($savePath, $sessionName)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function close()
{
return true;
Expand All @@ -28,7 +27,7 @@ public function close()
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function read($sessionId)
{
return '';
Expand All @@ -37,7 +36,7 @@ public function read($sessionId)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function write($sessionId, $data)
{
return true;
Expand All @@ -46,7 +45,7 @@ public function write($sessionId, $data)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function destroy($sessionId)
{
return true;
Expand All @@ -55,7 +54,7 @@ public function destroy($sessionId)
/**
* {@inheritdoc}
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function gc($lifetime)
{
return true;
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Support/Fluent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use JsonSerializable;
use ReturnTypeWillChange;

class Fluent implements Arrayable, ArrayAccess, Jsonable, JsonSerializable
{
Expand Down Expand Up @@ -71,7 +70,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/MessageBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
use Illuminate\Contracts\Support\MessageProvider;
use JsonSerializable;
use ReturnTypeWillChange;

class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider
{
Expand Down Expand Up @@ -370,6 +369,7 @@ public function any()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->messages, COUNT_RECURSIVE) - count($this->messages);
Expand All @@ -390,7 +390,7 @@ public function toArray()
*
* @return array
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Support/Stringable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Support\Traits\Macroable;
use Illuminate\Support\Traits\Tappable;
use JsonSerializable;
use ReturnTypeWillChange;
use Symfony\Component\VarDumper\VarDumper;

class Stringable implements JsonSerializable
Expand Down Expand Up @@ -783,7 +782,7 @@ public function dd()
*
* @return string
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->__toString();
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Testing/AssertableJsonString.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ protected function jsonSearchStrings($key, $value)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->decoded);
Expand Down
3 changes: 1 addition & 2 deletions tests/Database/DatabaseProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Mockery as m;
use PDO;
use PHPUnit\Framework\TestCase;
use ReturnTypeWillChange;

class DatabaseProcessorTest extends TestCase
{
Expand Down Expand Up @@ -39,7 +38,7 @@ public function __construct()
//
}

#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function lastInsertId(string $sequence = null)
{
//
Expand Down

0 comments on commit 76380cf

Please sign in to comment.