Skip to content

Commit dd98a2a

Browse files
Merge branch '8.5' into 9.6
2 parents 92ff055 + 90f86fc commit dd98a2a

20 files changed

+26
-25
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
'no_whitespace_in_blank_line' => true,
195195
'non_printable_character' => true,
196196
'normalize_index_brace' => true,
197+
'nullable_type_declaration_for_default_null_value' => true,
197198
'object_operator_without_whitespace' => true,
198199
'operator_linebreak' => [
199200
'only_booleans' => true,

src/Framework/Constraint/Constraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function matches($other): bool
101101
*
102102
* @psalm-return never-return
103103
*/
104-
protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void
104+
protected function fail($other, $description, ?ComparisonFailure $comparisonFailure = null): void
105105
{
106106
$failureDescription = sprintf(
107107
'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
@@ -16,7 +16,7 @@
1616
*/
1717
class Error extends Exception
1818
{
19-
public function __construct(string $message, int $code, string $file, int $line, \Exception $previous = null)
19+
public function __construct(string $message, int $code, string $file, int $line, ?\Exception $previous = null)
2020
{
2121
parent::__construct($message, $code, $previous);
2222

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
@@ -114,7 +114,7 @@ public function getOriginalException(): ?Throwable
114114
*
115115
* Approach works both for var_dump() and var_export() and print_r().
116116
*/
117-
private function originalException(Throwable $exceptionToStore = null): ?Throwable
117+
private function originalException(?Throwable $exceptionToStore = null): ?Throwable
118118
{
119119
// drop once PHP 7.3 support is removed
120120
if (PHP_VERSION_ID < 70400) {

src/Framework/MockObject/Generator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function __clone()
152152
* @throws RuntimeException
153153
* @throws UnknownTypeException
154154
*/
155-
public function getMock(string $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
155+
public function getMock(string $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
156156
{
157157
if (!is_array($methods) && null !== $methods) {
158158
throw InvalidArgumentException::create(2, 'array');
@@ -307,7 +307,7 @@ public function getMockForInterfaces(array $interfaces, bool $callAutoload = tru
307307
* @throws UnknownClassException
308308
* @throws UnknownTypeException
309309
*/
310-
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
310+
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
311311
{
312312
if (class_exists($originalClassName, $callAutoload) ||
313313
interface_exists($originalClassName, $callAutoload)) {
@@ -370,7 +370,7 @@ interface_exists($originalClassName, $callAutoload)) {
370370
* @throws UnknownTraitException
371371
* @throws UnknownTypeException
372372
*/
373-
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
373+
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
374374
{
375375
if (!trait_exists($traitName, $callAutoload)) {
376376
throw new UnknownTraitException($traitName);
@@ -447,7 +447,7 @@ public function getObjectForTrait(string $traitName, string $traitClassName = ''
447447
* @throws ReflectionException
448448
* @throws RuntimeException
449449
*/
450-
public function generate(string $type, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
450+
public function generate(string $type, ?array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
451451
{
452452
if ($mockClassName !== '') {
453453
return $this->generateMock(
@@ -703,7 +703,7 @@ private function userDefinedInterfaceMethods(string $interfaceName): array
703703
* @throws ReflectionException
704704
* @throws RuntimeException
705705
*/
706-
private function getObject(MockType $mockClass, $type = '', bool $callOriginalConstructor = false, bool $callAutoload = false, array $arguments = [], bool $callOriginalMethods = false, object $proxyTarget = null, bool $returnValueGeneration = true)
706+
private function getObject(MockType $mockClass, $type = '', bool $callOriginalConstructor = false, bool $callAutoload = false, array $arguments = [], bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $returnValueGeneration = true)
707707
{
708708
$className = $mockClass->generate();
709709

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
}

0 commit comments

Comments
 (0)