Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
],
"license": "MIT",
"require-dev": {
"php-coveralls/php-coveralls": "2.5.2",
"phpunit/phpunit": "9.5.21",
"squizlabs/php_codesniffer": "3.7.1",
"php-coveralls/php-coveralls": "2.5.2"
"squizlabs/php_codesniffer": "3.7.1"
},
"require": {
"phpugph/components": "1.0.5"
"phpugph/components": "1.0.6"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/HandlebarsCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HandlebarsCompiler
/**
* @const string BLOCK_VARIABLE_VALUE
*/
const BLOCK_VARIABLE_VALUE = '\r\t$buffer .= htmlspecialchars($data->find(\'%s\'), ENT_COMPAT, \'UTF-8\');\r';
const BLOCK_VARIABLE_VALUE = '\r\t$buffer .= htmlspecialchars($data->find(\'%s\') ?? \'\', ENT_COMPAT, \'UTF-8\');\r';

/**
* @const string BLOCK_ESCAPE_HELPER_OPEN
Expand All @@ -59,7 +59,7 @@ class HandlebarsCompiler
/**
* @const string BLOCK_VARIABLE_HELPER_OPEN
*/
const BLOCK_VARIABLE_HELPER_OPEN = '\r\t$buffer .= htmlspecialchars($helper[\'%s\'](';
const BLOCK_VARIABLE_HELPER_OPEN = '\r\t$buffer .= htmlspecialchars((string) $helper[\'%s\'](';

/**
* @const string BLOCK_VARIABLE_HELPER_CLOSE
Expand Down
4 changes: 2 additions & 2 deletions src/HandlebarsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public function compile($template)

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

if (is_dir((string) $this->cache)) {
if (is_dir($this->cache ?? '')) {
file_put_contents($file, $code);
}

Expand Down