Skip to content

Commit fd0918e

Browse files
authored
Merge pull request #10 from phpugph/1.0
cleaner php9 update
2 parents 9c16b28 + fec266b commit fd0918e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
],
88
"license": "MIT",
99
"require-dev": {
10+
"php-coveralls/php-coveralls": "2.5.2",
1011
"phpunit/phpunit": "9.5.21",
11-
"squizlabs/php_codesniffer": "3.7.1",
12-
"php-coveralls/php-coveralls": "2.5.2"
12+
"squizlabs/php_codesniffer": "3.7.1"
1313
},
1414
"require": {
15-
"phpugph/components": "1.0.5"
15+
"phpugph/components": "1.0.6"
1616
},
1717
"autoload": {
1818
"psr-4": {

src/HandlebarsCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class HandlebarsCompiler
4444
/**
4545
* @const string BLOCK_VARIABLE_VALUE
4646
*/
47-
const BLOCK_VARIABLE_VALUE = '\r\t$buffer .= htmlspecialchars($data->find(\'%s\'), ENT_COMPAT, \'UTF-8\');\r';
47+
const BLOCK_VARIABLE_VALUE = '\r\t$buffer .= htmlspecialchars($data->find(\'%s\') ?? \'\', ENT_COMPAT, \'UTF-8\');\r';
4848

4949
/**
5050
* @const string BLOCK_ESCAPE_HELPER_OPEN
@@ -59,7 +59,7 @@ class HandlebarsCompiler
5959
/**
6060
* @const string BLOCK_VARIABLE_HELPER_OPEN
6161
*/
62-
const BLOCK_VARIABLE_HELPER_OPEN = '\r\t$buffer .= htmlspecialchars($helper[\'%s\'](';
62+
const BLOCK_VARIABLE_HELPER_OPEN = '\r\t$buffer .= htmlspecialchars((string) $helper[\'%s\'](';
6363

6464
/**
6565
* @const string BLOCK_VARIABLE_HELPER_CLOSE

src/HandlebarsHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ public function compile($template)
7979

8080
$file = $this->cache . '/' . $this->prefix . $name . '.php';
8181
// @codeCoverageIgnoreStart
82-
if (is_dir((string) $this->cache) && file_exists($file)) {
82+
if (is_dir($this->cache ?? '') && file_exists($file)) {
8383
$callback = include($file);
8484
} else {
8585
$code = $this->resolve(HandlebarsCompiler::class, $this, $template)
8686
->compile();
8787

88-
if (is_dir((string) $this->cache)) {
88+
if (is_dir($this->cache ?? '')) {
8989
file_put_contents($file, $code);
9090
}
9191

0 commit comments

Comments
 (0)