Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
dependencies:
- "locked"
php-version:
- "8.4"
- "8.5"
operating-system:
- "ubuntu-latest"

Expand Down
4 changes: 0 additions & 4 deletions test/unit/Fixture/ClassForSourceStubber.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ public function methodWithOptionalParameters(string $string = 'string', int $int
{
}

public function methodWithSelfAndParentParameters(self $self, parent $parent) : void
{
}

public function methodWithVariadicParameter(string ...$variadic) : void
{
}
Expand Down
3 changes: 0 additions & 3 deletions test/unit/Fixture/ClassForSourceStubberExpected.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ public function methodWithParametersWithNullableTypes(?string $string, ?int $int
public function methodWithOptionalParameters(string $string = 'string', int $int = 123, float $float = 0.0, bool $bool = true, iterable $iterable = [], ?callable $callable = null): void
{
}
public function methodWithSelfAndParentParameters(self $self, parent $parent): void
{
}
public function methodWithVariadicParameter(string ...$variadic): void
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Roave\BetterReflectionTest\Fixture;

class ParentClassWithSelfAndParentParametersForSourceStubber
{
}

abstract class ClassWithSelfAndParentParametersForSourceStubber extends ParentClassWithSelfAndParentParametersForSourceStubber
{
public function methodWithSelfAndParentParameters(self $self, parent $parent) : void
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Roave\BetterReflectionTest\Fixture;

abstract class ClassWithSelfAndParentParametersForSourceStubber extends \Roave\BetterReflectionTest\Fixture\ParentClassWithSelfAndParentParametersForSourceStubber
{
public function methodWithSelfAndParentParameters(self $self, parent $parent): void
{
}
}
14 changes: 0 additions & 14 deletions test/unit/Fixture/PHP85ClassForSourceStubber.php

This file was deleted.

10 changes: 0 additions & 10 deletions test/unit/Fixture/PHP85ClassForSourceStubberExpected.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Roave\BetterReflectionTest\Fixture;

abstract class ClassWithSelfAndParentParametersForSourceStubber extends \Roave\BetterReflectionTest\Fixture\ParentClassWithSelfAndParentParametersForSourceStubber
{
public function methodWithSelfAndParentParameters(\Roave\BetterReflectionTest\Fixture\ClassWithSelfAndParentParametersForSourceStubber $self, \Roave\BetterReflectionTest\Fixture\ParentClassWithSelfAndParentParametersForSourceStubber $parent): void
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
use Roave\BetterReflectionTest\BetterReflectionSingleton;
use Roave\BetterReflectionTest\Fixture\ClassForSourceStubber;
use Roave\BetterReflectionTest\Fixture\ClassForSourceStubberWithDefaultStaticProperty;
use Roave\BetterReflectionTest\Fixture\ClassWithSelfAndParentParametersForSourceStubber;
use Roave\BetterReflectionTest\Fixture\EmptyTrait;
use Roave\BetterReflectionTest\Fixture\EnumBackedForSourceStubber;
use Roave\BetterReflectionTest\Fixture\EnumPureForSourceStubber;
use Roave\BetterReflectionTest\Fixture\InterfaceForSourceStubber;
use Roave\BetterReflectionTest\Fixture\PHP81ClassForSourceStubber;
use Roave\BetterReflectionTest\Fixture\PHP83ClassForSourceStubber;
use Roave\BetterReflectionTest\Fixture\PHP85ClassForSourceStubber;
use Roave\BetterReflectionTest\Fixture\PHP8ClassForSourceStubber;
use Roave\BetterReflectionTest\Fixture\TraitForSourceStubber;
use stdClass;
Expand Down Expand Up @@ -116,7 +116,6 @@ public function testCanStubTraits(): void
self::assertNull($stubData->getExtensionName());
}

#[RequiresPhp('<8.5.0')]
public function testClassStub(): void
{
require_once __DIR__ . '/../../Fixture/ClassForSourceStubber.php';
Expand Down Expand Up @@ -189,15 +188,26 @@ public function testClassStubWithTypedConstants(): void
self::assertStringEqualsFile(__DIR__ . '/../../Fixture/PHP83ClassForSourceStubberExpected.php', $stubData->getStub());
}

#[RequiresPhp('<8.5.0')]
public function testClassStubWithSelfAndParentParameters(): void
{
require_once __DIR__ . '/../../Fixture/ClassWithSelfAndParentParametersForSourceStubber.php';

$stubData = $this->stubber->generateClassStub(ClassWithSelfAndParentParametersForSourceStubber::class);

self::assertNotNull($stubData);
self::assertStringEqualsFile(__DIR__ . '/../../Fixture/ClassWithSelfAndParentParametersForSourceStubberExpected.php', $stubData->getStub());
}

#[RequiresPhp('>=8.5.0')]
public function testClassStubWithPHP85Changes(): void
public function testClassStubWithSelfAndParentParametersWithPHP85Changes(): void
{
require_once __DIR__ . '/../../Fixture/PHP85ClassForSourceStubber.php';
require_once __DIR__ . '/../../Fixture/ClassWithSelfAndParentParametersForSourceStubber.php';

$stubData = $this->stubber->generateClassStub(PHP85ClassForSourceStubber::class);
$stubData = $this->stubber->generateClassStub(ClassWithSelfAndParentParametersForSourceStubber::class);

self::assertNotNull($stubData);
self::assertStringEqualsFile(__DIR__ . '/../../Fixture/PHP85ClassForSourceStubberExpected.php', $stubData->getStub());
self::assertStringEqualsFile(__DIR__ . '/../../Fixture/PHP85ClassWithSelfAndParentParametersForSourceStubberExpected.php', $stubData->getStub());
}

public function testClassWithoutNamespaceStub(): void
Expand Down
Loading