- Made some bugfixes regarding blocks and slots
This commit is contained in:
1 parent
18a0fd7fdc
commit
48ecd9f7d9
2 files changed
+8
-6
No files matched your search
@@ -24,14 +24,13 @@ class BlockToken implements ControlStructure {
|
||||
return <<<PHP
|
||||
<?php
|
||||
try {
|
||||
extract( \$this->using ?? [], \EXTR_OVERWRITE);
|
||||
extract( \\$class::parseArguments(function($arguments) {}, \$inlineVariables), \EXTR_OVERWRITE);
|
||||
|
||||
unset(\$inlineVariables);
|
||||
}
|
||||
catch(\TypeError \$ex) {
|
||||
|
||||
throw new \Exception(
|
||||
sprintf('A block awaiting arguments `%s` instead received `%s` with values `%s`', '$arguments', implode(', ', array_map('gettype', \$inlineVariables)), json_encode(\$inlineVariables))
|
||||
sprintf('A block awaiting arguments `%s` instead received `%s` with values `%s`', '$arguments', implode(', ', array_map('gettype', \$inlineVariables)), json_encode(\$inlineVariables))
|
||||
);
|
||||
}
|
||||
?>
|
||||
@@ -72,7 +71,7 @@ class BlockToken implements ControlStructure {
|
||||
}
|
||||
|
||||
return <<<PHP
|
||||
<?php \$___block->slotIsSet($name) || \$___block->setSlot($name, function($definition array \$___using = []) use (\$picea) { extract(\$___using, \EXTR_SKIP); ?>
|
||||
<?php (\$___block ?? \$this)->slotIsSet($name) || \$___block->setSlot($name, function($definition array \$___using = []) use (\$picea) { extract(\$___using, \EXTR_SKIP); ?>
|
||||
PHP;
|
||||
}
|
||||
|
||||
@@ -131,6 +130,9 @@ class BlockToken implements ControlStructure {
|
||||
elseif ( $value->isVariadic() ) {
|
||||
$parameters[ $value->getName() ] = [];
|
||||
}
|
||||
else {
|
||||
$parameters[ $value->getName() ] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
@@ -217,7 +219,7 @@ class BlockToken implements ControlStructure {
|
||||
public function render(object $classTemplate) : string
|
||||
{
|
||||
$this->rendering = true;
|
||||
|
||||
|
||||
return $classTemplate->picea->inlineBlock($this, $this->viewPath, ...$this->arguments);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user