• 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/Console/SelfUpdate/GithubClient.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\Console\SelfUpdate;
16

17
/**
18
 * @internal
19
 */
20
final class GithubClient implements GithubClientInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getTags(): array
26
    {
27
        $url = 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tags';
×
28

29
        $result = @file_get_contents(
×
30
            $url,
×
31
            false,
×
32
            stream_context_create([
×
33
                'http' => [
×
34
                    'header' => 'User-Agent: PHP-CS-Fixer/PHP-CS-Fixer',
×
35
                ],
×
36
            ])
×
37
        );
×
38

39
        if (false === $result) {
×
40
            throw new \RuntimeException(sprintf('Failed to load tags at "%s".', $url));
×
41
        }
42

43
        $result = json_decode($result, true);
×
44
        if (JSON_ERROR_NONE !== json_last_error()) {
×
45
            throw new \RuntimeException(sprintf(
×
46
                'Failed to read response from "%s" as JSON: %s.',
×
47
                $url,
×
48
                json_last_error_msg()
×
49
            ));
×
50
        }
51

52
        return $result;
×
53
    }
54
}
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

© 2025 Coveralls, Inc