Skip to content

Commit

Permalink
PHPCS: nullable types PHP 8.4
Browse files Browse the repository at this point in the history
php-cs-fixer fix . --rules nullable_type_declaration_for_default_null_value
  • Loading branch information
andypost committed Aug 21, 2024
1 parent d1235b2 commit dcc5a93
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
composer-flags: [ "" ]
include:
- php: 7.2
Expand Down
2 changes: 1 addition & 1 deletion fixtures/WithArguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class WithArguments
{
public function methodWithArgs(\ArrayAccess $arg_1, array $arg_2 = [], \ArrayAccess $arg_3 = null)
public function methodWithArgs(\ArrayAccess $arg_1, array $arg_2 = [], ?\ArrayAccess $arg_3 = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion fixtures/WithCallableArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class WithCallableArgument
{
public function methodWithArgs(callable $arg_1, callable $arg_2 = null)
public function methodWithArgs(callable $arg_1, ?callable $arg_2 = null)
{
}
}
2 changes: 1 addition & 1 deletion src/Prophecy/Argument/Token/ExactValueToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ExactValueToken implements TokenInterface
*
* @param mixed $value
*/
public function __construct($value, StringUtil $util = null, ComparatorFactory $comparatorFactory = null)
public function __construct($value, ?StringUtil $util = null, ?ComparatorFactory $comparatorFactory = null)
{
$this->value = $value;
$this->util = $util ?: new StringUtil();
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Argument/Token/IdenticalValueToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IdenticalValueToken implements TokenInterface
*
* @param mixed $value
*/
public function __construct($value, StringUtil $util = null)
public function __construct($value, ?StringUtil $util = null)
{
$this->value = $value;
$this->util = $util ?: new StringUtil();
Expand Down
4 changes: 2 additions & 2 deletions src/Prophecy/Argument/Token/ObjectStateToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ObjectStateToken implements TokenInterface
public function __construct(
$methodName,
$value,
StringUtil $util = null,
ComparatorFactory $comparatorFactory = null
?StringUtil $util = null,
?ComparatorFactory $comparatorFactory = null
) {
$this->name = $methodName;
$this->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Call/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Call
* @param null|int $line
*/
public function __construct($methodName, array $arguments, $returnValue,
Exception $exception = null, $file, $line)
?Exception $exception = null, $file, $line)

Check failure on line 52 in src/Prophecy/Call/Call.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.0: Required parameter $line follows optional parameter $exception.

Check failure on line 52 in src/Prophecy/Call/Call.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $file follows optional parameter $exception.
{
$this->methodName = $methodName;
$this->arguments = $arguments;
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Call/CallCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CallCenter
*
* @param StringUtil $util
*/
public function __construct(StringUtil $util = null)
public function __construct(?StringUtil $util = null)
{
$this->util = $util ?: new StringUtil;
$this->unexpectedCalls = new SplObjectStorage();
Expand Down
4 changes: 2 additions & 2 deletions src/Prophecy/Doubler/CachedDoubler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CachedDoubler extends Doubler
*/
private static $classes = array();

protected function createDoubleClass(ReflectionClass $class = null, array $interfaces)
protected function createDoubleClass(?ReflectionClass $class = null, array $interfaces)

Check failure on line 29 in src/Prophecy/Doubler/CachedDoubler.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $interfaces follows optional parameter $class.
{
$classId = $this->generateClassId($class, $interfaces);
if (isset(self::$classes[$classId])) {
Expand All @@ -42,7 +42,7 @@ protected function createDoubleClass(ReflectionClass $class = null, array $inter
*
* @return string
*/
private function generateClassId(ReflectionClass $class = null, array $interfaces)
private function generateClassId(?ReflectionClass $class = null, array $interfaces)

Check failure on line 45 in src/Prophecy/Doubler/CachedDoubler.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $interfaces follows optional parameter $class.
{
$parts = array();
if (null !== $class) {
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MagicCallPatch implements ClassPatchInterface

private $tagRetriever;

public function __construct(MethodTagRetrieverInterface $tagRetriever = null)
public function __construct(?MethodTagRetrieverInterface $tagRetriever = null)
{
$this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Prophecy/Doubler/Doubler.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class Doubler
*/
private $instantiator;

public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null,
NameGenerator $namer = null)
public function __construct(?ClassMirror $mirror = null, ?ClassCreator $creator = null,
?NameGenerator $namer = null)
{
$this->mirror = $mirror ?: new ClassMirror;
$this->creator = $creator ?: new ClassCreator;
Expand Down Expand Up @@ -87,7 +87,7 @@ public function registerClassPatch(ClassPatchInterface $patch)
*
* @throws \Prophecy\Exception\InvalidArgumentException
*/
public function double(ReflectionClass $class = null, array $interfaces, array $args = null)
public function double(?ReflectionClass $class = null, array $interfaces, ?array $args = null)

Check failure on line 90 in src/Prophecy/Doubler/Doubler.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $interfaces follows optional parameter $class.
{
foreach ($interfaces as $interface) {
if (!$interface instanceof ReflectionClass) {
Expand Down Expand Up @@ -127,7 +127,7 @@ public function double(ReflectionClass $class = null, array $interfaces, array $
*
* @return class-string<T&DoubleInterface>
*/
protected function createDoubleClass(ReflectionClass $class = null, array $interfaces)
protected function createDoubleClass(?ReflectionClass $class = null, array $interfaces)

Check failure on line 130 in src/Prophecy/Doubler/Doubler.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $interfaces follows optional parameter $class.
{
$name = $this->namer->name($class, $interfaces);
$node = $this->mirror->reflect($class, $interfaces);
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/Generator/ClassCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ClassCreator
{
private $generator;

public function __construct(ClassCodeGenerator $generator = null)
public function __construct(?ClassCodeGenerator $generator = null)
{
$this->generator = $generator ?: new ClassCodeGenerator;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/LazyDouble.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function addInterface($interface)
*
* @return void
*/
public function setArguments(array $arguments = null)
public function setArguments(?array $arguments = null)
{
$this->arguments = $arguments;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/NameGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NameGenerator
*
* @return string
*/
public function name(ReflectionClass $class = null, array $interfaces)
public function name(?ReflectionClass $class = null, array $interfaces)

Check failure on line 37 in src/Prophecy/Doubler/NameGenerator.php

View workflow job for this annotation

GitHub Actions / Static analysis

Deprecated in PHP 8.1: Required parameter $interfaces follows optional parameter $class.
{
$parts = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface
*/
private $classRetriever;

public function __construct(MethodTagRetrieverInterface $classRetriever = null)
public function __construct(?MethodTagRetrieverInterface $classRetriever = null)
{
if (null !== $classRetriever) {
$this->classRetriever = $classRetriever;
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Prediction/CallPrediction.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CallPrediction implements PredictionInterface
{
private $util;

public function __construct(StringUtil $util = null)
public function __construct(?StringUtil $util = null)
{
$this->util = $util ?: new StringUtil;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Prediction/CallTimesPrediction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CallTimesPrediction implements PredictionInterface
/**
* @param int $times
*/
public function __construct($times, StringUtil $util = null)
public function __construct($times, ?StringUtil $util = null)
{
$this->times = intval($times);
$this->util = $util ?: new StringUtil;
Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Prediction/NoCallsPrediction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NoCallsPrediction implements PredictionInterface
{
private $util;

public function __construct(StringUtil $util = null)
public function __construct(?StringUtil $util = null)
{
$this->util = $util ?: new StringUtil;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Prophecy/Prophecy/ObjectProphecy.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class ObjectProphecy implements ProphecyInterface
*/
public function __construct(
LazyDouble $lazyDouble,
CallCenter $callCenter = null,
RevealerInterface $revealer = null,
ComparatorFactory $comparatorFactory = null
?CallCenter $callCenter = null,
?RevealerInterface $revealer = null,
?ComparatorFactory $comparatorFactory = null
) {
$this->lazyDouble = $lazyDouble;
$this->callCenter = $callCenter ?: new CallCenter;
Expand Down Expand Up @@ -103,7 +103,7 @@ public function willImplement($interface)
*
* @return $this
*/
public function willBeConstructedWith(array $arguments = null)
public function willBeConstructedWith(?array $arguments = null)
{
$this->lazyDouble->setArguments($arguments);

Expand Down
6 changes: 3 additions & 3 deletions src/Prophecy/Prophet.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class Prophet
private $prophecies = array();

public function __construct(
Doubler $doubler = null,
RevealerInterface $revealer = null,
StringUtil $util = null
?Doubler $doubler = null,
?RevealerInterface $revealer = null,
?StringUtil $util = null
) {
if (null === $doubler) {
$doubler = new CachedDoubler();
Expand Down

0 comments on commit dcc5a93

Please sign in to comment.