Skip to content

Commit

Permalink
Introduce php84 support #107
Browse files Browse the repository at this point in the history
  • Loading branch information
usox committed Dec 11, 2024
1 parent 60cdcca commit 4f27b5b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
php: ['8.1', '8.2', '8.3']
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Set locales
run: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-dom": "*",
"ext-gettext": "*",
"ext-simplexml": "*",
Expand Down
62 changes: 31 additions & 31 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ private static function pathError(mixed $base, string $path, string $current, ?s
*
* @throws Exception\VariableNotFoundException
*/
public static function path(mixed $base, string $path, bool $nothrow = null): mixed
public static function path(mixed $base, string $path, bool $nothrow = false): mixed
{
if ($base === null) {
if ($nothrow) {
Expand Down
2 changes: 1 addition & 1 deletion src/Dom/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public function generateHead(CodeWriter $codewriter): void
}
}

public function generateContent(CodeWriter $codewriter, bool $realContent = null): void
public function generateContent(CodeWriter $codewriter, bool $realContent = false): void
{
if (!$this->isEmptyNode($codewriter->getOutputMode())) {
if ($realContent || count($this->contentAttributes) === 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/Dom/SaxXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function parseFile(DocumentBuilder $builder, string $src): DocumentBuilde
* @throws ParserException
* @throws TemplateException
*/
public function parseString(DocumentBuilder $builder, string $src, string $filename = null): DocumentBuilder
public function parseString(DocumentBuilder $builder, string $src, null|string $filename = null): DocumentBuilder
{
try {
$builder->setEncoding($this->input_encoding);
Expand Down
2 changes: 1 addition & 1 deletion src/PHPTAL.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function setTemplate(?string $path): PhpTalInterface
*
* @return $this
*/
public function setSource(string $src, ?string $path = null): PhpTalInterface
public function setSource(string $src, null|string $path = null): PhpTalInterface
{
$this->prepared = false;
$this->functionName = null;
Expand Down
6 changes: 3 additions & 3 deletions src/Php/CodeWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function flushHtml(): void
*
* @param bool $called_from_macro for error checking: unbuffered output doesn't support that
*/
public function doDoctype(bool $called_from_macro = null): void
public function doDoctype(bool $called_from_macro = false): void
{
if ($this->doctype) {
$code = '$ctx->setDocType(' . $this->str($this->doctype) .
Expand All @@ -284,7 +284,7 @@ public function doDoctype(bool $called_from_macro = null): void
*
* @param bool $called_from_macro for error checking: unbuffered output doesn't support that
*/
public function doXmlDeclaration(bool $called_from_macro = null): void
public function doXmlDeclaration(bool $called_from_macro = false): void
{
if ($this->xmldeclaration && $this->getOutputMode() !== PHPTAL::HTML5) {
$code = '$ctx->setXmlDeclaration(' . $this->str($this->xmldeclaration) .
Expand Down Expand Up @@ -367,7 +367,7 @@ public function doForeach(string $out, string $source): void
/**
* @throws PhpTalException
*/
public function doEnd(string $expects = null): void
public function doEnd(null|string $expects = null): void
{
if (count($this->segments) === 0) {
if ($expects === null) {
Expand Down
4 changes: 2 additions & 2 deletions src/PhpTalInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function setTemplate(string $path): self;
* Use setTemplate() or addSourceResolver() whenever possible.
*
* @param string $src The phptal template source.
* @param string $path Fake and 'unique' template path.
* @param null|string $path Fake and 'unique' template path.
*
* @return $this
*/
public function setSource(string $src, string $path = null): self;
public function setSource(string $src, null|string $path = null): self;

/**
* Specify where to look for templates.
Expand Down
2 changes: 1 addition & 1 deletion tests/ReadableErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testLocalMacroNotExists(): void
$this->assertThrowsInLine(5, 'input/error-13.html');
}

public function assertThrowsInLine(int $line, string $file, string $expected_file = null): void
public function assertThrowsInLine(int $line, string $file, null|string $expected_file = null): void
{
$tpl = null;
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/Testhelper/CountableImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CountableImpl implements Countable
{
private readonly int $cnt;

public function __construct(int $cnt = null)
public function __construct(null|int $cnt = null)
{
$this->cnt = $cnt ?? 0;
}
Expand Down

0 comments on commit 4f27b5b

Please sign in to comment.