-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated CssSelector code example to use the new Converter #5835
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,11 +47,14 @@ The CssSelector Component | |
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The component's only goal is to convert CSS selectors to their XPath | ||
equivalents:: | ||
equivalents, using :method:`Converter::toXPath() <Symfony\\Component\\CssSelector\\Converter::toXPath>` | ||
|
||
use Symfony\Component\CssSelector\CssSelector; | ||
.. code-block:: php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should still use the double colon at the end of the previous paragraph and omit the |
||
|
||
var_dump(CssSelector::toXPath('div.item > h4 > a')); | ||
use Symfony\Component\CssSelector\Converter; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The class has been renamed to CssSelectorConverter after the initial merge. So this update is wrong |
||
|
||
$converter = new Converter(); | ||
var_dump($converter->toXPath('div.item > h4 > a')); | ||
|
||
This gives the following output: | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use a special text for the link IMO. Just use
:method:
Symfony\Component\CssSelector\CssSelectorConverter::toXPath``