Skip to content

Commit

Permalink
Add PHP 8.2 support
Browse files Browse the repository at this point in the history
- Update Github Actions workflows to test against PHP 8.2, too.
- Fix new Psalm issue
- Fix coding standard
  • Loading branch information
cristianoc72 committed May 26, 2023
1 parent 7fea3f6 commit 83f5e20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions XmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use phootwork\file\File;
use phootwork\xml\exception\XmlException;
use Stringable;
use XmlParser as BaseParser;
use XMLParser as BaseParser;

class XmlParser {
/**
Expand Down Expand Up @@ -133,7 +133,7 @@ public function parse(string|Stringable $data): void {
if (!xml_parse($this->parser, (string) $data)) {
$code = xml_get_error_code($this->parser);

throw new XmlException(xml_error_string($code), $code);
throw new XmlException(xml_error_string($code) ?? 'Undefined error', $code);
}
}

Expand All @@ -152,6 +152,7 @@ public function parseFile(string|Stringable $file): void {

/**
* @return int
*
* @psalm-suppress InvalidArgument Psalm issue: in PHP8 the function `xml_get_current_line_number`
* expects a `XmlParser` and not more `resource`. Remove it when fixed.
*/
Expand All @@ -161,6 +162,7 @@ private function getCurrentLineNumber(): int {

/**
* @return int
*
* @psalm-suppress InvalidArgument Psalm issue: in PHP8 the function `xml_get_current_column_number`
* expects a `XmlParser` and not more `resource`. Remove it when fixed.
*/
Expand Down

0 comments on commit 83f5e20

Please sign in to comment.