minor #42018 [DomCrawler] Backport type fixes (derrabus)

This PR was merged into the 4.4 branch.

Discussion
----------

[DomCrawler] Backport type fixes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Discovered while working on #41981.

Commits
-------

6996988fe5 [DomCrawler] Backport type fixes
This commit is contained in:
Alexander M. Turek 2021-07-07 19:13:11 +01:00
commit 38cb35ab07
3 changed files with 18 additions and 9 deletions

View File

@ -35,7 +35,7 @@ abstract class AbstractUriElement
/**
* @param \DOMElement $node A \DOMElement instance
* @param string $currentUri The URI of the page where the link is embedded (or the base href)
* @param string|null $currentUri The URI of the page where the link is embedded (or the base href)
* @param string|null $method The method to use for the link (GET by default)
*
* @throws \InvalidArgumentException if the node is not a link

View File

@ -21,20 +21,29 @@ use Symfony\Component\CssSelector\CssSelectorConverter;
*/
class Crawler implements \Countable, \IteratorAggregate
{
/**
* @var string|null
*/
protected $uri;
/**
* @var string The default namespace prefix to be used with XPath and CSS expressions
* The default namespace prefix to be used with XPath and CSS expressions.
*
* @var string
*/
private $defaultNamespacePrefix = 'default';
/**
* @var array A map of manually registered namespaces
* A map of manually registered namespaces.
*
* @var array<string, string>
*/
private $namespaces = [];
/**
* @var string The base href value
* The base href value.
*
* @var string|null
*/
private $baseHref;
@ -75,7 +84,7 @@ class Crawler implements \Countable, \IteratorAggregate
/**
* Returns the current URI.
*
* @return string
* @return string|null
*/
public function getUri()
{
@ -85,7 +94,7 @@ class Crawler implements \Countable, \IteratorAggregate
/**
* Returns base href.
*
* @return string
* @return string|null
*/
public function getBaseHref()
{

View File

@ -38,9 +38,9 @@ class Form extends Link implements \ArrayAccess
/**
* @param \DOMElement $node A \DOMElement instance
* @param string $currentUri The URI of the page where the form is embedded
* @param string $method The method to use for the link (if null, it defaults to the method defined by the form)
* @param string $baseHref The URI of the <base> used for relative links, but not for empty action
* @param string|null $currentUri The URI of the page where the form is embedded
* @param string|null $method The method to use for the link (if null, it defaults to the method defined by the form)
* @param string|null $baseHref The URI of the <base> used for relative links, but not for empty action
*
* @throws \LogicException if the node is not a button inside a form tag
*/