Skip to content
Merged

Fixes #2262

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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test(string $file): void

public function provideDataForTest(): Iterator
{
yield from $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

protected function getRectorClass(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private function createAnonymousFunctionFromString(Expr $expr): ?Closure
return $node;
}

$match = Strings::match($node->value, '#(\\$|\\\\)(?<number>\d+)#');
$match = Strings::match($node->value, '#(\\$|\\\\|\\x0)(?<number>\d+)#');
if (! $match) {
return $node;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Rector\Php55\Tests\Rector\FuncCall\PregReplaceEModifierRector\Fixture;

class Slashes
{
public static function camelize($word)
{
return preg_replace('#a#e', "strtoupper('\\0___');", $word);
}
}

?>
-----
<?php

namespace Rector\Php55\Tests\Rector\FuncCall\PregReplaceEModifierRector\Fixture;

class Slashes
{
public static function camelize($word)
{
return preg_replace_callback('#a#', function ($matches) {
return strtoupper($matches[0]);
}, $word);
}
}

?>
2 changes: 1 addition & 1 deletion src/Testing/StaticFixtureProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class StaticFixtureProvider
{
public static function yieldFilesFromDirectory(string $directory, string $suffix = '*.php'): Iterator
public static function yieldFilesFromDirectory(string $directory, string $suffix): Iterator
{
$fileInfos = self::findFilesInDirectory($directory, $suffix);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class _Name_Test extends AbstractRectorTestCase

public function provideDataForTest(): \Iterator
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

protected function getRectorClass(): string
Expand Down