I am trying to run PHP CS Fixer, which I believe is based on Symfony (which I am not familiar with), and having a problem with excluding some paths.
My setup is below:
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('lib/adodb')
->exclude('lib/bbcode')
->exclude('lib/joomla')
->exclude('lib/JSON')
->exclude('lib/pear')
->exclude('lib/phpass')
->exclude('lib/smarty')
->exclude('lib/smtp')
->exclude('modules/*/lib')
->name('*.class')
->name('*.inc')
->name('*.php')
;
Basically, I will like to exclude:
modules/ANYNAME/lib/ANYFILE
modules/ANYNAME/lib/ANYSUBDIR/ANYFILE
But I find that the ->exclude('modules/*/lib')
line is not catching these. For instance, modules/somemodule/lib/somefile.inc
is still processed.
I had thought that this was because I had ->name('*.inc')
but it seems to happen with or without that line.
The other excludes work fine except the ->exclude('modules/*/lib')
one.
Any pointers?
** Correction/Update **
It does seem that the issue is with the name selector. Seems it is not allowed to select *.inc
using name
for instance and then try to exclude those found in modules/xyz/lib
.
Overcoming this would solve my issue
notPath()
method api.symfony.com/3.2/Symfony/Component/Finder/… Would it work ? – Aggrievedname
selector. Seems it is not allowed to select*.inc
usingname
for instance and then try to exclude those found inmodules/xyz/lib
– Danasmodules
? – Terrie