-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.php-cs-fixer.dist.php
More file actions
63 lines (56 loc) · 2.12 KB
/
Copy path.php-cs-fixer.dist.php
File metadata and controls
63 lines (56 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php declare(strict_types=1);
/**
* Votifier PHP Client
*
* @package Votifier Client
* @author Manuele Vaccari <dev@d3strukt0r.dev>
* @copyright Copyright (c) 2015-2020, 2026 Manuele Vaccari <dev@d3strukt0r.dev>
* @license https://github.com/Team-MaRo/votifier-client-php/blob/master/LICENSE.txt MIT License
* @link https://github.com/Team-MaRo/votifier-client-php
*/
require_once __DIR__.'/vendor/autoload.php';
use IWFWeb\CodingStandard\IWFWebStandardRiskySet;
use IWFWeb\CodingStandard\IWFWebStandardSet;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
preg_match(
'/Copyright \(c\) ([0-9][0-9,\s-]*[0-9])\s+(.+)/',
(string) file_get_contents(__DIR__.'/LICENSE.txt'),
$copyright,
);
[, $years, $name] = $copyright;
$email = json_decode((string) file_get_contents(__DIR__.'/composer.json'), true)['authors'][0]['email'];
$header = <<<EOF
Votifier PHP Client
@package Votifier Client
@author {$name} <{$email}>
@copyright Copyright (c) {$years} {$name} <{$email}>
@license https://github.com/Team-MaRo/votifier-client-php/blob/master/LICENSE.txt MIT License
@link https://github.com/Team-MaRo/votifier-client-php
EOF;
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/index.rst
return (new Config())
->registerCustomRuleSets([
new IWFWebStandardSet(),
new IWFWebStandardRiskySet(),
])
->setFinder(Finder::create()
->in(__DIR__)
->ignoreDotFiles(false)
->ignoreVCSIgnored(true),
)
->setRiskyAllowed(true)
->setRules([
'@IWFWeb/standard' => true,
'@IWFWeb/standard:risky' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
],
// The library targets PHP 7.1, so only arrays may carry a trailing comma
// in multiline (valid since PHP 5). Trailing commas in function calls
// (PHP 7.3+) and declarations (PHP 8.0+) would break parsing on 7.1.
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
])
;