PhpDependencyAnalysis icon indicating copy to clipboard operation
PhpDependencyAnalysis copied to clipboard

Syntax error thrown due to invalid subgraph groupid

Open buddh4 opened this issue 4 years ago • 0 comments

My Environment

  • Windows 10
  • Tested with
    • PHP 7.3 => phpda v2.0.2
    • PHP 7.2 => phpda v1.3.1
  • GraphViz 2.44: (https://ci.appveyor.com/project/ellson/graphviz-pl238/builds/32032002)
  • Composer installation

My phpda.yml:

mode: 'usage'
source: 'src'
filePattern: '*.php'
ignore: 'tests'
formatter: 'PhpDA\Writer\Strategy\Svg'
target: './phpda.svg'
groupLength: 1
visitor:
  - PhpDA\Parser\Visitor\TagCollector
  - PhpDA\Parser\Visitor\SuperglobalCollector
visitorOptions:
  PhpDA\Parser\Visitor\Required\DeclaredNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\Required\MetaNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\Required\UsedNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\TagCollector: {minDepth: 2, sliceLength: 2}

When I run this command:

.\vendor\bin\phpda.bat analyze phpda.yml

Actual behavior:

Error:

Write dependency graph to C:\xxx\./phpda.svg
Error: C:\xxx\AppData\Local\Temp\graE965.tmp: syntax error in line 3 near '-1'

Temp file:

digraph {
  graph [rankdir="LR" ranksep=1 nodesep=0.1 fontsize=8 label="PhpDependencyAnalysis by Marco Muths (dev-master)"]
  subgraph cluster_-1 {
...

It seems that graphviz does not accept group ids like subgraph cluster_-1:

When I remove the *-1 in https://github.com/mamuz/PhpDependencyAnalysis/blob/v2.0.2/src/Layout/Helper/GroupGenerator.php#L97 everything works fine.

buddh4 avatar Jun 05 '20 20:06 buddh4