Skip to content

[DomCrawler] DomCrawler is not properly extendable #7210

Closed
@mvdbos

Description

@mvdbos

The property $uri and the methods sibling() and getNode() of Symfony\Component\DomCrawler\Crawler are private and should be made protected.

Currently, when you extend the DomCrawler, you have to implement this property and both these methods to get things working, even though I only wanted to override the links() method.

This seems unnecessaryily private. Especially because Symfony\Component\BrowserKit\Client::createCrawlerFromContent() is protected and thus encourages overriding it and returning your own Crawler. That is exactly what I want to do extend the Crawler, mostly reuse it, and add a small amount of custom logic.

Alternative: if extension of the Crawler is discouraged, there should at least be a Crawler interface to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions