File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111use Sabberworm \CSS \Parsing \UnexpectedTokenException ;
1212use Sabberworm \CSS \Position \Position ;
1313use Sabberworm \CSS \Position \Positionable ;
14+ use Sabberworm \CSS \ShortClassNameProvider ;
1415
1516use function Safe \preg_match ;
1617
2122abstract class Value implements CSSElement, Positionable
2223{
2324 use Position;
25+ use ShortClassNameProvider;
2426
2527 /**
2628 * @param int<1, max>|null $lineNumber
@@ -188,9 +190,9 @@ public static function parsePrimitiveValue(ParserState $parserState)
188190 */
189191 public function getArrayRepresentation (): array
190192 {
191- throw new \ BadMethodCallException (
192- '`getArrayRepresentation` is not yet implemented for ` ' . static ::class . ' ` '
193- ) ;
193+ return [
194+ 'class ' => $ this -> getShortClassName (),
195+ ] ;
194196 }
195197
196198 /**
Original file line number Diff line number Diff line change @@ -179,12 +179,12 @@ public function parsesArithmeticWithMalformedOperandsInFunctions(string $leftOpe
179179 /**
180180 * @test
181181 */
182- public function getArrayRepresentationThrowsException (): void
182+ public function getArrayRepresentationIncludesClassName (): void
183183 {
184- $ this ->expectException (\BadMethodCallException::class);
185-
186184 $ subject = new ConcreteValue ();
187185
188- $ subject ->getArrayRepresentation ();
186+ $ result = $ subject ->getArrayRepresentation ();
187+
188+ self ::assertSame ('ConcreteValue ' , $ result ['class ' ]);
189189 }
190190}
You can’t perform that action at this time.
0 commit comments