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

namespaceFilter plugin is never called on global namespace #40

Open
doekia opened this issue Mar 3, 2019 · 0 comments
Open

namespaceFilter plugin is never called on global namespace #40

doekia opened this issue Mar 3, 2019 · 0 comments

Comments

@doekia
Copy link

doekia commented Mar 3, 2019

I have an old project that does not use namespace (only ) and a set of classes alias.
I'm trying to implement a namespace filter to mimic package (namespace) and class alias.
I discovered that the filter is never called. Here is a simplified scenario to reproduce the issue.

My Environment (version of the project, operating system, or hardware)

Debian 9
PhpDependencyAnalysis by Marco Muths v1.3.1
PHP 5.6.40-1+0~20190111135530.9+stretch~1.gbp5f42c9 (cli)
dot - graphviz version 2.38.0 (20140413.2041)

My phpda.yml:

mode: 'call'
source: './web'
filePattern: '*.php'
ignore: [ 'cache','test','install173','modules', 'Tests','fonts','tools', 'override' ]
formatter: 'PhpDA\Writer\Strategy\Svg'
target: './web/total0.svg'
namespaceFilter: PS\Plugin\CoreNamespaceFilter
groupLength: 2
visitor:
  - PhpDA\Parser\Visitor\TagCollector
  - PhpDA\Parser\Visitor\NamespacedStringCollector
  - PhpDA\Parser\Visitor\IocContainerAccessorCollector
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}
classMap:
  PS\Plugin\CoreNamespaceFilter: './CoreNamespaceFilter.php'

My filter

<?php

namespace PS\Plugin;

use PhpDA\Parser\Filter\NamespaceFilterInterface;

class CoreNamespaceFilter implements NamespaceFilterInterface
{

    public function filter(array $nameParts)
    {
        die(print_r($nameParts,1));
    }
}

When I run this command:

phpda analyze phpda.yml

Actual behavior:
svg is generated but filter never called
( Never die - Note that a die in the constructer works as expected - hence plugins is loaded )

Expected behavior:
filter to be called.

@doekia doekia changed the title namespaceFilter plugin is never called namespaceFilter plugin is never called on global namespace Mar 3, 2019
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

1 participant