Skip to content

Commit e82d30d

Browse files
authored
remove unused imports using php-cs-fixer (#562)
1 parent 975b1ff commit e82d30d

21 files changed

+2900
-1080
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ deployment/**/*
2828
!deployment/templates_overrides/README.md
2929

3030
.phpunit.result.cache
31+
.php-cs-fixer.cache
3132

3233
node_modules
3334
# copied from node_modules using the copy-files-from-to NPM package

.php-cs-fixer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
8+
9+
return (new Config())
10+
->setParallelConfig(ParallelConfigFactory::detect()) // @TODO 4.0 no need to call this manually
11+
->setRules(["no_unused_imports" => true])
12+
// by default, Fixer looks for `*.php` files excluding `./vendor/`
13+
->setFinder((new Finder())->in(__DIR__)->exclude([__DIR__ . "/resources/lib/phpopenldaper"]));

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ repos:
4949
(?x)^(
5050
resources/mail/user_flag_.*\.php|
5151
)$
52+
- id: php-cs-fixer
53+
name: PHP CS Fixer
54+
entry: ./vendor/bin/php-cs-fixer fix
55+
language: system
56+
files: \.php$
57+
pass_filenames: false
5258

5359
- repo: https://github.com/rbubley/mirrors-prettier
5460
rev: v3.6.2

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"robiningelbrecht/phpunit-coverage-tools": "<2",
1111
"squizlabs/php_codesniffer": "*",
1212
"phpstan/phpstan": "^2.1",
13-
"rawr/phpunit-data-provider": "^3.3"
13+
"rawr/phpunit-data-provider": "^3.3",
14+
"friendsofphp/php-cs-fixer": "^3.92"
1415
},
1516
"config": {
1617
"platform": {

0 commit comments

Comments
 (0)