You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #32329 [DomCrawler] [5.0] add type-hint whenever possible (Simperfit)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[DomCrawler] [5.0] add type-hint whenever possible
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | Contribute to #32179 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | none <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/roadmap):
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against branch 4.4.
- Legacy code removals go to the master branch.
-->
Add type hint to DomCrawler
Commits
-------
580b126 [DomCrawler] [5.0] add type-hint whenever possible
@@ -745,11 +713,9 @@ public function selectImage($value)
745
713
/**
746
714
* Selects a button by name or alt value for images.
747
715
*
748
-
* @param string $value The button text
749
-
*
750
716
* @return self
751
717
*/
752
-
publicfunctionselectButton($value)
718
+
publicfunctionselectButton(string$value)
753
719
{
754
720
return$this->filterRelativeXPath(
755
721
sprintf('descendant-or-self::input[((contains(%1$s, "submit") or contains(%1$s, "button")) and contains(concat(\'\', normalize-space(string(@value)), \'\'), %2$s)) or (contains(%1$s, "image") and contains(concat(\'\', normalize-space(string(@alt)), \'\'), %2$s)) or @id=%3$s or @name=%3$s] | descendant-or-self::button[contains(concat(\'\', normalize-space(string(.)), \'\'), %2$s) or @id=%3$s or @name=%3$s]', 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")', static::xpathLiteral(''.$value.''), static::xpathLiteral($value))
@@ -759,13 +725,11 @@ public function selectButton($value)
759
725
/**
760
726
* Returns a Link object for the first node in the list.
761
727
*
762
-
* @param string $method The method for the link (get by default)
763
-
*
764
728
* @return Link A Link instance
765
729
*
766
730
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
767
731
*/
768
-
publicfunctionlink($method = 'get')
732
+
publicfunctionlink(string$method = 'get')
769
733
{
770
734
if (!$this->nodes) {
771
735
thrownew \InvalidArgumentException('The current node list is empty.');
@@ -845,14 +809,11 @@ public function images()
845
809
/**
846
810
* Returns a Form object for the first node in the list.
847
811
*
848
-
* @param array $values An array of values for the form fields
849
-
* @param string $method The method for the form
850
-
*
851
812
* @return Form A Form instance
852
813
*
853
814
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
0 commit comments