ergebnis / php-cs-fixer-config-template
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * Copyright (c) 2019-2021 Andreas Möller
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE.md file that was distributed with this source code.
10
 *
11
 * @see https://github.com/ergebnis/php-cs-fixer-config-template
12
 */
13

14
namespace Ergebnis\PhpCsFixer\Config\RuleSet;
15

16
use Ergebnis\PhpCsFixer\Config\RuleSet;
17

18
/**
19
 * @internal
20
 */
21
abstract class AbstractRuleSet implements RuleSet
22
{
23
    /**
24
     * @var string
25
     */
26
    protected $name = '';
27

28
    /**
29
     * @var array<string, array|bool>
30
     */
31
    protected $rules = [];
32

33
    /**
34
     * @var int
35
     */
36
    protected $targetPhpVersion = 0;
37

38 1
    final public function __construct(?string $header = null)
39
    {
40 1
        if (null === $header) {
41 1
            return;
42
        }
43

44 1
        $this->rules['header_comment'] = [
45 1
            'comment_type' => 'PHPDoc',
46 1
            'header' => \trim($header),
47 1
            'location' => 'after_declare_strict',
48 1
            'separate' => 'both',
49
        ];
50
    }
51

52 1
    final public function name(): string
53
    {
54 1
        return $this->name;
55
    }
56

57 1
    final public function rules(): array
58
    {
59 1
        return $this->rules;
60
    }
61

62 1
    final public function targetPhpVersion(): int
63
    {
64 1
        return $this->targetPhpVersion;
65
    }
66
}

Read our documentation on viewing source code .

Loading