Skip to content

Commit dda81fd

Browse files
author
Jaco Labuschagne
committed
formatting
1 parent 712d9c7 commit dda81fd

5 files changed

+39
-9
lines changed

src/Errors/XmlParserException.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
namespace Zodimo\Xml\Errors;
66

7-
class XmlParserException extends \Exception implements \Throwable
7+
use Exception;
8+
use Throwable;
9+
10+
class XmlParserException extends Exception implements Throwable
811
{
9-
public static function create(string $message, int $code = 0, ?\Throwable $previous = null): XmlParserException
12+
public static function create(string $message, int $code = 0, ?Throwable $previous = null): XmlParserException
1013
{
1114
return new self($message, $code, $previous);
1215
}

src/Errors/XmlParsingException.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
namespace Zodimo\Xml\Errors;
66

7-
class XmlParsingException extends \Exception implements \Throwable
7+
use Exception;
8+
use Throwable;
9+
10+
class XmlParsingException extends Exception implements Throwable
811
{
9-
public static function create(string $message, int $code = 0, ?\Throwable $previous = null): XmlParsingException
12+
public static function create(string $message, int $code = 0, ?Throwable $previous = null): XmlParsingException
1013
{
1114
return new self($message, $code, $previous);
1215
}

src/RegisterListenerInterface.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Zodimo\Xml;
66

7+
use XMLReader;
78
use Zodimo\BaseReturn\IOMonad;
89
use Zodimo\Xml\Errors\XmlParserException;
910

@@ -14,5 +15,5 @@ interface RegisterListenerInterface
1415
*
1516
* @return IOMonad<XmlReaderParser,XmlParserException>
1617
*/
17-
public function registerCallback(string $xpath, callable $callback, int $nodeType = \XMLReader::ELEMENT): IOMonad;
18+
public function registerCallback(string $xpath, callable $callback, int $nodeType = XMLReader::ELEMENT): IOMonad;
1819
}

src/SimpleXmlReaderInterface.php

+26-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,34 @@
44

55
namespace Zodimo\Xml;
66

7+
use DOMDocument;
8+
use SimpleXMLElement;
79
use XMLReader;
10+
use Zodimo\Xml\Errors\XmlParsingException;
811

912
/**
1013
* @mixin XMLReader
1114
*/
12-
interface SimpleXmlReaderInterface {}
15+
interface SimpleXmlReaderInterface
16+
{
17+
/**
18+
* Expand current node to string.
19+
*
20+
* @throws XmlParsingException
21+
*/
22+
public function expandString(string $version = '1.0', string $encoding = 'UTF-8'): string;
23+
24+
/**
25+
* Expand current node to SimpleXMLElement.
26+
*
27+
* @throws XmlParsingException
28+
*/
29+
public function expandSimpleXml(string $version = '1.0', string $encoding = 'UTF-8', ?string $className = null): SimpleXMLElement;
30+
31+
/**
32+
* Expand current node to DomDocument.
33+
*
34+
* @throws XmlParsingException
35+
*/
36+
public function expandDomDocument(string $version = '1.0', string $encoding = 'UTF-8'): DOMDocument;
37+
}

src/XmlReaderParser.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,9 @@ public function expandXpath(string $path, string $version = '1.0', string $encod
275275
/**
276276
* Expand current node to string.
277277
*
278-
* @return string
279-
*
280278
* @throws XmlParsingException
281279
*/
282-
public function expandString(string $version = '1.0', string $encoding = 'UTF-8')
280+
public function expandString(string $version = '1.0', string $encoding = 'UTF-8'): string
283281
{
284282
$simpleXmlElement = $this->expandSimpleXml($version, $encoding);
285283
// https://www.php.net/manual/en/simplexmlelement.asxml.php

0 commit comments

Comments
 (0)