Skip to content

Commit

Permalink
feat: eqq (===) and nee (!==) operators
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekkarczmarczyk committed Apr 17, 2024
1 parent 5f4eb21 commit 41eac92
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 41eac92

Please sign in to comment.