Skip to content

Commit

Permalink
add support for php 8.2 (#36)
Browse files Browse the repository at this point in the history
* add support for php 8.2
  • Loading branch information
frederikbosch authored May 9, 2023
1 parent a575600 commit da05b91
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.0', '8.1']
php: ['8.0', '8.1', '8.2']

name: PHP ${{ matrix.php }} tests
steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name" : "genkgo/xsl",
"description": "XSL 2.0 Transpiler in PHP",
"require" : {
"php" : "~8.0.0 || ~8.1.0",
"php" : "~8.0.0 || ~8.1.0 || ~8.2.0",
"ext-json" : "*",
"ext-libxml" : "*",
"ext-xsl" : "*",
Expand Down
4 changes: 2 additions & 2 deletions src/Transpiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function transpileRoot()

$result = $this->cache->get($documentURI, '');
if ($result === '') {
if ($document->doctype instanceof \DOMDocumentType && $document->doctype->entities->length > 0) {
if ($document->doctype instanceof \DOMDocumentType && $document->doctype->entities->count() > 0) {
throw new \DOMException('Invalid document, contains entities');
}

Expand Down Expand Up @@ -99,7 +99,7 @@ public function transpileFile(string $path): string
$document->resolveExternals = false;
$document->load($path);

if ($document->doctype instanceof \DOMDocumentType && $document->doctype->entities->length > 0) {
if ($document->doctype instanceof \DOMDocumentType && $document->doctype->entities->count() > 0) {
throw new \DOMException('Invalid document, contains entities');
}

Expand Down
23 changes: 0 additions & 23 deletions test/Unit/XsltProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,4 @@ public function testExcludePrefixes(): void

$this->assertSame('<p>test</p>', \trim($processor->transformToXML($xmlDoc)));
}

public function testErrorHandlerIsRestoredAfterTransformToXml(): void
{
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML('<root/>');

$xslDoc = new DOMDocument();
$xslDoc->loadXML(
'<?xml version="1.0"?>' . PHP_EOL
. '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'
);

$processor = new XsltProcessor(new NullCache());
$processor->importStyleSheet($xslDoc);

$processor->transformToXML($xmlDoc);

// test that after transformation the error is captured by the
// previous error handler and not by the one set in transformToXML
$this->expectError();
$this->expectErrorMessage('Error captured by phpunit error handler');
\trigger_error('Error captured by phpunit error handler', E_USER_ERROR);
}
}

0 comments on commit da05b91

Please sign in to comment.