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

Issue with literal annotation for here-doc strings #1789

Closed
aldem opened this Issue Aug 13, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@aldem
Copy link

aldem commented Aug 13, 2018

Hi,

When working with DBI, I often use construction like:

$st = $db->prepare(<<__SQL);
SELECT * FROM ...
__SQL

When here-doc is used in this style (as argument or member of a list), it is not recognised by @inject annotation (it is even worse if there is more than one of them).

Word "SQL" in delimiter is not recognized as injection language as it starts with underscores (which really helps to visually highlight here-docs start/end).

It would be really nice either to allow @inject to annotate such construction or to ignore non-letters and underscores in delimiter when trying to match injected language, or (probably even better) only try to match last word (letters only) in delimiter string.

Thank you!

@hurricup hurricup added the Injections label Aug 15, 2018

@elcamlost

This comment has been minimized.

Copy link
Contributor

elcamlost commented Sep 25, 2018

@hurricup I faced similar issue. My colleague uses lowercase to define injections via here doc, something like


$db->query(<<~\sql, $entity->id);
            select * from table where true
                and id = ?
            sql

As far as I can understand, injection list is defined here and is not configurable at all.

Maybe it will be a good feature, to configure bindings between inject keyword and language, supported by IDEA? And current settings will be used as a default.

@hurricup hurricup added the Feature label Sep 25, 2018

@hurricup

This comment has been minimized.

Copy link
Collaborator

hurricup commented Sep 25, 2018

Ye, good point.

hurricup added a commit that referenced this issue Oct 14, 2018

@hurricup hurricup added this to the 2018.3 milestone Oct 14, 2018

@hurricup hurricup closed this in 3d2202a Oct 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment