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