• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHP-CS-Fixer / PHP-CS-Fixer / 3721300657

pending completion
3721300657

push

github

GitHub
minor: Follow PSR12 ordered imports in Symfony ruleset (#6712)

9 of 9 new or added lines in 2 files covered. (100.0%)

22674 of 24281 relevant lines covered (93.38%)

39.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Documentation/DocumentationLocator.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <fabien@symfony.com>
9
 *     Dariusz RumiƄski <dariusz.ruminski@gmail.com>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14

15
namespace PhpCsFixer\Documentation;
16

17
use PhpCsFixer\Fixer\FixerInterface;
18
use PhpCsFixer\Preg;
19
use PhpCsFixer\Utils;
20

21
/**
22
 * @internal
23
 */
24
final class DocumentationLocator
25
{
26
    private string $path;
27

28
    public function __construct()
29
    {
30
        $this->path = \dirname(__DIR__, 2).'/doc';
×
31
    }
32

33
    public function getFixersDocumentationDirectoryPath(): string
34
    {
35
        return $this->path.'/rules';
×
36
    }
37

38
    public function getFixersDocumentationIndexFilePath(): string
39
    {
40
        return $this->getFixersDocumentationDirectoryPath().'/index.rst';
×
41
    }
42

43
    public function getFixerDocumentationFilePath(FixerInterface $fixer): string
44
    {
45
        return $this->getFixersDocumentationDirectoryPath().'/'.Preg::replaceCallback(
×
46
            '/^.*\\\\(.+)\\\\(.+)Fixer$/',
×
47
            static function (array $matches): string {
×
48
                return Utils::camelCaseToUnderscore($matches[1]).'/'.Utils::camelCaseToUnderscore($matches[2]);
×
49
            },
×
50
            \get_class($fixer)
×
51
        ).'.rst';
×
52
    }
53

54
    public function getFixerDocumentationFileRelativePath(FixerInterface $fixer): string
55
    {
56
        return Preg::replace(
×
57
            '#^'.preg_quote($this->getFixersDocumentationDirectoryPath(), '#').'/#',
×
58
            '',
×
59
            $this->getFixerDocumentationFilePath($fixer)
×
60
        );
×
61
    }
62

63
    public function getRuleSetsDocumentationDirectoryPath(): string
64
    {
65
        return $this->path.'/ruleSets';
×
66
    }
67

68
    public function getRuleSetsDocumentationIndexFilePath(): string
69
    {
70
        return $this->getRuleSetsDocumentationDirectoryPath().'/index.rst';
×
71
    }
72

73
    public function getRuleSetsDocumentationFilePath(string $name): string
74
    {
75
        return $this->getRuleSetsDocumentationDirectoryPath().'/'.str_replace(':risky', 'Risky', ucfirst(substr($name, 1))).'.rst';
×
76
    }
77

78
    public function getListingFilePath(): string
79
    {
80
        return $this->path.'/list.rst';
×
81
    }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc