Skip to content

Commit 90f86fc

Browse files
Fix CS/WS issues
1 parent 8414139 commit 90f86fc

18 files changed

+23
-23
lines changed

src/Framework/Constraint/Constraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function matches($other): bool
9999
*
100100
* @psalm-return never-return
101101
*/
102-
protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void
102+
protected function fail($other, $description, ?ComparisonFailure $comparisonFailure = null): void
103103
{
104104
$failureDescription = sprintf(
105105
'Failed asserting that %s.',

src/Framework/Constraint/JsonMatches.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function matches($other): bool
7878
*
7979
* @psalm-return never-return
8080
*/
81-
protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void
81+
protected function fail($other, $description, ?ComparisonFailure $comparisonFailure = null): void
8282
{
8383
if ($comparisonFailure === null) {
8484
[$error, $recodedOther] = Json::canonicalize($other);

src/Framework/Error/Error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class Error extends Exception
1515
{
16-
public function __construct(string $message, int $code, string $file, int $line, \Exception $previous = null)
16+
public function __construct(string $message, int $code, string $file, int $line, ?\Exception $previous = null)
1717
{
1818
parent::__construct($message, $code, $previous);
1919

src/Framework/Exception/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Exception extends RuntimeException implements \PHPUnit\Exception
4444
*/
4545
protected $serializableTrace;
4646

47-
public function __construct($message = '', $code = 0, Throwable $previous = null)
47+
public function __construct($message = '', $code = 0, ?Throwable $previous = null)
4848
{
4949
parent::__construct($message, $code, $previous);
5050

src/Framework/Exception/ExpectationFailedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class ExpectationFailedException extends AssertionFailedError
2828
*/
2929
protected $comparisonFailure;
3030

31-
public function __construct(string $message, ComparisonFailure $comparisonFailure = null, Exception $previous = null)
31+
public function __construct(string $message, ?ComparisonFailure $comparisonFailure = null, ?Exception $previous = null)
3232
{
3333
$this->comparisonFailure = $comparisonFailure;
3434

src/Framework/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function create(int $argument, string $type): self
3939
);
4040
}
4141

42-
private function __construct(string $message = '', int $code = 0, \Exception $previous = null)
42+
private function __construct(string $message = '', int $code = 0, ?\Exception $previous = null)
4343
{
4444
parent::__construct($message, $code, $previous);
4545
}

src/Framework/ExceptionWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function getOriginalException(): ?Throwable
105105
* which can be quite big, from being garbage-collected, thus blocking memory until shutdown.
106106
* Approach works both for var_dump() and var_export() and print_r().
107107
*/
108-
private function originalException(Throwable $exceptionToStore = null): ?Throwable
108+
private function originalException(?Throwable $exceptionToStore = null): ?Throwable
109109
{
110110
static $originalExceptions;
111111

src/Framework/MockObject/Generator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function __clone()
146146
*
147147
* @throws RuntimeException
148148
*/
149-
public function getMock($type, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false, object $proxyTarget = null, bool $allowMockingUnknownTypes = true, bool $returnValueGeneration = true): MockObject
149+
public function getMock($type, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $allowMockingUnknownTypes = true, bool $returnValueGeneration = true): MockObject
150150
{
151151
if (!is_array($type) && !is_string($type)) {
152152
throw InvalidArgumentException::create(1, 'array or string');
@@ -288,7 +288,7 @@ static function ($type)
288288
*
289289
* @throws RuntimeException
290290
*/
291-
public function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
291+
public function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, ?array $mockedMethods = null, bool $cloneArguments = true): MockObject
292292
{
293293
if (class_exists($originalClassName, $callAutoload) ||
294294
interface_exists($originalClassName, $callAutoload)) {
@@ -340,7 +340,7 @@ interface_exists($originalClassName, $callAutoload)) {
340340
*
341341
* @throws RuntimeException
342342
*/
343-
public function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
343+
public function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, ?array $mockedMethods = null, bool $cloneArguments = true): MockObject
344344
{
345345
if (!trait_exists($traitName, $callAutoload)) {
346346
throw new RuntimeException(
@@ -417,7 +417,7 @@ public function getObjectForTrait(string $traitName, string $traitClassName = ''
417417
);
418418
}
419419

420-
public function generate($type, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
420+
public function generate($type, ?array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
421421
{
422422
if (is_array($type)) {
423423
sort($type);
@@ -672,7 +672,7 @@ private function userDefinedInterfaceMethods(string $interfaceName): array
672672
return $methods;
673673
}
674674

675-
private function getObject(MockType $mockClass, $type = '', bool $callOriginalConstructor = false, bool $callAutoload = false, array $arguments = [], bool $callOriginalMethods = false, object $proxyTarget = null, bool $returnValueGeneration = true)
675+
private function getObject(MockType $mockClass, $type = '', bool $callOriginalConstructor = false, bool $callAutoload = false, array $arguments = [], bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $returnValueGeneration = true)
676676
{
677677
$className = $mockClass->generate();
678678

src/Framework/Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ interface Test extends Countable
1919
/**
2020
* Runs a test and collects its result in a TestResult instance.
2121
*/
22-
public function run(TestResult $result = null): TestResult;
22+
public function run(?TestResult $result = null): TestResult;
2323
}

src/Framework/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ public function hasFailed(): bool
705705
* @throws CodeCoverageException
706706
* @throws UtilException
707707
*/
708-
public function run(TestResult $result = null): TestResult
708+
public function run(?TestResult $result = null): TestResult
709709
{
710710
if ($result === null) {
711711
$result = $this->createResult();

src/Framework/TestSuite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public function setGroupDetails(array $groups): void
539539
* @throws CodeCoverageException
540540
* @throws Warning
541541
*/
542-
public function run(TestResult $result = null): TestResult
542+
public function run(?TestResult $result = null): TestResult
543543
{
544544
if ($result === null) {
545545
$result = $this->createResult();

src/Runner/PhptTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ final class PhptTestCase implements SelfDescribing, Test
8383
*
8484
* @throws Exception
8585
*/
86-
public function __construct(string $filename, AbstractPhpProcess $phpUtil = null)
86+
public function __construct(string $filename, ?AbstractPhpProcess $phpUtil = null)
8787
{
8888
if (!is_file($filename)) {
8989
throw new Exception(
@@ -117,7 +117,7 @@ public function count(): int
117117
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
118118
* @throws Exception
119119
*/
120-
public function run(TestResult $result = null): TestResult
120+
public function run(?TestResult $result = null): TestResult
121121
{
122122
if ($result === null) {
123123
$result = new TestResult;

src/TextUI/TestRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ final class TestRunner extends BaseTestRunner
118118
*/
119119
private $extensions = [];
120120

121-
public function __construct(TestSuiteLoader $loader = null, CodeCoverageFilter $filter = null)
121+
public function __construct(?TestSuiteLoader $loader = null, ?CodeCoverageFilter $filter = null)
122122
{
123123
if ($filter === null) {
124124
$filter = new CodeCoverageFilter;

src/Util/Getopt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class Getopt
3535
/**
3636
* @throws Exception
3737
*/
38-
public static function parse(array $args, string $short_options, array $long_options = null): array
38+
public static function parse(array $args, string $short_options, ?array $long_options = null): array
3939
{
4040
if (empty($args)) {
4141
return [[], []];

src/Util/PHP/AbstractPhpProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function runTestJob(string $job, Test $test, TestResult $result, string $
201201
/**
202202
* Returns the command based into the configurations.
203203
*/
204-
public function getCommand(array $settings, string $file = null): string
204+
public function getCommand(array $settings, ?string $file = null): string
205205
{
206206
$command = $this->runtime->getBinary();
207207

src/Util/PHP/WindowsPhpProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
final class WindowsPhpProcess extends DefaultPhpProcess
2222
{
23-
public function getCommand(array $settings, string $file = null): string
23+
public function getCommand(array $settings, ?string $file = null): string
2424
{
2525
if (PHP_MAJOR_VERSION < 8) {
2626
return '"' . parent::getCommand($settings, $file) . '"';

tests/_files/DoubleTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function count(): int
2727
return 2;
2828
}
2929

30-
public function run(TestResult $result = null): TestResult
30+
public function run(?TestResult $result = null): TestResult
3131
{
3232
$result->startTest($this);
3333

tests/_files/NotSelfDescribingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function count(): int
2424
return 0;
2525
}
2626

27-
public function run(TestResult $result = null): TestResult
27+
public function run(?TestResult $result = null): TestResult
2828
{
2929
return new TestResult;
3030
}

0 commit comments

Comments
 (0)