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

keradus / PHP-CS-Fixer / 17253322895

26 Aug 2025 11:52PM UTC coverage: 94.753% (+0.008%) from 94.745%
17253322895

push

github

keradus
add to git-blame-ignore-revs

28316 of 29884 relevant lines covered (94.75%)

45.64 hits per line

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

80.0
/src/Documentation/RstUtils.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\Preg;
18

19
/**
20
 * @internal
21
 *
22
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
23
 */
24
final class RstUtils
25
{
26
    private function __construct()
27
    {
28
        // cannot create instance of util. class
29
    }
×
30

31
    public static function toRst(string $string, int $indent = 0): string
32
    {
33
        $string = wordwrap(self::ensureProperInlineCode($string), 80 - $indent);
1✔
34

35
        return 0 === $indent ? $string : self::indent($string, $indent);
1✔
36
    }
37

38
    public static function ensureProperInlineCode(string $string): string
39
    {
40
        return Preg::replace('/(?<!`)(`[^`]+`)(?!`)/', '`$1`', $string);
1✔
41
    }
42

43
    public static function indent(string $string, int $indent): string
44
    {
45
        return Preg::replace('/(\n)(?!\n|$)/', '$1'.str_repeat(' ', $indent), $string);
1✔
46
    }
47
}
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