summaryrefslogtreecommitdiffstats
path: root/0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch
blob: a8f006d27ccd58b12a2162fd8040cbf93c6f53ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From d89c051d3d24a9a96684c123207534cc5c4a58da Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 15 Jul 2024 16:03:49 +0200
Subject: [PATCH] Fix  Implicitly marking parameter $.. as nullable is
 deprecated

---
 tests/base-impl/fake-impl.php.inc     | 4 ++--
 tests/helper-with-options-union.phpt  | 2 +-
 tests/helper-with-options.phpt        | 2 +-
 tests/vm/__construct-without-psr.phpt | 8 ++++----
 tests/vm/setLogger-without-psr.phpt   | 8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/base-impl/fake-impl.php.inc b/tests/base-impl/fake-impl.php.inc
index 434e0dc..f186734 100644
--- a/tests/base-impl/fake-impl.php.inc
+++ b/tests/base-impl/fake-impl.php.inc
@@ -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 {}
 }
diff --git a/tests/helper-with-options-union.phpt b/tests/helper-with-options-union.phpt
index ac3f88c..86626bc 100644
--- a/tests/helper-with-options-union.phpt
+++ b/tests/helper-with-options-union.phpt
@@ -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());
     },
 ));
diff --git a/tests/helper-with-options.phpt b/tests/helper-with-options.phpt
index 29ed341..316add8 100644
--- a/tests/helper-with-options.phpt
+++ b/tests/helper-with-options.phpt
@@ -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));
diff --git a/tests/vm/__construct-without-psr.phpt b/tests/vm/__construct-without-psr.phpt
index a0ca724..b2a561b 100644
--- a/tests/vm/__construct-without-psr.phpt
+++ b/tests/vm/__construct-without-psr.phpt
@@ -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;
@@ -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();
diff --git a/tests/vm/setLogger-without-psr.phpt b/tests/vm/setLogger-without-psr.phpt
index 2553a3c..735e5c1 100644
--- a/tests/vm/setLogger-without-psr.phpt
+++ b/tests/vm/setLogger-without-psr.phpt
@@ -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();
-- 
2.45.2