mamuz / PhpDependencyAnalysis

Static code analysis to find violations in a dependency graph
http://mamuz.github.io/PhpDependencyAnalysis/
MIT License
561 stars 45 forks source link

Is there way to ignore built-in functions? #32

Closed Soufraz closed 7 years ago

mamuz commented 7 years ago

Can you give me an example?

mamuz commented 7 years ago

When you are talking about PHP built-in functions, such as in_array(), you can use your own NamespaceFilter plugin to return an empty array in this case. Please check the manual https://github.com/mamuz/PhpDependencyAnalysis/wiki/5.-Plugins , the example https://github.com/mamuz/PhpDependencyAnalysis/wiki/4.-Examples#usage-graph-on-package-level-with-a-namespacefilter and the test stub https://github.com/mamuz/PhpDependencyAnalysis/blob/master/tests/_data/Plugin/NamespaceFilter.php

mamuz commented 7 years ago

@Soufraz Did my answer help you?

Soufraz commented 7 years ago

Sorry, I did not test yet. So, if I remember the generator was getting all php functions in the classes. But I'll try the filter suggested above .. Thanks!

daudtacto commented 3 years ago

@mamuz @Soufraz Can you please help me understand how should I remove the inbuilt PHP functions and dependencies? I tried performing NameSpaceFilter which suggested above but it didn't happen. I running PhpDA on docker with the following configuration. Really appreciated it if you can help me remove PHP global functions and inbuilt one. mode: 'call' source: '../src/Controller' filePattern: 'ContactsController.php' ignore: 'tests' formatter: 'PhpDA\Writer\Strategy\Svg' target: './namespace-filter.svg' namespaceFilter: 'MyDomain\Plugin\NamespaceFilter' visitor:

FallDi commented 3 years ago

+1 I believe that exclude built-in functions feature is highly demanded