Skip to content

Commit

Permalink
Rework test to skip it on PHP 7.*
Browse files Browse the repository at this point in the history
  • Loading branch information
aboks authored and nicolas-grekas committed Mar 20, 2024
1 parent 35061ce commit 239c53c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
48 changes: 20 additions & 28 deletions tests/ProxyManagerTest/Generator/MethodGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,26 @@ public function scalarTypeHintedMethods(): array
];
}

/**
* @dataProvider nullDefaultArgumentAlreadyIncludedInTypeMethods
*/
public function testGenerateMethodWithNullDefaultArgumentAlreadyIncludedInType(string $methodName, string $type): void
{
$method = MethodGenerator::fromReflectionWithoutBodyAndDocBlock(new MethodReflection(
ClassWithNullDefaultMethodArguments::class,
$methodName
));

self::assertSame($methodName, $method->getName());

$parameters = $method->getParameters();

self::assertCount(1, $parameters);

$param = $parameters['param'];

self::assertSame($type, $param->getType());
}

/** @return string[][] */
public function nullDefaultArgumentAlreadyIncludedInTypeMethods(): array
{
return [
['acceptMixed', 'mixed'],
];
}
/**
* @requires PHP 8.0
*/
public function testGenerateMethodWithNullDefaultMixedArgument(): void
{
$method = MethodGenerator::fromReflectionWithoutBodyAndDocBlock(new MethodReflection(
ClassWithNullDefaultMethodArguments::class,
'acceptMixed'
));

self::assertSame('acceptMixed', $method->getName());

$parameters = $method->getParameters();

self::assertCount(1, $parameters);

$param = $parameters['param'];

self::assertSame('mixed', $param->getType());
}

public function testGenerateMethodWithVoidReturnTypeHinting(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

class ClassWithNullDefaultMethodArguments
{
public function acceptMixed(mixed $param = null)
{
return $param;
}
public function acceptMixed(mixed $param = null)
{
return $param;
}
}

0 comments on commit 239c53c

Please sign in to comment.