Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EmptyStringParser.php

class EmptyStringParser

CSS selector class parser shortcut.

This shortcut ensure compatibility with previous version.

  • The parser fails to parse an empty string.
  • In the previous version, an empty string matches each tags.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>

@internal

Hierarchy

  • class \Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser implements \Symfony\Component\CssSelector\Parser\ParserInterface

Expanded class hierarchy of EmptyStringParser

See also

https://github.com/SimonSapin/cssselect.

1 file declares its use of EmptyStringParser
CssSelectorConverter.php in vendor/symfony/css-selector/CssSelectorConverter.php

File

vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php, line 32

Namespace

Symfony\Component\CssSelector\Parser\Shortcut
View source
class EmptyStringParser implements ParserInterface {
    public function parse(string $source) : array {
        // Matches an empty string
        if ('' == $source) {
            return [
                new SelectorNode(new ElementNode(null, '*')),
            ];
        }
        return [];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
EmptyStringParser::parse public function Parses given selector source into an array of tokens. Overrides ParserInterface::parse

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal