Skip to content

Commit

Permalink
Merge pull request #94 from jacekkarczmarczyk/feat/#93-eqq-nee
Browse files Browse the repository at this point in the history
feat: eqq (===) and nee (!==) operators
  • Loading branch information
Ocramius authored Apr 17, 2024
2 parents 5f4eb21 + 41eac92 commit 9d0a1eb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion classes/PHPTAL/Php/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ private static function isVarNameChar($c)
private static $TranslationTable = array(
'not' => '!',
'ne' => '!=',
'nee' => '!==',
'and' => '&&',
'or' => '||',
'lt' => '<',
'gt' => '>',
'ge' => '>=',
'le' => '<=',
'eq' => '==',
'eqq' => '===',
);
}

6 changes: 6 additions & 0 deletions doc/de/book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1452,9 +1452,15 @@ this page has been readed ${page/countRead} times"/>
<listitem><para>
<code>==</code> : <code>EQ</code> (gleich)
</para></listitem>
<listitem><para>
<code>===</code> : <code>EQQ</code> (exakt gleich)
</para></listitem>
<listitem><para>
<code>!=</code> : <code>NE</code> (ungleich)
</para></listitem>
<listitem><para>
<code>!==</code> : <code>NEE</code> (exakt ungleich)
</para></listitem>
<listitem><para>
<code>&amp;&amp;</code> : <code>AND</code>
</para></listitem>
Expand Down
6 changes: 6 additions & 0 deletions doc/en/book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1517,9 +1517,15 @@ this page has been readed ${page/countRead} times"/>
<code>==</code> : <code>EQ</code> (equal)
</para></listitem>
<listitem><para>
<code>===</code> : <code>EQQ</code> (strictly equal)
</para></listitem>
<listitem><para>
<code>!=</code> : <code>NE</code> (not equal)
</para></listitem>
<listitem><para>
<code>!=</code> : <code>NEE</code> (strictly not equal)
</para></listitem>
<listitem><para>
<code>&amp;&amp;</code> : <code>AND</code>
</para></listitem>
<listitem><para>
Expand Down
6 changes: 6 additions & 0 deletions doc/ja/book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,15 @@ this page has been readed ${page/countRead} times"/>
<code>==</code> : <code>EQ</code> (等しい)
</para></listitem>
<listitem><para>
<code>===</code> : <code>EQQ</code> (厳密に等しい)
</para></listitem>
<listitem><para>
<code>!=</code> : <code>NE</code> (等しくない)
</para></listitem>
<listitem><para>
<code>!==</code> : <code>NEE</code> (厳密に等しくない)
</para></listitem>
<listitem><para>
<code>&amp;&amp;</code> : <code>AND</code>
</para></listitem>
<listitem><para>
Expand Down
6 changes: 6 additions & 0 deletions doc/ru/book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,15 @@ this page has been readed ${page/countRead} times"/>
<code>==</code> : <code>EQ</code> (equal)
</para></listitem>
<listitem><para>
<code>===</code> : <code>EQQ</code> (strictly equal)
</para></listitem>
<listitem><para>
<code>!=</code> : <code>NE</code> (not equal)
</para></listitem>
<listitem><para>
<code>!==</code> : <code>NEE</code> (strictly not equal)
</para></listitem>
<listitem><para>
<code>&amp;&amp;</code> : <code>AND</code>
</para></listitem>
<listitem><para>
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ function testKeywords()
{
$this->assertEquals('true != false', PHPTAL_Php_Transformer::transform('true ne false'));
$this->assertEquals('$test == null', PHPTAL_Php_Transformer::transform('test eq null'));
$this->assertEquals('true !== false', PHPTAL_Php_Transformer::transform('true nee false'));
$this->assertEquals('$test === null', PHPTAL_Php_Transformer::transform('test eqq null'));
}

function testTernaryOperator()
Expand Down Expand Up @@ -188,4 +190,3 @@ function testCatchesInvalidNumber2()
$tpl->execute();
}
}

0 comments on commit 9d0a1eb

Please sign in to comment.