Fix CS/WS issues

This commit is contained in:
Sebastian Bergmann 2023-09-08 06:35:09 +02:00
parent 12174efdcd
commit ffa288398e
No known key found for this signature in database
GPG Key ID: 4AA394086372C20A
2 changed files with 29 additions and 29 deletions

View File

@ -86,7 +86,7 @@ final class Exporter
} else {
$result[] = sprintf(
'array(%s)',
$this->shortenedRecursiveExport($data[$key], $context)
$this->shortenedRecursiveExport($data[$key], $context),
);
}
} else {
@ -123,7 +123,7 @@ final class Exporter
'%s Enum (%s, %s)',
$value::class,
$value->name,
$this->export($value->value)
$this->export($value->value),
);
}
@ -131,7 +131,7 @@ final class Exporter
return sprintf(
'%s Enum (%s)',
$value::class,
$value->name
$value->name,
);
}
@ -139,14 +139,14 @@ final class Exporter
return sprintf(
'%s Object (%s)',
$value::class,
count($this->toArray($value)) > 0 ? '...' : ''
count($this->toArray($value)) > 0 ? '...' : '',
);
}
if (is_array($value)) {
return sprintf(
'Array (%s)',
count($value) > 0 ? '...' : ''
count($value) > 0 ? '...' : '',
);
}
@ -247,7 +247,7 @@ final class Exporter
return sprintf(
'resource(%d) of type (%s)',
$value,
get_resource_type($value)
get_resource_type($value),
);
}
@ -257,7 +257,7 @@ final class Exporter
$value::class,
spl_object_id($value),
$value->name,
$this->export($value->value, $indentation)
$this->export($value->value, $indentation),
);
}
@ -266,7 +266,7 @@ final class Exporter
'%s Enum #%d (%s)',
$value::class,
spl_object_id($value),
$value->name
$value->name,
);
}
@ -283,8 +283,8 @@ final class Exporter
str_replace(
["\r\n", "\n\r", "\r", "\n"],
['\r\n<lf>', '\n\r<lf>', '\r<lf>', '\n<lf>'],
$value
)
$value,
),
) .
"'";
}
@ -310,7 +310,7 @@ final class Exporter
'%s %s => %s' . "\n",
$whitespace,
$this->recursiveExport($k, $indentation),
$this->recursiveExport($value[$k], $indentation + 1, $processed)
$this->recursiveExport($value[$k], $indentation + 1, $processed),
);
}
@ -337,7 +337,7 @@ final class Exporter
'%s %s => %s' . "\n",
$whitespace,
$this->recursiveExport($k, $indentation),
$this->recursiveExport($v, $indentation + 1, $processed)
$this->recursiveExport($v, $indentation + 1, $processed),
);
}

View File

@ -41,9 +41,9 @@ final class ExporterTest extends TestCase
$obj3 = (object) [1, 2, "Test\r\n", 4, 5, 6, 7, 8];
$obj = new stdClass;
//@codingStandardsIgnoreStart
// @codingStandardsIgnoreStart
$obj->null = null;
//@codingStandardsIgnoreEnd
// @codingStandardsIgnoreEnd
$obj->boolean = true;
$obj->integer = 1;
$obj->double = 1.2;
@ -175,7 +175,7 @@ EOF
'Binary String: 0x000102030405',
],
[
implode('', array_map('chr', range(0x0e, 0x1f))),
implode('', array_map('chr', range(0x0E, 0x1F))),
'Binary String: 0x0e0f101112131415161718191a1b1c1d1e1f',
],
[
@ -245,9 +245,9 @@ EOF
public static function provideNonBinaryMultibyteStrings(): array
{
return [
[implode('', array_map('chr', range(0x09, 0x0d))), 9],
[implode('', array_map('chr', range(0x20, 0x7f))), 96],
[implode('', array_map('chr', range(0x80, 0xff))), 128],
[implode('', array_map('chr', range(0x09, 0x0D))), 9],
[implode('', array_map('chr', range(0x20, 0x7F))), 96],
[implode('', array_map('chr', range(0x80, 0xFF))), 128],
];
}
@ -273,7 +273,7 @@ EOF
{
$this->assertStringMatchesFormat(
$expected,
$this->trimNewline((new Exporter)->export($value))
$this->trimNewline((new Exporter)->export($value)),
);
}
@ -353,7 +353,7 @@ EOF;
$this->assertStringMatchesFormat(
$expected,
$this->trimNewline((new Exporter)->export($array))
$this->trimNewline((new Exporter)->export($array)),
);
}
@ -362,7 +362,7 @@ EOF;
{
$this->assertSame(
$expected,
$this->trimNewline((new Exporter)->shortenedExport($value))
$this->trimNewline((new Exporter)->shortenedExport($value)),
);
}
@ -377,7 +377,7 @@ EOF;
try {
$this->assertSame(
"'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくや...しゑひもせす'",
$this->trimNewline((new Exporter)->shortenedExport('いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす'))
$this->trimNewline((new Exporter)->shortenedExport('いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす')),
);
} catch (Exception $e) {
mb_internal_encoding($oldMbInternalEncoding);
@ -395,7 +395,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleEnum Enum #%d (Value)',
$this->trimNewline((new Exporter)->export(ExampleEnum::Value))
$this->trimNewline((new Exporter)->export(ExampleEnum::Value)),
);
}
@ -404,7 +404,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleStringBackedEnum Enum #%d (Value, \'value\')',
$this->trimNewline((new Exporter)->export(ExampleStringBackedEnum::Value))
$this->trimNewline((new Exporter)->export(ExampleStringBackedEnum::Value)),
);
}
@ -413,7 +413,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleIntegerBackedEnum Enum #%d (Value, 0)',
$this->trimNewline((new Exporter)->export(ExampleIntegerBackedEnum::Value))
$this->trimNewline((new Exporter)->export(ExampleIntegerBackedEnum::Value)),
);
}
@ -422,7 +422,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleEnum Enum (Value)',
$this->trimNewline((new Exporter)->shortenedExport(ExampleEnum::Value))
$this->trimNewline((new Exporter)->shortenedExport(ExampleEnum::Value)),
);
}
@ -431,7 +431,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleStringBackedEnum Enum (Value, \'value\')',
$this->trimNewline((new Exporter)->shortenedExport(ExampleStringBackedEnum::Value))
$this->trimNewline((new Exporter)->shortenedExport(ExampleStringBackedEnum::Value)),
);
}
@ -440,7 +440,7 @@ EOF;
// FIXME: Merge test into testExport once we drop support for PHP 8.0
$this->assertStringMatchesFormat(
'SebastianBergmann\Exporter\ExampleIntegerBackedEnum Enum (Value, 0)',
$this->trimNewline((new Exporter)->shortenedExport(ExampleIntegerBackedEnum::Value))
$this->trimNewline((new Exporter)->shortenedExport(ExampleIntegerBackedEnum::Value)),
);
}
@ -449,7 +449,7 @@ EOF;
{
$this->assertMatchesRegularExpression(
"~'.{{$expectedLength}}'\$~s",
(new Exporter)->export($value)
(new Exporter)->export($value),
);
}