From 7b4baac5381b1858f78b245f2f984a267a9f28a4 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 24 Nov 2015 11:59:48 +0000 Subject: [PATCH] Issue #2587229 by Chi, claudiu.cristea: Cleanup AssertContentTrait::xpath() --- .../simpletest/src/AssertContentTrait.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 3d276875b6a..00898bec60a 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -220,23 +220,23 @@ trait AssertContentTrait { * placeholders in the query. The values may be either strings or numeric * values. * - * @return array - * The return value of the xpath search. For details on the xpath string - * format and return values see the SimpleXML documentation, - * http://php.net/manual/function.simplexml-element-xpath.php. + * @return \SimpleXMLElement[]|bool + * The return value of the xpath search or FALSE on failure. For details on + * the xpath string format and return values see the SimpleXML + * documentation. + * + * @see http://php.net/manual/function.simplexml-element-xpath.php */ - protected function xpath($xpath, array $arguments = array()) { + protected function xpath($xpath, array $arguments = []) { if ($this->parse()) { $xpath = $this->buildXPathQuery($xpath, $arguments); $result = $this->elements->xpath($xpath); // Some combinations of PHP / libxml versions return an empty array // instead of the documented FALSE. Forcefully convert any falsish values // to an empty array to allow foreach(...) constructions. - return $result ? $result : array(); - } - else { - return FALSE; + return $result ?: []; } + return FALSE; } /**