Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DomCrawler] Add more details about some methods#21034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:6.4fromjaviereguiluz:domcrawler_doc
Jul 18, 2025

Conversation

javiereguiluz
Copy link
Member

After merging#21031 I thought that we could improve some explanations of some methods with more details and references.

Copilot

This comment was marked as resolved.

Copy link
Member

@stofstof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We should probably also make it clear which methods are meant to be called on a single-node Crawler because they ignore other nodes than the first one (any method where the implementation rely on using$this->getNode(0) basically).

We have several places guaranteed to be dealing with single-node crawlers in the API:

  • the callback ofeach
  • the callback ofreduce
  • the return value ofeq (and its shortcut) for a valid position (for an invalid position, it will be an empty crawler for which those methods relying on the first node will throw an exception)

``first()``
Firstnode.
Selects the firstnode (equivalent to ``eq(0)``).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

UsingSelects in all those descriptions is confusing to me. We have different kinds of methods in this lists:

  • methods creating a Crawler containing only a subset of the nodes of the current Crawler instance (eq and all its shorcuts, but alsoreduce which actually filters the current instance andslice)
  • methods returning a new Crawler with a different selection (whichalso includes thefilter andfilterXpath methods, despite their name, as they are doing a mix of matching the existing nodes or finding their descendants)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You are right, but this doc is intesting/dom_crawler (we also havecomponents/dom_crawler) so this is probably an internal detail not relevant in this page. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well, if you improve the documentation of available methods to make it easier to know what they do (without going to another page), it is relevant to make it clear what they do IMO. Otherwise, you could remove the list and make them go tocomponents/dom_crawler to get the proper explanation.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've (slightly) updated all the descriptions to be more precise. Thanks!

@javiereguiluzjaviereguiluz merged commitfa468e4 intosymfony:6.4Jul 18, 2025
3 checks passed
@javiereguiluzjaviereguiluz deleted the domcrawler_doc branchJuly 18, 2025 13:06
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@stofstofstof approved these changes

@alamiraultalamiraultalamirault approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

4 participants
@javiereguiluz@stof@alamirault@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp