Skip to content

Commit

Permalink
Fix Implicitly marking parameter $.. as nullable is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jul 15, 2024
1 parent d909c63 commit d89c051
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/base-impl/fake-impl.php.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class FakeImpl extends Handlebars\BaseImpl {
public function render(string $tmpl, $context = null, array $options = null): string {}
public function renderFile(string $filename, $context = null, array $options = null): string {}
public function render(string $tmpl, $context = null, ?array $options = null): string {}
public function renderFile(string $filename, $context = null, ?array $options = null): string {}
}
2 changes: 1 addition & 1 deletion tests/helper-with-options-union.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $helpers = new DefaultRegistry(array(
'testHelperWithUnionType2' => function(string $a, string|int|null $b = null) {
var_dump(func_num_args());
},
'testHelperWithUnionType3' => function(string $a, stdClass|Handlebars\Options $b = null) {
'testHelperWithUnionType3' => function(string $a, stdClass|Handlebars\Options|null $b = null) {
var_dump(func_num_args());
},
));
Expand Down
2 changes: 1 addition & 1 deletion tests/helper-with-options.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $helpers = new DefaultRegistry(array(
var_dump(gettype($b));
var_dump(get_class($b));
},
'testHelperWithInvalidArgType' => function(string $a, string $b = null) {
'testHelperWithInvalidArgType' => function(string $a, ?string $b = null) {
var_dump(func_num_args());
var_dump($a);
var_dump(gettype($b));
Expand Down
8 changes: 4 additions & 4 deletions tests/vm/__construct-without-psr.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ if( extension_loaded('psr') ) die('skip ');
namespace Psr\Log;

interface LoggerInterface {
public function log($level, $message, array $context = null);
public function log($level, $message, ?array $context = null);
}
abstract class AbstractLogger implements LoggerInterface {
public function info($message, array $context = null) { $this->log('info', $message, $context); }
public function warning($message, array $context = null) { $this->log('warning', $message, $context); }
public function info($message, ?array $context = null) { $this->log('info', $message, $context); }
public function warning($message, ?array $context = null) { $this->log('warning', $message, $context); }
}

namespace IgnoreMe;
Expand All @@ -25,7 +25,7 @@ use Handlebars\VM;
use Psr\Log\AbstractLogger;

class TestLogger extends AbstractLogger {
public function log($level, $message, array $context = null) { var_dump($level, $message); }
public function log($level, $message, ?array $context = null) { var_dump($level, $message); }
}

$helpers = new DefaultRegistry();
Expand Down
8 changes: 4 additions & 4 deletions tests/vm/setLogger-without-psr.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Handlebars\VM::setLogger() without php-psr
<?php
namespace Psr\Log;
interface LoggerInterface {
public function log($level, $message, array $context = null);
public function log($level, $message, ?array $context = null);
}
abstract class AbstractLogger implements LoggerInterface {
public function info($message, array $context = null) { $this->log('info', $message, $context); }
public function warning($message, array $context = null) { $this->log('warning', $message, $context); }
public function info($message, ?array $context = null) { $this->log('info', $message, $context); }
public function warning($message, ?array $context = null) { $this->log('warning', $message, $context); }
}

namespace Invalid;
use Psr\Log\AbstractLogger;
use Handlebars\VM;
class TestLogger extends AbstractLogger {
public function log($level, $message, array $context = null) { var_dump($level, $message); }
public function log($level, $message, ?array $context = null) { var_dump($level, $message); }
}
$logger = new TestLogger();
$vm = new VM();
Expand Down

0 comments on commit d89c051

Please sign in to comment.