From e0da9862792cc176160781871cfdcc2547984fa9 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Mon, 30 Oct 2023 03:15:35 +0800 Subject: [PATCH] style: $ composer fix Signed-off-by: Jack Cherng --- src/DiffHelper.php | 10 ++++------ src/Differ.php | 10 +++++----- src/Factory/LineRendererFactory.php | 4 +--- src/Factory/RendererFactory.php | 4 +--- src/Renderer/AbstractRenderer.php | 9 +-------- src/Renderer/Html/AbstractHtml.php | 9 --------- src/Renderer/Html/Combined.php | 3 --- src/Renderer/Html/Inline.php | 3 --- src/Renderer/Html/Json.php | 4 +--- src/Renderer/Html/JsonHtml.php | 9 --------- src/Renderer/Html/LineRenderer/Char.php | 2 -- src/Renderer/Html/LineRenderer/Line.php | 2 -- src/Renderer/Html/LineRenderer/None.php | 2 -- src/Renderer/Html/LineRenderer/Word.php | 2 -- src/Renderer/Html/SideBySide.php | 3 --- src/Renderer/Text/AbstractText.php | 10 +--------- src/Renderer/Text/Context.php | 3 --- src/Renderer/Text/JsonText.php | 3 --- src/Renderer/Text/Unified.php | 3 --- src/Utility/Arr.php | 2 +- src/Utility/ReverseIterator.php | 4 +--- tests/DiffHelperTest.php | 10 +++++----- tests/DifferTest.php | 6 +++--- tests/IgnoreLineEndingTest.php | 6 +++--- tests/IgnoreWhitespaceTest.php | 6 +++--- tests/Renderer/Html/CombinedTest.php | 8 ++++---- tests/Renderer/Html/LineRenderer/WordTest.php | 8 ++++---- tests/Renderer/RendererTest.php | 8 ++++---- tests/Utility/LanguageTest.php | 14 +++++++------- 29 files changed, 49 insertions(+), 118 deletions(-) diff --git a/src/DiffHelper.php b/src/DiffHelper.php index 5d3d85b6..92043343 100644 --- a/src/DiffHelper.php +++ b/src/DiffHelper.php @@ -12,9 +12,7 @@ final class DiffHelper /** * The constructor. */ - private function __construct() - { - } + private function __construct() {} /** * Get the absolute path of the project root directory. @@ -38,7 +36,7 @@ public static function getRenderersInfo(): array } $glob = implode(\DIRECTORY_SEPARATOR, [ - static::getProjectDirectory(), + self::getProjectDirectory(), 'src', 'Renderer', '{' . implode(',', RendererConstant::RENDERER_TYPES) . '}', @@ -94,7 +92,7 @@ public static function getStyleSheet(): string return $fileContent; } - $filePath = static::getProjectDirectory() . '/example/diff-table.css'; + $filePath = self::getProjectDirectory() . '/example/diff-table.css'; $file = new \SplFileObject($filePath, 'r'); @@ -170,7 +168,7 @@ public static function calculateFiles( $oldFile = new \SplFileObject($old, 'r'); $newFile = new \SplFileObject($new, 'r'); - return static::calculate( + return self::calculate( // fread() requires the length > 0 hence we plus 1 for empty files $oldFile->fread($oldFile->getSize() + 1), $newFile->fread($newFile->getSize() + 1), diff --git a/src/Differ.php b/src/Differ.php index 0d63c8b4..f242892c 100644 --- a/src/Differ.php +++ b/src/Differ.php @@ -177,7 +177,7 @@ public function setNew(array $new): self */ public function setOptions(array $options): self { - $mergedOptions = $options + static::$defaultOptions; + $mergedOptions = $options + self::$defaultOptions; if ($this->options !== $mergedOptions) { $this->options = $mergedOptions; @@ -196,7 +196,7 @@ public function setOptions(array $options): self * * @return string[] array of all of the lines between the specified range */ - public function getOld(int $start = 0, ?int $end = null): array + public function getOld(int $start = 0, int $end = null): array { return Arr::getPartialByIndex($this->old, $start, $end); } @@ -210,7 +210,7 @@ public function getOld(int $start = 0, ?int $end = null): array * * @return string[] array of all of the lines between the specified range */ - public function getNew(int $start = 0, ?int $end = null): array + public function getNew(int $start = 0, int $end = null): array { return Arr::getPartialByIndex($this->new, $start, $end); } @@ -260,7 +260,7 @@ public static function getInstance(): self { static $singleton; - return $singleton ??= new static([], []); + return $singleton ??= new self([], []); } /** @@ -491,7 +491,7 @@ private function finalize(): self */ private function resetCachedResults(): self { - foreach (static::CACHED_PROPERTIES as $property => $value) { + foreach (self::CACHED_PROPERTIES as $property => $value) { $this->{$property} = $value; } diff --git a/src/Factory/LineRendererFactory.php b/src/Factory/LineRendererFactory.php index c4a7b607..27d5374c 100644 --- a/src/Factory/LineRendererFactory.php +++ b/src/Factory/LineRendererFactory.php @@ -19,9 +19,7 @@ final class LineRendererFactory /** * The constructor. */ - private function __construct() - { - } + private function __construct() {} /** * Get the singleton of a line renderer. diff --git a/src/Factory/RendererFactory.php b/src/Factory/RendererFactory.php index 021ae28b..357a0273 100644 --- a/src/Factory/RendererFactory.php +++ b/src/Factory/RendererFactory.php @@ -19,9 +19,7 @@ final class RendererFactory /** * The constructor. */ - private function __construct() - { - } + private function __construct() {} /** * Get the singleton of a renderer. diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index c8973718..47a5c523 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -154,8 +154,6 @@ public function getOptions(): array } /** - * {@inheritdoc} - * * @final * * @todo mark this method with "final" in the next major release @@ -178,21 +176,16 @@ public function getResultForIdenticals(): string */ abstract public function getResultForIdenticalsDefault(): string; - /** - * {@inheritdoc} - */ final public function render(Differ $differ): string { $this->changesAreRaw = true; + // the "no difference" situation may happen frequently return $differ->getOldNewComparison() === 0 ? $this->getResultForIdenticals() : $this->renderWorker($differ); } - /** - * {@inheritdoc} - */ final public function renderArray(array $differArray): string { $this->changesAreRaw = false; diff --git a/src/Renderer/Html/AbstractHtml.php b/src/Renderer/Html/AbstractHtml.php index 9a576e69..5369d55b 100644 --- a/src/Renderer/Html/AbstractHtml.php +++ b/src/Renderer/Html/AbstractHtml.php @@ -44,9 +44,6 @@ abstract class AbstractHtml extends AbstractRenderer */ public const AUTO_FORMAT_CHANGES = true; - /** - * {@inheritdoc} - */ public function getResultForIdenticalsDefault(): string { return ''; @@ -105,9 +102,6 @@ public function getChanges(Differ $differ): array return $changes; } - /** - * {@inheritdoc} - */ protected function renderWorker(Differ $differ): string { $rendered = $this->redererChanges($this->getChanges($differ)); @@ -115,9 +109,6 @@ protected function renderWorker(Differ $differ): string return $this->cleanUpDummyHtmlClosures($rendered); } - /** - * {@inheritdoc} - */ protected function renderArrayWorker(array $differArray): string { $this->ensureChangesUseIntTag($differArray); diff --git a/src/Renderer/Html/Combined.php b/src/Renderer/Html/Combined.php index ceb1583d..7987f143 100644 --- a/src/Renderer/Html/Combined.php +++ b/src/Renderer/Html/Combined.php @@ -30,9 +30,6 @@ final class Combined extends AbstractHtml */ public const AUTO_FORMAT_CHANGES = false; - /** - * {@inheritdoc} - */ protected function redererChanges(array $changes): string { if (empty($changes)) { diff --git a/src/Renderer/Html/Inline.php b/src/Renderer/Html/Inline.php index 645018c8..274811d7 100644 --- a/src/Renderer/Html/Inline.php +++ b/src/Renderer/Html/Inline.php @@ -19,9 +19,6 @@ final class Inline extends AbstractHtml 'type' => 'Html', ]; - /** - * {@inheritdoc} - */ protected function redererChanges(array $changes): string { if (empty($changes)) { diff --git a/src/Renderer/Html/Json.php b/src/Renderer/Html/Json.php index 27f8f365..f2d937fe 100644 --- a/src/Renderer/Html/Json.php +++ b/src/Renderer/Html/Json.php @@ -9,6 +9,4 @@ * * @deprecated 6.8.0 Use the "JsonHtml" renderer instead. */ -final class Json extends JsonHtml -{ -} +final class Json extends JsonHtml {} diff --git a/src/Renderer/Html/JsonHtml.php b/src/Renderer/Html/JsonHtml.php index 2759eb48..cc7ebeaf 100644 --- a/src/Renderer/Html/JsonHtml.php +++ b/src/Renderer/Html/JsonHtml.php @@ -24,17 +24,11 @@ class JsonHtml extends AbstractHtml */ public const IS_TEXT_RENDERER = true; - /** - * {@inheritdoc} - */ public function getResultForIdenticalsDefault(): string { return '[]'; } - /** - * {@inheritdoc} - */ protected function redererChanges(array $changes): string { if ($this->options['outputTagAsString']) { @@ -58,9 +52,6 @@ protected function convertTagToString(array &$changes): void } } - /** - * {@inheritdoc} - */ protected function formatStringFromLines(string $string): string { return $this->htmlSafe($string); diff --git a/src/Renderer/Html/LineRenderer/Char.php b/src/Renderer/Html/LineRenderer/Char.php index f66dabae..e13c2e8c 100644 --- a/src/Renderer/Html/LineRenderer/Char.php +++ b/src/Renderer/Html/LineRenderer/Char.php @@ -12,8 +12,6 @@ final class Char extends AbstractLineRenderer { /** - * {@inheritdoc} - * * @return static */ public function render(MbString $mbOld, MbString $mbNew): LineRendererInterface diff --git a/src/Renderer/Html/LineRenderer/Line.php b/src/Renderer/Html/LineRenderer/Line.php index d5357aa5..0aba3b4b 100644 --- a/src/Renderer/Html/LineRenderer/Line.php +++ b/src/Renderer/Html/LineRenderer/Line.php @@ -10,8 +10,6 @@ final class Line extends AbstractLineRenderer { /** - * {@inheritdoc} - * * @return static */ public function render(MbString $mbOld, MbString $mbNew): LineRendererInterface diff --git a/src/Renderer/Html/LineRenderer/None.php b/src/Renderer/Html/LineRenderer/None.php index b8abaa5d..b48df474 100644 --- a/src/Renderer/Html/LineRenderer/None.php +++ b/src/Renderer/Html/LineRenderer/None.php @@ -9,8 +9,6 @@ final class None extends AbstractLineRenderer { /** - * {@inheritdoc} - * * @return static */ public function render(MbString $mbOld, MbString $mbNew): LineRendererInterface diff --git a/src/Renderer/Html/LineRenderer/Word.php b/src/Renderer/Html/LineRenderer/Word.php index 6160af57..f26bb166 100644 --- a/src/Renderer/Html/LineRenderer/Word.php +++ b/src/Renderer/Html/LineRenderer/Word.php @@ -13,8 +13,6 @@ final class Word extends AbstractLineRenderer { /** - * {@inheritdoc} - * * @return static */ public function render(MbString $mbOld, MbString $mbNew): LineRendererInterface diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index 170112e5..2ef1ee84 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -19,9 +19,6 @@ final class SideBySide extends AbstractHtml 'type' => 'Html', ]; - /** - * {@inheritdoc} - */ protected function redererChanges(array $changes): string { if (empty($changes)) { diff --git a/src/Renderer/Text/AbstractText.php b/src/Renderer/Text/AbstractText.php index 9853ac6c..b1a59983 100644 --- a/src/Renderer/Text/AbstractText.php +++ b/src/Renderer/Text/AbstractText.php @@ -29,9 +29,6 @@ abstract class AbstractText extends AbstractRenderer */ protected $isCliColorEnabled = false; - /** - * {@inheritdoc} - */ public function setOptions(array $options): AbstractRenderer { parent::setOptions($options); @@ -48,17 +45,11 @@ public function setOptions(array $options): AbstractRenderer return $this; } - /** - * {@inheritdoc} - */ public function getResultForIdenticalsDefault(): string { return ''; } - /** - * {@inheritdoc} - */ protected function renderArrayWorker(array $differArray): string { throw new UnsupportedFunctionException(__METHOD__); @@ -139,6 +130,7 @@ protected function hasColorSupport($stream): bool } $stat = @fstat($stream); + // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; } diff --git a/src/Renderer/Text/Context.php b/src/Renderer/Text/Context.php index 24657738..a82dd823 100644 --- a/src/Renderer/Text/Context.php +++ b/src/Renderer/Text/Context.php @@ -30,9 +30,6 @@ final class Context extends AbstractText SequenceMatcher::OP_INS | SequenceMatcher::OP_REP; - /** - * {@inheritdoc} - */ protected function renderWorker(Differ $differ): string { $ret = ''; diff --git a/src/Renderer/Text/JsonText.php b/src/Renderer/Text/JsonText.php index 285c6555..6965feab 100644 --- a/src/Renderer/Text/JsonText.php +++ b/src/Renderer/Text/JsonText.php @@ -20,9 +20,6 @@ final class JsonText extends AbstractText 'type' => 'Text', ]; - /** - * {@inheritdoc} - */ protected function renderWorker(Differ $differ): string { $ret = []; diff --git a/src/Renderer/Text/Unified.php b/src/Renderer/Text/Unified.php index 53db54e7..4a1d5075 100644 --- a/src/Renderer/Text/Unified.php +++ b/src/Renderer/Text/Unified.php @@ -22,9 +22,6 @@ final class Unified extends AbstractText 'type' => 'Text', ]; - /** - * {@inheritdoc} - */ protected function renderWorker(Differ $differ): string { $ret = ''; diff --git a/src/Utility/Arr.php b/src/Utility/Arr.php index 0ebcb7ef..e9a0ffd9 100644 --- a/src/Utility/Arr.php +++ b/src/Utility/Arr.php @@ -16,7 +16,7 @@ final class Arr * * @return array array of all of the lines between the specified range */ - public static function getPartialByIndex(array $array, int $start = 0, ?int $end = null): array + public static function getPartialByIndex(array $array, int $start = 0, int $end = null): array { $count = \count($array); diff --git a/src/Utility/ReverseIterator.php b/src/Utility/ReverseIterator.php index 7574ff31..c9b0a3cc 100644 --- a/src/Utility/ReverseIterator.php +++ b/src/Utility/ReverseIterator.php @@ -13,9 +13,7 @@ final class ReverseIterator /** * The constructor. */ - private function __construct() - { - } + private function __construct() {} /** * Iterate the array reversely. diff --git a/tests/DiffHelperTest.php b/tests/DiffHelperTest.php index 528e8bf8..04c201d9 100644 --- a/tests/DiffHelperTest.php +++ b/tests/DiffHelperTest.php @@ -24,7 +24,7 @@ final class DiffHelperTest extends TestCase * @covers \Jfcherng\Diff\Renderer\Text\Context * @covers \Jfcherng\Diff\Renderer\Text\Unified * - * @dataProvider rendererOutputDataProvider + * @dataProvider provideRendererOutputCases * * @param string $rendererName The renderer name * @param int $idx The index @@ -33,7 +33,7 @@ final class DiffHelperTest extends TestCase public function testRendererOutput(string $rendererName, int $idx, array $testFiles): void { if (!isset($testFiles['old'], $testFiles['new'], $testFiles['result'])) { - static::markTestSkipped("Renderer output test '{$rendererName}' #{$idx} is imcomplete."); + self::markTestSkipped("Renderer output test '{$rendererName}' #{$idx} is imcomplete."); } $result = DiffHelper::calculate( @@ -44,7 +44,7 @@ public function testRendererOutput(string $rendererName, int $idx, array $testFi ['cliColorization' => RendererConstant::CLI_COLOR_DISABLE], ); - static::assertSame( + self::assertSame( $testFiles['result']->getContents(), $result, "Renderer output test '{$rendererName}' #{$idx} failed...", @@ -58,13 +58,13 @@ public function testRendererOutput(string $rendererName, int $idx, array $testFi */ public function testGetStyleSheet(): void { - static::assertIsString(DiffHelper::getStyleSheet()); + self::assertIsString(DiffHelper::getStyleSheet()); } /** * Data provider for self::testRendererOutput. */ - public function rendererOutputDataProvider(): array + public function provideRendererOutputCases(): iterable { $rendererNames = DiffHelper::getAvailableRenderers(); diff --git a/tests/DifferTest.php b/tests/DifferTest.php index 20384f98..701957f3 100644 --- a/tests/DifferTest.php +++ b/tests/DifferTest.php @@ -20,7 +20,7 @@ final class DifferTest extends TestCase * * @return array the data provider */ - public function getGroupedOpcodesDataProvider(): array + public function provideGetGroupedOpcodesCases(): iterable { return [ [ @@ -55,7 +55,7 @@ public function getGroupedOpcodesDataProvider(): array * * @covers \Jfcherng\Diff\Differ::getGroupedOpcodes * - * @dataProvider getGroupedOpcodesDataProvider + * @dataProvider provideGetGroupedOpcodesCases * * @param string $old the old * @param string $new the new @@ -66,7 +66,7 @@ public function testGetGroupedOpcodes(string $old, string $new, array $expected) $old = explode("\n", $old); $new = explode("\n", $new); - static::assertSame( + self::assertSame( $expected, (new Differ($old, $new))->getGroupedOpcodes(), ); diff --git a/tests/IgnoreLineEndingTest.php b/tests/IgnoreLineEndingTest.php index e0c2bbeb..42f80ba9 100644 --- a/tests/IgnoreLineEndingTest.php +++ b/tests/IgnoreLineEndingTest.php @@ -18,7 +18,7 @@ final class IgnoreLineEndingTest extends TestCase /** * @return string[][] */ - public function provideIgnoreLineEnding(): array + public function provideIgnoreLineEndingCases(): iterable { return [ [ @@ -45,7 +45,7 @@ public function provideIgnoreLineEnding(): array } /** - * @dataProvider provideIgnoreLineEnding + * @dataProvider provideIgnoreLineEndingCases */ public function testIgnoreLineEnding( string $old, @@ -59,6 +59,6 @@ public function testIgnoreLineEnding( 'cliColorization' => RendererConstant::CLI_COLOR_DISABLE, ]); - static::assertSame($expectedDiff, $diff); + self::assertSame($expectedDiff, $diff); } } diff --git a/tests/IgnoreWhitespaceTest.php b/tests/IgnoreWhitespaceTest.php index 53f92cda..1076db47 100644 --- a/tests/IgnoreWhitespaceTest.php +++ b/tests/IgnoreWhitespaceTest.php @@ -18,7 +18,7 @@ final class IgnoreWhitespaceTest extends TestCase /** * @return string[][] */ - public function provideIgnoreWhitespaces(): array + public function provideIgnoreWhitespacesCases(): iterable { return [ [ @@ -135,7 +135,7 @@ function foo() } /** - * @dataProvider provideIgnoreWhitespaces + * @dataProvider provideIgnoreWhitespacesCases */ public function testIgnoreWhitespaces(string $old, string $new, string $expectedDiff): void { @@ -145,6 +145,6 @@ public function testIgnoreWhitespaces(string $old, string $new, string $expected 'cliColorization' => RendererConstant::CLI_COLOR_DISABLE, ]); - static::assertSame($expectedDiff, $diff); + self::assertSame($expectedDiff, $diff); } } diff --git a/tests/Renderer/Html/CombinedTest.php b/tests/Renderer/Html/CombinedTest.php index 9d99fa61..ff03119e 100644 --- a/tests/Renderer/Html/CombinedTest.php +++ b/tests/Renderer/Html/CombinedTest.php @@ -26,7 +26,7 @@ public function testHtmlFormatting(): void $result = DiffHelper::calculate('<', " \nA 'word']); $result = htmlspecialchars_decode($result); - static::assertStringNotContainsString(';', $result); + self::assertStringNotContainsString(';', $result); } /** @@ -42,8 +42,8 @@ public function testHtmlEscapeForOpEq(): void 'Combined', ); - static::assertStringNotContainsString('', $result); - static::assertStringNotContainsString('', $result); + self::assertStringNotContainsString('', $result); + self::assertStringNotContainsString('', $result); } /** @@ -55,7 +55,7 @@ public function testSimpleUnmergeableBlock(): void { $result = DiffHelper::calculate("111\n222\n333\n", "444\n555\n666\n", 'Combined'); - static::assertSame( + self::assertSame( [1, 1, 1, 1, 1, 1], [ substr_count($result, '111'), diff --git a/tests/Renderer/Html/LineRenderer/WordTest.php b/tests/Renderer/Html/LineRenderer/WordTest.php index 34627fe1..81a2b9f4 100644 --- a/tests/Renderer/Html/LineRenderer/WordTest.php +++ b/tests/Renderer/Html/LineRenderer/WordTest.php @@ -34,8 +34,8 @@ public function testRenderWordGlues1(): void $oldDiff = str_replace(RendererConstant::HTML_CLOSURES, RendererConstant::HTML_CLOSURES_DEL, $mbOld->get()); $newDiff = str_replace(RendererConstant::HTML_CLOSURES, RendererConstant::HTML_CLOSURES_INS, $mbNew->get()); - static::assertSame('good-looking-x', $oldDiff); - static::assertSame('good--y', $newDiff); + self::assertSame('good-looking-x', $oldDiff); + self::assertSame('good--y', $newDiff); } /** @@ -56,7 +56,7 @@ public function testRenderWordGlues2(): void $oldDiff = str_replace(RendererConstant::HTML_CLOSURES, RendererConstant::HTML_CLOSURES_DEL, $mbOld->get()); $newDiff = str_replace(RendererConstant::HTML_CLOSURES, RendererConstant::HTML_CLOSURES_INS, $mbNew->get()); - static::assertSame('of the Indo-Euopearn legguanas, Porto-Idno-Eorpuaen, did not have aieltrcs. Msot of the lanaguges in this flamiy do not hvae diiefnte or ieiinfntde atrciels: three is no actirle in Ltain or Ssknarit, nor in some meodrn Indo-Eoeapurn lgagaenus, scuh as the falmeiis of Salvic lnggaeuas (epexct for Bulraiagn and Mneiodaacn, whcih are reahtr dviiittcsne amnog the Saivlc lagauegns in thier gmrmaar), Btialc leaauggns and mnay Indo-Aaryn lgugneaas. Aluogthh Csiacslal Greek had a dtiniefe artlcie (wichh has srivvued itno Modren Gerek and wichh bears snotrg fcaiutonnl raeelmnscbe to the Gramen deiinfte arltcie, whcih it is rtealed to), the erailer Hmeoirc Geerk used this alctrie llrgeay as a prnuoon or dioravsttmnee, wareehs the erlaseit known form of Geerk konwn as Meayenacn Gerek did not have any acrlties. Atilcres dvlpeeoed inleenddpenty in svaeerl lagnauge fmieials. In mnay lagnuegas, the form of the atrlice may vary acdrocnig to the gneedr, nbmuer, or csae of its nuon. In smoe laganegus the artcile may be the only idiaitnocn of the case. Many languages do not utilize articles at all, and may use other ways of denoting old versus incipient information, such as topic comment constructions.', $oldDiff); - static::assertSame('of the Indo-European languages, Proto-Indo-European, did not have articles. Most of the languages in this family do not have definite or indefinite articles: there is no article in Latin or Sanskrit, nor in some modern Indo-European languages, such as the families of Slavic languages (epexct for Bulraiagn and Mneiodaacn, whcih are reahtr dviiittcsne amnog the Saivlc lagauegns in thier gmrmaar), Btialc leaauggns and mnay Indo-Aaryn lgugneaas. Aluogthh Csiacslal Greek had a dtiniefe artlcie (wichh has srivvued itno Modren Gerek and wichh bears snotrg fcaiutonnl raeelmnscbe to the Gramen deiinfte arltcie, whcih it is rtealed to), the erailer Hmeoirc Geerk used this alctrie llrgeay as a prnuoon or dioravsttmnee, wareehs the erlaseit known form of Geerk konwn as Meayenacn Gerek did not have any acrlties. Atilcres dvlpeeoed inleenddpenty in svaeerl lagnauge fmieials. In mnay lagnuegas, the form of the atrlice may vary acdrocnig to the gneedr, nbmuer, or csae of its nuon. In smoe laganegus the artcile may be the only idiaitnocn of the case. Many languages do not utilize articles at all, and may use other ways of denoting old versus incipient information, such as topic comment constructions.', $newDiff); + self::assertSame('of the Indo-Euopearn legguanas, Porto-Idno-Eorpuaen, did not have aieltrcs. Msot of the lanaguges in this flamiy do not hvae diiefnte or ieiinfntde atrciels: three is no actirle in Ltain or Ssknarit, nor in some meodrn Indo-Eoeapurn lgagaenus, scuh as the falmeiis of Salvic lnggaeuas (epexct for Bulraiagn and Mneiodaacn, whcih are reahtr dviiittcsne amnog the Saivlc lagauegns in thier gmrmaar), Btialc leaauggns and mnay Indo-Aaryn lgugneaas. Aluogthh Csiacslal Greek had a dtiniefe artlcie (wichh has srivvued itno Modren Gerek and wichh bears snotrg fcaiutonnl raeelmnscbe to the Gramen deiinfte arltcie, whcih it is rtealed to), the erailer Hmeoirc Geerk used this alctrie llrgeay as a prnuoon or dioravsttmnee, wareehs the erlaseit known form of Geerk konwn as Meayenacn Gerek did not have any acrlties. Atilcres dvlpeeoed inleenddpenty in svaeerl lagnauge fmieials. In mnay lagnuegas, the form of the atrlice may vary acdrocnig to the gneedr, nbmuer, or csae of its nuon. In smoe laganegus the artcile may be the only idiaitnocn of the case. Many languages do not utilize articles at all, and may use other ways of denoting old versus incipient information, such as topic comment constructions.', $oldDiff); + self::assertSame('of the Indo-European languages, Proto-Indo-European, did not have articles. Most of the languages in this family do not have definite or indefinite articles: there is no article in Latin or Sanskrit, nor in some modern Indo-European languages, such as the families of Slavic languages (epexct for Bulraiagn and Mneiodaacn, whcih are reahtr dviiittcsne amnog the Saivlc lagauegns in thier gmrmaar), Btialc leaauggns and mnay Indo-Aaryn lgugneaas. Aluogthh Csiacslal Greek had a dtiniefe artlcie (wichh has srivvued itno Modren Gerek and wichh bears snotrg fcaiutonnl raeelmnscbe to the Gramen deiinfte arltcie, whcih it is rtealed to), the erailer Hmeoirc Geerk used this alctrie llrgeay as a prnuoon or dioravsttmnee, wareehs the erlaseit known form of Geerk konwn as Meayenacn Gerek did not have any acrlties. Atilcres dvlpeeoed inleenddpenty in svaeerl lagnauge fmieials. In mnay lagnuegas, the form of the atrlice may vary acdrocnig to the gneedr, nbmuer, or csae of its nuon. In smoe laganegus the artcile may be the only idiaitnocn of the case. Many languages do not utilize articles at all, and may use other ways of denoting old versus incipient information, such as topic comment constructions.', $newDiff); } } diff --git a/tests/Renderer/RendererTest.php b/tests/Renderer/RendererTest.php index 704737fd..94ada7ea 100644 --- a/tests/Renderer/RendererTest.php +++ b/tests/Renderer/RendererTest.php @@ -40,7 +40,7 @@ public function testSetOptionsWithLanguageArray(): void ['language' => $languageArrayTest], ); - static::assertStringContainsString( + self::assertStringContainsString( $testMarker, $diffResult, 'Rederer options: "language" array should work.', @@ -64,7 +64,7 @@ public function testSetOptionsWithResultForIdenticals(): void ['resultForIdenticals' => $testMarker], ); - static::assertSame( + self::assertSame( $testMarker, $diffResult, 'Rederer options: result for identicals should work.', @@ -123,7 +123,7 @@ public function testHtmlRendererRenderWithResultFromJsonRenderer(): void ['outputTagAsString' => false] + $rendererOptions, ); - static::assertSame( + self::assertSame( $goldenResult, $renderer->renderArray(json_decode($jsonResult, true)), "HTML renderers should be able to render with JSON result. ('outputTagAsString' => false)", @@ -138,7 +138,7 @@ public function testHtmlRendererRenderWithResultFromJsonRenderer(): void ['outputTagAsString' => true] + $rendererOptions, ); - static::assertSame( + self::assertSame( $goldenResult, $renderer->renderArray(json_decode($jsonResult, true)), "HTML renderers should be able to render with JSON result. ('outputTagAsString' => true)", diff --git a/tests/Utility/LanguageTest.php b/tests/Utility/LanguageTest.php index 472be43a..1f008caf 100644 --- a/tests/Utility/LanguageTest.php +++ b/tests/Utility/LanguageTest.php @@ -35,10 +35,10 @@ protected function setUp(): void public function testLoad(): void { $this->languageObj->load('eng'); - static::assertArrayHasKey('differences', $this->languageObj->getTranslations()); + self::assertArrayHasKey('differences', $this->languageObj->getTranslations()); $this->languageObj->load(['hahaha' => '哈哈哈']); - static::assertArrayHasKey('hahaha', $this->languageObj->getTranslations()); + self::assertArrayHasKey('hahaha', $this->languageObj->getTranslations()); $this->languageObj->load([ 'eng', @@ -46,9 +46,9 @@ public function testLoad(): void ['hahaha_1' => '哈哈哈_999'], ]); $translations = $this->languageObj->getTranslations(); - static::assertSame('Differences', $translations['differences']); - static::assertSame('哈哈哈_999', $translations['hahaha_1']); - static::assertSame('哈哈哈_2', $translations['hahaha_2']); + self::assertSame('Differences', $translations['differences']); + self::assertSame('哈哈哈_999', $translations['hahaha_1']); + self::assertSame('哈哈哈_2', $translations['hahaha_2']); $this->expectException(\InvalidArgumentException::class); $this->languageObj->load(5); @@ -61,12 +61,12 @@ public function testLoad(): void */ public function testTranslate(): void { - static::assertSame( + self::assertSame( 'Differences', $this->languageObj->translate('differences'), ); - static::assertStringMatchesFormat( + self::assertStringMatchesFormat( '![%s]', $this->languageObj->translate('a_non_existing_key'), );