GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractEmptyResourceTest::provideProperties()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 11
ccs 0
cts 9
cp 0
crap 6
rs 9.9
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace ApiClients\Tools\ResourceTestUtilities;
5
6
use ReflectionClass;
7
use Throwable;
8
use TypeError;
9
10
abstract class AbstractEmptyResourceTest extends TestCase
11
{
12
    abstract public function getSyncAsync(): string;
13
14
    abstract public function getClass(): string;
15
16
    public function provideProperties(): array
17
    {
18
        $yield = [];
19
        $class = new ReflectionClass($this->getClass());
20
21
        foreach ($class->getMethods() as $method) {
22
            $yield[] = [$method->getName()];
0 ignored issues
show
Bug introduced by
Consider using $method->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
23
        }
24
25
        return [[$yield]];
26
    }
27
28
    /**
29
     * @dataProvider provideProperties
30
     * @param mixed $args
31
     */
32
    public function testProperties($args)
33
    {
34
        $class = $this->getClass();
35
        $resource = new $class();
36
37
        foreach ($args as $arg) {
38
            list($method) = $arg;
39
40
            try {
41
                $resource->{$method}();
42
            } catch (TypeError $e) {
43
                self::assertTrue(true);
44
                continue;
45
            } catch (Throwable $t) {
46
                self::fail('Should have thrown a TypeError instead of a ' . get_class($t));
47
            }
48
        }
49
    }
50
}
51