SelectorTokenLinter
in package
implements
TokenLinter
Table of Contents
Interfaces
Properties
- $SELECTOR_PATTERN : string
- Matches valid CSS selectors including: - Class selectors (.class) - ID selectors (#id) - Element selectors (div) - Attribute selectors ([attr=value]) - Pseudo-classes (:hover) - Combinators (>, +, ~)
Methods
- lint() : Generator<string|int, TokenError>
- Lints a token and returns a list of issues found.
- supports() : bool
- Checks if the linter supports the given token.
Properties
$SELECTOR_PATTERN
Matches valid CSS selectors including: - Class selectors (.class) - ID selectors (#id) - Element selectors (div) - Attribute selectors ([attr=value]) - Pseudo-classes (:hover) - Combinators (>, +, ~)
public
static string
$SELECTOR_PATTERN
= '/^[.#a-zA-Z0-9\[\]=\'"\-_\:>\+~\s\(\),]+$/'
Methods
lint()
Lints a token and returns a list of issues found.
public
lint(Token $token) : Generator<string|int, TokenError>
Parameters
- $token : Token
-
The token to lint.
Return values
Generator<string|int, TokenError> —A list of issues found during linting.
supports()
Checks if the linter supports the given token.
public
supports(Token $token) : bool
Parameters
- $token : Token
-
The token to check.
Return values
bool —True if the linter supports the token, false otherwise.