Skip to content

Commit

Permalink
Merge branch '10.5' into 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 1, 2024
2 parents 3f42612 + eb22ea1 commit 1dbfcd8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'nullable_type_declaration_for_default_null_value' => true,
'object_operator_without_whitespace' => true,
'octal_notation' => true,
'operator_linebreak' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Constraint/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function matches(mixed $other): bool
*
* @throws ExpectationFailedException
*/
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): never
protected function fail(mixed $other, string $description, ?ComparisonFailure $comparisonFailure = null): never
{
$failureDescription = sprintf(
'Failed asserting that %s.',
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Constraint/JsonMatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function matches(mixed $other): bool
* @throws ExpectationFailedException
* @throws InvalidJsonException
*/
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): never
protected function fail(mixed $other, string $description, ?ComparisonFailure $comparisonFailure = null): never
{
if ($comparisonFailure === null) {
[$error, $recodedOther] = Json::canonicalize($other);
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Exception extends RuntimeException implements \PHPUnit\Exception
{
protected array $serializableTrace;

public function __construct(string $message = '', int $code = 0, Throwable $previous = null)
public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);

Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Exception/ExpectationFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ExpectationFailedException extends AssertionFailedError
{
protected ?ComparisonFailure $comparisonFailure = null;

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

Expand Down
10 changes: 5 additions & 5 deletions src/Framework/MockObject/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class Generator
* @throws RuntimeException
* @throws UnknownTypeException
*/
public function testDouble(string $type, bool $mockObject, bool $markAsMockObject, ?array $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|Stub
public function testDouble(string $type, bool $mockObject, bool $markAsMockObject, ?array $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|Stub
{
if ($type === Traversable::class) {
$type = Iterator::class;
Expand Down Expand Up @@ -240,7 +240,7 @@ public function testDoubleForInterfaceIntersection(array $interfaces, bool $mock
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5241
*/
public function mockObjectForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
public function mockObjectForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, ?array $mockedMethods = null, bool $cloneArguments = true): MockObject
{
if (class_exists($originalClassName, $callAutoload) ||
interface_exists($originalClassName, $callAutoload)) {
Expand Down Expand Up @@ -302,7 +302,7 @@ interface_exists($originalClassName, $callAutoload)) {
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5243
*/
public function mockObjectForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
public function mockObjectForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, ?array $mockedMethods = null, bool $cloneArguments = true): MockObject
{
if (!trait_exists($traitName, $callAutoload)) {
throw new UnknownTraitException($traitName);
Expand Down Expand Up @@ -385,7 +385,7 @@ public function objectForTrait(string $traitName, string $traitClassName = '', b
*
* @see https://github.com/sebastianbergmann/phpunit/issues/5476
*/
public function generate(string $type, bool $mockObject, bool $markAsMockObject, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
public function generate(string $type, bool $mockObject, bool $markAsMockObject, ?array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
{
if ($mockClassName !== '') {
return $this->generateCodeForTestDoubleClass(
Expand Down Expand Up @@ -571,7 +571,7 @@ private function userDefinedInterfaceMethods(string $interfaceName): array
* @throws ReflectionException
* @throws RuntimeException
*/
private function getObject(MockType $mockClass, string $type = '', bool $callOriginalConstructor = false, array $arguments = [], bool $callOriginalMethods = false, object $proxyTarget = null, bool $returnValueGeneration = true): object
private function getObject(MockType $mockClass, string $type = '', bool $callOriginalConstructor = false, array $arguments = [], bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $returnValueGeneration = true): object
{
$className = $mockClass->generate();
$object = $this->instantiate($className, $callOriginalConstructor, $arguments);
Expand Down
2 changes: 1 addition & 1 deletion src/Runner/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
*
* @throws Exception
*/
public function __construct(string $filename, AbstractPhpProcess $phpUtil = null)
public function __construct(string $filename, ?AbstractPhpProcess $phpUtil = null)
{
if (!is_file($filename)) {
throw new FileDoesNotExistException($filename);
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PHP/AbstractPhpProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function runTestJob(string $job, Test $test, string $processResultFile):
/**
* Returns the command based into the configurations.
*/
public function getCommand(array $settings, string $file = null): string
public function getCommand(array $settings, ?string $file = null): string
{
$runtime = new Runtime;

Expand Down

0 comments on commit 1dbfcd8

Please sign in to comment.