mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-24 09:19:47 +01:00
allow multiline empty spaces strings (#1828)
allow multiline empty spaces strings
This commit is contained in:
commit
f80d4459e2
@ -149,7 +149,7 @@ CODE_SAMPLE
|
||||
|
||||
private function isJsonString(string $stringValue): bool
|
||||
{
|
||||
if (! (bool) Strings::match($stringValue, '#{(.*?\:.*?)}#')) {
|
||||
if (! (bool) Strings::match($stringValue, '#{(.*?\:.*?)}#s')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\String_\ManualJsonStringToJsonEncodeArrayRector\Fixture;
|
||||
|
||||
final class SimpleRowWithSpaces
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$json = '{"name":"Paulie",
|
||||
"surname":"Garand"}';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\String_\ManualJsonStringToJsonEncodeArrayRector\Fixture;
|
||||
|
||||
final class SimpleRowWithSpaces
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$jsonData = ['name' => 'Paulie', 'surname' => 'Garand'];
|
||||
$json = \Nette\Utils\Json::encode($jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -18,6 +18,7 @@ final class ManualJsonStringToJsonEncodeArrayRectorTest extends AbstractRectorTe
|
||||
__DIR__ . '/Fixture/with_implode.php.inc',
|
||||
__DIR__ . '/Fixture/without_assign.php.inc',
|
||||
__DIR__ . '/Fixture/array_concat.php.inc',
|
||||
__DIR__ . '/Fixture/simple_row_with_spaces.php.inc',
|
||||
]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user