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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace Rector\Tests\CodeQuality\Rector\Class_\StaticToSelfStaticMethodCallOnFinalClassRector;
namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

final class StaticToSelfStaticMethodCallOnFinalClassRectorTest extends AbstractRectorTestCase
final class ConvertStaticToSelfRectorTest extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

final class FinalClassBasic
{
public const SUCCESS = 'success';

public static string $property = 'value';

public static function run(): void
{
}

public function execute()
{
static::run();
static::$property;
static::SUCCESS;
}
}

?>
-----
<?php

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

final class FinalClassBasic
{
public const SUCCESS = 'success';

public static string $property = 'value';

public static function run(): void
{
}

public function execute()
{
self::run();
self::$property;
self::SUCCESS;
}
}

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

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

use Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Source\BaseClass;

final class FinalClassInheritedMembers extends BaseClass
{
public function run(): void
{
static::SUCCESS;
static::$parentProperty;
static::parentMethod();
}
}

?>
-----
<?php

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

use Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Source\BaseClass;

final class FinalClassInheritedMembers extends BaseClass
{
public function run(): void
{
self::SUCCESS;
self::$parentProperty;
self::parentMethod();
}
}

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

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

class NonFinalClassFinalMembers
{
final public const BAR = 1;

final public static string $privateProperty = 'test';

final public static function privateMethod(): void
{
}

public function run()
{
static::$privateProperty;
static::privateMethod();
static::BAR;
}
}

?>
-----
<?php

namespace Rector\Tests\CodeQuality\Rector\Class_\ConvertStaticToSelfRector\Fixture;

class NonFinalClassFinalMembers
{
final public const BAR = 1;

final public static string $privateProperty = 'test';

final public static function privateMethod(): void
{
}

public function run()
{
self::$privateProperty;
self::privateMethod();
self::BAR;
}
}

?>
Loading
Loading