1 | <?php |
||
16 | abstract class AbstractXmlMiddleware extends AbstractMiddleware |
||
17 | { |
||
18 | /** |
||
19 | * Replace all instances of `%s` with the `$namespaceAlias` parameter. |
||
20 | * |
||
21 | * This is similar to `sprintf()`, but the `$namespaceAlias` is applied to _all_ instances of `%s`. |
||
22 | * |
||
23 | * @param string $query An XPath query where `%s` is used in-place of the XML namespace alias. |
||
24 | * @param string $namespaceAlias The XML namespace alias to apply. |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | public function applyNsToQuery(string $query, string $namespaceAlias): string |
||
32 | |||
33 | /** |
||
34 | * Produce an XPath 1.0 expression which is used to query XML document nodes. |
||
35 | * |
||
36 | * @param string $namespaceAlias The XML namespace alias to apply. |
||
37 | * @param bool $supportMixedCase Whether or not to generate an XPath query which supports |
||
38 | * mixed-case/case-insensitive XML element names. |
||
39 | * @param string ...$path A variadic parameter which accepts the names of the XML |
||
40 | * tree nodes in sequence. |
||
41 | * |
||
42 | * @return string An XPath 1.0 expression. |
||
43 | * |
||
44 | * @see https://wiki.php.net/rfc/variadics |
||
45 | * @see http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
||
46 | */ |
||
|
|||
47 | public function generateQuery(string $namespaceAlias, bool $supportMixedCase = false, string ...$path): string |
||
71 | |||
72 | /** |
||
73 | * Some elements in the feed should only have one result. This handles those cases. |
||
74 | * |
||
75 | * @param callable $fn A callable which returns a `DOMElementList`. |
||
76 | * |
||
77 | * @return array Returns an array with keys of `text` and `html`. |
||
78 | */ |
||
79 | public function handleSingleNode(callable $fn): Node |
||
89 | |||
90 | public function handleMultipleNodes(callable $fn): Node |
||
96 | } |
||
97 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.