Skip to content

This modules LESS Analyzer class cannot handle LESS files which use @import url() on css files #73

Open
@furan917

Description

When using this tool it was discovered that if you have a module that uses an @import url() on a css file the analyzer would break with the following error:

PHP Fatal error:  Uncaught Error: Object of class Less_Tree_Quoted could not be converted to string in magento-semver/src/Analyzer/Less/Analyzer.php:131

Take for example if your branch(es) included AdminAdobeIms which does this here.

The reason behind this is because when parsing over the modules content it converts the import to a Link_Tree_Import which is comprised of a Link_Tree_Uri as the path and a Link_Tree_Quoted as the value.

This means that the check done here is not sufficient enough to handle it.

You could handle it by adding another guard check near the top of the foreach (or expanding the current one)

                    if ($node instanceof Less_Tree_Import) {
                        continue;
                    }

or specifically handle the nodeKey set with something like

                        if ($node->path->value instanceof \Less_Tree_Quoted || property_exists($node->path->value, 'value')) {
                            $nodeKey = $node->type . ' with value: \'' . $node->path->value->value . '\'';
                        } else {
                            $nodeKey = $node->type . ' with value: \'' . $node->path->value . '\'';
                        }

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions