Skip to content

Commit ed47d6b

Browse files
committed
test: Prove ArrayToFirstClassCallableRector skips internal callbacks
If a class contains array callbacks with a non-public method, they are not converted into first-class callables. This is due to a fix for a bug that was specific to skipping non-public methods referenced from *outside* the owning class - there was no previous coverage for what should happen when a callable is referenced within a valid scope.
1 parent 2e1e9cc commit ed47d6b

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Rector\Tests\Php81\Rector\Array_\FirstClassCallableRector\Fixture;
4+
5+
final class SomeClass
6+
{
7+
public function run()
8+
{
9+
$name = [$this, 'name'];
10+
}
11+
12+
private function name()
13+
{
14+
}
15+
}
16+
17+
?>
18+
-----
19+
<?php
20+
21+
namespace Rector\Tests\Php81\Rector\Array_\FirstClassCallableRector\Fixture;
22+
23+
final class SomeClass
24+
{
25+
public function run()
26+
{
27+
$name = $this->name(...);
28+
}
29+
30+
private function name()
31+
{
32+
}
33+
}
34+
35+
?>

0 commit comments

Comments
 (0)