Skip to content

Commit

Permalink
Fix compatibility by removing type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 24, 2024
1 parent 77af09b commit 2131462
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 39 deletions.
14 changes: 7 additions & 7 deletions src/main/php/com/handlebarsjs/BlockNode.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class BlockNode extends Node {
/**
* Creates a new section node
*
* @param string $name
* @param var[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string $name
* @param var[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($name, $options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($name, $options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
$this->name= $name;
$this->options= $options;
$this->fn= $fn ?? new NodeList();
Expand Down
12 changes: 6 additions & 6 deletions src/main/php/com/handlebarsjs/EachBlockHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class EachBlockHelper extends BlockNode {
/**
* Creates a new with block helper
*
* @param string[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
parent::__construct('each', $options, $fn, $inverse, $start, $end);
$this->params= isset($options[1]) ? cast($options[1], BlockParams::class)->names : [];
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/php/com/handlebarsjs/HandlebarsEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ static function __static() {
];
}

/** Create new instance and initialize builtin helpers */
public function __construct(HandlebarsParser $parser= null) {
/**
* Create new instance and initialize builtin helpers
*
* @param ?com.handlebarsjs.HandlebarsParser $parser
*/
public function __construct($parser= null) {
$this->parser= $parser ?? new HandlebarsParser();
$this->templates= new Templates();
$this->helpers= self::$builtin;
Expand Down
12 changes: 6 additions & 6 deletions src/main/php/com/handlebarsjs/IfBlockHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class IfBlockHelper extends BlockNode {
/**
* Creates a new with block helper
*
* @param string[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
parent::__construct('if', $options, $fn, $inverse, $start, $end);
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/php/com/handlebarsjs/PartialBlockHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class PartialBlockHelper extends BlockNode {
/**
* Creates a new with block helper
*
* @param string[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
$template= (string)array_shift($options);
parent::__construct($template, $options, $fn, $inverse, $start, $end);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/php/com/handlebarsjs/UnlessBlockHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class UnlessBlockHelper extends BlockNode {
/**
* Creates a new with block helper
*
* @param string[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
parent::__construct('unless', $options, $fn, $inverse, $start, $end);
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/php/com/handlebarsjs/WithBlockHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class WithBlockHelper extends BlockNode {
/**
* Creates a new with block helper
*
* @param string[] $options
* @param com.github.mustache.NodeList $fn
* @param com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
* @param string[] $options
* @param ?com.github.mustache.NodeList $fn
* @param ?com.github.mustache.NodeList $inverse
* @param string $start
* @param string $end
*/
public function __construct($options= [], NodeList $fn= null, NodeList $inverse= null, $start= '{{', $end= '}}') {
public function __construct($options= [], $fn= null, $inverse= null, $start= '{{', $end= '}}') {
parent::__construct('with', $options, $fn, $inverse, $start, $end);
$this->alias= isset($options[1]) ? cast($options[1], BlockParams::class)->names[0] : null;
}
Expand Down

0 comments on commit 2131462

Please sign in to comment.