Skip to content

Commit 09adec3

Browse files
authored
[TASK] Implement RuleValueList::getArrayRepresentation() (#1457)
The class has no additional properties, so this is a simple case of removing the stub method so it inherits its parent implementation, and adding a test. A stub exception-throwing method is added (pushed down the chain) to the subclass `CalcRuleValueList` pending implementation. Part of #1440.
1 parent 0a2c875 commit 09adec3

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/Value/CalcRuleValueList.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ public function render(OutputFormat $outputFormat): string
2020
{
2121
return $outputFormat->getFormatter()->implode(' ', $this->components);
2222
}
23+
24+
/**
25+
* @return array<string, bool|int|float|string|list<array<string, mixed>>>
26+
*
27+
* @internal
28+
*/
29+
public function getArrayRepresentation(): array
30+
{
31+
throw new \BadMethodCallException('`getArrayRepresentation` is not yet implemented for `' . self::class . '`');
32+
}
2333
}

src/Value/RuleValueList.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,4 @@ public function __construct(string $separator = ',', ?int $lineNumber = null)
1919
{
2020
parent::__construct([], $separator, $lineNumber);
2121
}
22-
23-
/**
24-
* @return array<string, bool|int|float|string|list<array<string, mixed>>>
25-
*
26-
* @internal
27-
*/
28-
public function getArrayRepresentation(): array
29-
{
30-
throw new \BadMethodCallException('`getArrayRepresentation` is not yet implemented for `' . self::class . '`');
31-
}
3222
}

tests/Unit/Value/RuleValueListTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ final class RuleValueListTest extends TestCase
1717
/**
1818
* @test
1919
*/
20-
public function getArrayRepresentationThrowsException(): void
20+
public function getArrayRepresentationIncludesClassName(): void
2121
{
22-
$this->expectException(\BadMethodCallException::class);
23-
2422
$subject = new RuleValueList();
2523

26-
$subject->getArrayRepresentation();
24+
$result = $subject->getArrayRepresentation();
25+
26+
self::assertArrayHasKey('class', $result);
27+
self::assertSame('RuleValueList', $result['class']);
2728
}
2829
}

0 commit comments

Comments
 (0)