Questions? Forum: https://phalcon.link/forum or Discord: https://phalcon.link/discord
Describe the bug
Using these two together will give the wrong result.
Steps to reproduce the behavior:
Provide minimal script to reproduce the issue
// WRONG Result:
{% if categoryIds is defined AND category['id'] in categoryIds %}
checked
{% endif %}
// Correct Result:
{% if categoryIds is defined AND (category['id'] in categoryIds) %}
checked
{% endif %}
Expected behavior
A clear and concise description of what you expected to happen.
// WRONG RESULT
<?php if ($this->isIncluded(isset($categoryIds) && $category['id'], $categoryIds)) { ?>
checked
<php } ?>
// Correct RESULT
<?php if (isset($categoryIds) && $this->isIncluded($category['id'], $categoryIds)) { ?>
checked
<php } ?>
Screenshots
If applicable, add screenshots to help explain your problem.
Details
Confirmed, here is screenshot of generated code from volt

Details
Phalcon version: 4.0.x
PHP version: 7.4
This needs work on the PHQL parser since the right part after the && is not parsed on its own.
For now the workaround with parentheses works but the suggested syntax should work also.
Fixed in 4.0.x branch. Thank you for the report, and for helping us make Phalcon better.