Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: eqq (===) and nee (!==) operators #94

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> (厳密に等しい)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea how to validate this change 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trust me bro, ai and Google gave me the same result :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't trust either of those sources :-P

</para></listitem>
<listitem><para>
<code>!=</code> : <code>NE</code> (等しくない)
</para></listitem>
<listitem><para>
<code>!==</code> : <code>NEE</code> (厳密に等しくない)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea how to validate this change 😁

</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();
}
}

Loading