File tree Expand file tree Collapse file tree 5 files changed +84
-0
lines changed
vendor-bin/coding-standard Expand file tree Collapse file tree 5 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Lint php-cs
2
+
3
+ on : pull_request
4
+
5
+ permissions :
6
+ contents : read
7
+
8
+ concurrency :
9
+ group : lint-php-cs-${{ github.head_ref || github.run_id }}
10
+ cancel-in-progress : true
11
+
12
+ jobs :
13
+ lint :
14
+ runs-on : ubuntu-latest
15
+ strategy :
16
+ matrix :
17
+ php :
18
+ - " 8.1"
19
+ - " 8.2"
20
+ - " 8.3"
21
+ - " 8.4"
22
+
23
+ name : php-cs
24
+
25
+ steps :
26
+ - name : Checkout
27
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28
+ with :
29
+ persist-credentials : false
30
+
31
+ - name : Set up php${{ matrix.php }}
32
+ uses : shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
33
+ with :
34
+ php-version : ${{ matrix.php }}
35
+ coverage : none
36
+ ini-file : development
37
+
38
+ - name : Get composer cache directory
39
+ id : composer-cache
40
+ run : echo "::set-output name=dir::$(composer config cache-files-dir)"
41
+
42
+ - name : Cache composer cache
43
+ uses : actions/cache@v4
44
+ with :
45
+ path : ${{ steps.composer-cache.outputs.dir }}
46
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
47
+ restore-keys : ${{ runner.os }}-composer-
48
+
49
+ - name : Install dependencies
50
+ run : composer install
51
+
52
+ - name : Lint
53
+ run : composer cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ composer.lock
3
3
/vendor /
4
4
/vendor-bin /** /vendor /
5
5
* .swp
6
+ .php-cs-fixer.cache
6
7
.phpunit.result.cache
7
8
/tests /logs
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ require_once './vendor-bin/coding-standard/vendor/autoload.php ' ;
6
+
7
+ use PhpCsFixer \Config ;
8
+ use PhpCsFixer \Runner \Parallel \ParallelConfigFactory ;
9
+
10
+ $ config = new Config ();
11
+ $ config
12
+ ->setParallelConfig (ParallelConfigFactory::detect ())
13
+ ->getFinder ()
14
+ ->ignoreVCSIgnored (true )
15
+ ->notPath ('vendor ' )
16
+ ->notPath ('vendor-bin ' )
17
+ ->in (__DIR__ );
18
+ return $ config ;
Original file line number Diff line number Diff line change 31
31
"scripts" : {
32
32
"bin" : " echo 'bin not installed'" ,
33
33
"lint" : " find . -name \\ *.php -not -path './vendor/*' -not -path './vendor-bin/*' -print0 | xargs -0 -n1 php -l" ,
34
+ "cs:check" : " php-cs-fixer fix --dry-run --diff" ,
35
+ "cs:fix" : " php-cs-fixer fix" ,
34
36
"post-install-cmd" : [
35
37
" @composer bin all install --ansi" ,
36
38
" composer dump-autoload"
Original file line number Diff line number Diff line change
1
+ {
2
+ "require-dev" : {
3
+ "friendsofphp/php-cs-fixer" : " ^3.86"
4
+ },
5
+ "config" : {
6
+ "platform" : {
7
+ "php" : " 8.1"
8
+ }
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments