Skip to content

Commit

Permalink
Unfuck class constant visibilities as well ...
Browse files Browse the repository at this point in the history
  • Loading branch information
chr-hertel committed Feb 26, 2022
1 parent fd5204c commit 21e9a46
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 44 deletions.
86 changes: 43 additions & 43 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Unfucker/VisibilityUnfucker.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
use PhpParser\NodeVisitorAbstract;
Expand All @@ -14,7 +15,7 @@ class VisibilityUnfucker extends NodeVisitorAbstract
{
public function leaveNode(Node $node): void
{
if (!$node instanceof ClassMethod && !$node instanceof Property) {
if (!$node instanceof ClassMethod && !$node instanceof Property && !$node instanceof ClassConst) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/samples/class-visibility-input.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class Example
{
private const TEST = 123;
protected const ONETWOTHREE = 'test';
private $foo;
protected $bar;
private function foo()
Expand Down
2 changes: 2 additions & 0 deletions tests/samples/class-visibility-unfucked.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class Example
{
public const TEST = 123;
public const ONETWOTHREE = 'test';
public $foo;
public $bar;
public function foo()
Expand Down

0 comments on commit 21e9a46

Please sign in to comment.