Skip to content

Commit

Permalink
[CodeQuality] Skip private static call from static:: on LocallyCalled…
Browse files Browse the repository at this point in the history
…StaticMethodToNonStaticRector (#5620)

* [CodeQuality] Skip static call from static:: on LocallyCalledStaticMethodToNonStaticRector

* fix

* fix test
  • Loading branch information
samsonasik committed Feb 15, 2024
1 parent 4a3137c commit 70fa502
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector\Fixture;

final class SkipPrivateStaticCallFromStatic
{
public static function clear(string $input)
{
return static::reallyClear($input);
}

private static function reallyClear($input)
{
return $input . ' - clean';
}
}
Expand Up @@ -129,7 +129,7 @@ private function refactorClassMethod(Class_ $class, ClassMethod $classMethod): ?
return null;
}

if (! $this->isName($node->class, 'self')) {
if (! $this->isNames($node->class, ['self', 'static'])) {
return null;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ private function isClassMethodCalledInAnotherStaticClassMethod(Class_ $class, Cl
return null;
}

if (! $this->isName($node->class, 'self')) {
if (! $this->isNames($node->class, ['self', 'static'])) {
return null;
}

Expand Down
Expand Up @@ -38,7 +38,7 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Index(name: 'representation_started_at', columns: ['representation', 'started_at'])]
#[ORM\Index(name: 'channel_started_at_status_representation_sequence', columns: ['channel', 'started_at', 'status', 'representation', 'sequence'])]
#[ORM\UniqueConstraint(name: 'unique_channel_representation_started_at', columns: ['channel', 'representation', 'started_at'])]
#[ORM\Entity(repositoryClass: 'App\Repository\SegmentRepository')]
#[ORM\Entity(repositoryClass: \App\Repository\SegmentRepository::class)]
class Segment
{
}
Expand Down

0 comments on commit 70fa502

Please sign in to comment.