Debian Codegraph @

vendor/sabberworm/php-css-parser/src/Property/Selector/Component.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Sabberworm\CSS\Property\Selector;
6
7 use Sabberworm\CSS\Renderable;
8
9 /**
10 * This interface is for a class that represents a part of a selector which is either a compound selector (or a simple
11 * selector, which is effectively a compound selector without any compounding) or a selector combinator.
12 *
13 * It allows a selector to be represented as an array of objects that implement this interface.
14 * This is the formal definition:
15 * selector = compound-selector [combinator, compound-selector]*
16 *
17 * The selector is comprised of an array of alternating types that can't be easily represented in a type-safe manner
18 * without this.
19 *
20 * 'Selector component' is not a known grammar in the spec, but a convenience for the implementation.
21 *
22 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Selectors/Selector_structure
23 * @see https://www.w3.org/TR/selectors-4/#structure
24 */
25 interface Component extends Renderable
26 {
27 /**
28 * @return non-empty-string
29 */
30 public function getValue(): string;
31
32 /**
33 * @param non-empty-string $value
34 */
35 public function setValue(string $value): void;
36
37 /**
38 * @return int<0, max>
39 */
40 public function getSpecificity(): int;
41 }