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

Please do not silently drop unknown argument types in PhpNodeVisitor #5

Closed
rgpublic opened this issue Nov 18, 2019 · 3 comments
Closed

Comments

@rgpublic
Copy link

Currently there is:
default: $function->addArgument();
So, if the argument is not Scalar_String, Scalar_LNumber or Scalar_DNumber then the argument is silently discarded. It would be very helpful if the class could at least call an empty protected method so that a child class can then decide what happens with that argument without completely overriding createFunction(). Drupal has the following syntax to supply context info: t("Translatable string","",["context"=>"Context string"]); Unfortunately the array type in the 3rd argument is discarded and there's no easy way to get to it even in a child class.

@oscarotero
Copy link
Member

Ok, fair enough.
I've added the ability to handle not only scalar values but also arrays. Could you test it to know if it can be adapted to Drupal before release a new version?

@rgpublic
Copy link
Author

Yes, I just tested this. It works and it is incredibly helpful. A huge improvement in contrast to the 4.x version where I had to include a full-fledged PHP-array token parser. Hundered of crazy code lines => gone! Amazing. Would be very happy if you could include this change in the next release.

@oscarotero
Copy link
Member

v1.1.0 released including this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants