Skip to content

Commit

Permalink
qa: fix CS issues
Browse files Browse the repository at this point in the history
- Indents XML examples in test cases (as allowed by PHP 7.3 in here/nowdoc declarations)
  - Convert all heredocs to nowdocs, to prevent unwanted string interpolation (and resolve CS issues)
- Wrap long method declarations over multiple lines
- Import all referenced classes

Signed-off-by: Matthew Weier O'Phinney <[email protected]>
  • Loading branch information
weierophinney committed Feb 17, 2021
1 parent 78b9d42 commit 86ef887
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 298 deletions.
4 changes: 3 additions & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace Laminas\Xml2Json\Exception;

class RuntimeException extends \RuntimeException implements ExceptionInterface
use RuntimeException as PhpRuntimeException;

class RuntimeException extends PhpRuntimeException implements ExceptionInterface
{
}
12 changes: 6 additions & 6 deletions src/Xml2Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ protected static function getXmlValue($simpleXmlElementObject)
* calling a recursive function in this class; once all XML elements are
* stored to a PHP array, it is returned to the caller.
*
* @param SimpleXMLElement $simpleXmlElementObject
* @param bool $ignoreXmlAttributes
* @param int $recursionDepth
* @return array
* @throws Exception\RecursionException if the XML tree is deeper than the
* @throws Exception\RecursionException If the XML tree is deeper than the
* allowed limit.
*/
protected static function processXml(SimpleXMLElement $simpleXmlElementObject, bool $ignoreXmlAttributes, $recursionDepth = 0): array
{
protected static function processXml(
SimpleXMLElement $simpleXmlElementObject,
bool $ignoreXmlAttributes,
$recursionDepth = 0
): array {
// Keep an eye on how deeply we are involved in recursion.
if ($recursionDepth > static::$maxRecursionDepthAllowed) {
// XML tree is too deep. Exit now by throwing an exception.
Expand Down
Loading

0 comments on commit 86ef887

Please sign in to comment.