aleksip / plugin-data-transform

Data Transform Plugin for Pattern Lab PHP
GNU General Public License v2.0
34 stars 10 forks source link

1.3.1 Update causes deprecation warnings in console on build #30

Closed krisimmig closed 5 years ago

krisimmig commented 5 years ago

I am including some components with the include() syntax in the corresponding yaml file like so:

---
nav:
  include():
    pattern: template-components-navigation

The build seems to work, all patterns can be rendered but I get a lot of warnings now:

[data transform plugin] pattern templates-page
  error rendering template-components-navigation
  The Twig\Node\Node::getLine method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.

Any idea on how to fix this? Not something that brakes the workflow but this did't happen with version 1.3.0

aleksip commented 5 years ago

Thanks for reporting this. 'Improved' error handling and messages was (the only thing) added in 1.3.1, so until there is a way to make it a little less noisy you can downgrade to 1.3.0.

That is actually not an error, just a deprecation notice not shown before, so your build should indeed be just fine.

krisimmig commented 5 years ago

Ok, thanks for the quick reply.

aleksip commented 5 years ago

Actually, let's keep this issue open, easier to find in case someone else wonders about this.

The plugin already supports a verbosity level setting, so I will probably extend that in some way so users can choose which type of messages they want to see. Will close this issue when 1.3.2 is out!

aleksip commented 5 years ago

@krisimmig Well, I ended up with updates worthy of a 1.4.0 release, which I will publish soon. 😊

The updates are in the develop branch, so if you have time to test the development version, and also the improved verbose mode, that would be much appreciated!

krisimmig commented 5 years ago

Hi @aleksip, I just tested the develop branch and it looks good.

aleksip commented 5 years ago

@krisimmig Thanks a lot for testing!

If using include() the plugin should display an error for a missing template, like this:

[data transform plugin] could not find 'this-pattern-does-not-exist' to include

In non-verbose mode there will also be a PHP Notice: Array to string conversion with a long stack trace, so the plugin message might be easy to miss. Verbose mode provides information about the pattern (data file) that contains the include() and leaves out the stack trace, so it should be easier to read.

If just using the short key-value include syntax without include() the plugin does not really know if you are trying to include a template or just want a string value. But the problem should be relatively easy to spot from the generated Pattern Lab site.

So basically the idea is that if you get any kind of errors, you can then turn on verbose mode to help debug the problem.

aleksip commented 5 years ago

1.4.0 now released!