Skip to content

Commit

Permalink
Merge pull request #19 from theodorejb/fix-template-types
Browse files Browse the repository at this point in the history
Fix incorrect PHPDoc type and remove unused property
  • Loading branch information
sam-osborne authored Jan 10, 2023
2 parents 2a60abc + e367327 commit 43896f6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
name: PHPUnit

on: [push]
on: [push, pull_request]

jobs:
build:

name: Run tests on ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]

steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Composer Install
run: composer install
Expand Down
24 changes: 11 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="Handlebars Test suite">
<directory>tests/Handlebars/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Handlebars Test suite">
<directory>tests/Handlebars/</directory>
</testsuite>
</testsuites>
</phpunit>
12 changes: 2 additions & 10 deletions src/Handlebars/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Template
*/
protected $handlebars;


protected $tree = [];

protected $source = '';
Expand All @@ -36,7 +35,6 @@ class Template
* @var array Run stack
*/
private $stack = [];
private $_stack = [];

/**
* Handlebars template constructor
Expand All @@ -51,7 +49,6 @@ public function __construct(Handlebars $engine, $tree, $source)
$this->tree = $tree;
$this->source = $source;
array_push($this->stack, [0, $this->getTree(), false]);

}

/**
Expand Down Expand Up @@ -87,14 +84,12 @@ public function getEngine()
/**
* set stop token for render and discard method
*
* @param string $token token to set as stop token or false to remove
* @param string|false $token token to set as stop token or false to remove
*
* @return void
*/

public function setStopToken($token)
{
$this->_stack = $this->stack;
$topStack = array_pop($this->stack);
$topStack[2] = $token;
array_push($this->stack, $topStack);
Expand All @@ -103,9 +98,8 @@ public function setStopToken($token)
/**
* get current stop token
*
* @return string|bool
* @return string|false
*/

public function getStopToken()
{
return end($this->stack)[2];
Expand Down Expand Up @@ -192,8 +186,6 @@ public function render($context)
/**
* Discard top tree
*
* @param mixed $context current context
*
* @return string
*/
public function discard()
Expand Down

0 comments on commit 43896f6

Please sign in to comment.