Comments (9)
I'm having the same problem. Running php-cs-fixer locally works as a charm (php 7.4) but in this container it fails with the preg_match error. You can reproduce this by cloning this repository: https://github.com/roy-bongers/certbot-transip-dns-01-validator and then running docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest
The problem disappears when I comment out ->name(['auth-hook', 'cleanup-hook', '*.php'])
This is my config:
<?php
$finder = Symfony\Component\Finder\Finder::create()
->in(__DIR__)
->exclude(['config', 'docs', 'logs', 'vendor'])
->name(['auth-hook', 'cleanup-hook', '*.php'])
->ignoreDotFiles(true)
->ignoreVCS(true);
return PhpCsFixer\Config::create()
->setRules(
[
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'trailing_comma_in_multiline_array' => true,
'increment_style' => ['style' => 'post'],
'concat_space' => ['spacing' => 'one'],
'single_line_throw' => false,
]
)->setFinder($finder);
Edit: I've fixed it by not using an array syntax for ->name() but calling ->name multiple times. I don't understand why but it fixes my problem. Array's should be supported though: https://symfony.com/doc/current/components/finder.html
Solution:
$finder = Finder::create()
->in(__DIR__)
->exclude(['config', 'docs', 'logs', 'vendor'])
->name('auth-hook')
->name('cleanup-hook')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
from php-cs-fixer-ga.
Hi, please have a look at the second example in the README file. If this fixes your issue please donβt forget to come back an close this issue. Thanks.
from php-cs-fixer-ga.
I have update the workflow to refer my config, as shown below:-
PHP CS Fixer 2.16.3 Yellow Bird by Fabien Potencier and Dariusz Ruminski (83baf82)
Loaded config default from ".php_cs".
But the error message remains:-
In MultiplePcreFilterIterator.php line 86:
preg_match() expects parameter 2 to be string, array given
from php-cs-fixer-ga.
Can you please post your config of PHP-CS-Fixer ?
from php-cs-fixer-ga.
Here's mine.
<?php
use PhpCsFixer\Finder;
use PhpCsFixer\Config;
// Directories to exclude when fixing files.
$exclude = [
'bootstrap/cache',
'vendor',
'storage',
'node_modules',
'nbproject',
];
// Filename patterns to exclude when fixing files.
$notName = [
'*.md',
'*.yml',
'*.xml',
'_ide_helper.php',
'_ide_helper_models.php',
'.phpstorm.meta.php'
];
// Default rules set to use when fixing files.
// See : https://gistlog.co/sixlive/2862a2185c76988838acaa45687a575c
$rules = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'no_blank_lines_after_phpdoc' => true,
'no_extra_blank_lines' => [
'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'],
],
'no_multiline_whitespace_before_semicolons' => true,
'no_short_echo_tag' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'not_operator_with_successor_space' => true,
'ordered_imports' => [
'sortAlgorithm' => 'length',
],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_indent' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_var_without_name' => true,
'single_quote' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
];
// Instantiate finder.
$finder = Finder::create()
->in(getcwd())
->exclude($exclude)
->name('*.php')
->notName($notName)
->ignoreDotFiles(true)
->ignoreVCS(true);
// Instantiate & return config.
return Config::create()
->setFinder($finder)
->setRules($rules);
from php-cs-fixer-ga.
@OskarStark @rognales I have the same problem and the same configuration. Any ideas/updates on this?
from php-cs-fixer-ga.
The problem seems to be the notName()
function.
from php-cs-fixer-ga.
Hi, thanks for coming back, I am really not sure if this should be supported to PHP-Cs-Fixer team π€
@localheinz, do you have any clue?
from php-cs-fixer-ga.
No idea at the moment!
from php-cs-fixer-ga.
Related Issues (20)
- Can we ignore some file or folders ? HOT 1
- Manifest for oskarstark/php-cs-fixer-ga:null HOT 11
- PHP 8.3 HOT 1
- Regression in 3.26.0 update HOT 2
- Check only changed files in PR HOT 5
- ##[error]Docker run failed with exit code 1 HOT 3
- Versioning HOT 1
- Integration with Prettier HOT 2
- Failure with 2.18.6 HOT 8
- 3.0.0-rc.1 failing tests HOT 1
- Look just on the pushed files HOT 3
- Finder.php error HOT 1
- actually fix cs via github action HOT 10
- Not working on ubuntu-22.04 HOT 5
- 3.9.0 released HOT 3
- Syntax issue on 3.14.2 HOT 1
- You must call one of in() or append() methods before iterating over a Finder HOT 5
- Please add tag for v3.22.0 HOT 2
- Build images for other architectures HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-cs-fixer-ga.