Passed
Push — main ( 66f102...e7c7b0 )
by Yevhenii
02:28
created

SteamParserFactoryTest.php$0 ➔ setUp()   A

Complexity

Conditions 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
c 0
b 0
f 0
cc 1
rs 9.6666

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SteamParserFactoryTest.php$0 ➔ createParseRules() 0 2 1
A SteamParserFactoryTest.php$0 ➔ createUrl() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SteamMarketProviders\ParserManager\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use SteamMarketProviders\ParserManager\Builder\ParseRulesBuilder;
9
use SteamMarketProviders\ParserManager\Contract\UrlBuilderInterface;
10
use SteamMarketProviders\ParserManager\Parser\AbstractProvider;
11
use SteamMarketProviders\ParserManager\Parser\SteamParser;
12
use SteamMarketProviders\ParserManager\SteamParserFactory;
13
14
class SteamParserFactoryTest extends TestCase
15
{
16
    private AbstractProvider $abstractProvider;
17
18
    /**
19
     * @return void
20
     */
21
    public function setUp(): void
22
    {
23
        $this->abstractProvider = new class extends AbstractProvider {
24
25
            /**
26
             * @param int $page
27
             * @return UrlBuilderInterface
28
             */
29
            protected function createUrl(int $page): UrlBuilderInterface
30
            {
31
                // TODO: Implement createUrl() method.
32
            }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return SteamMarketProviders\Par...act\UrlBuilderInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
33
34
            /**
35
             * @return ParseRulesBuilder
36
             */
37
            protected function createParseRules(): ParseRulesBuilder
38
            {
39
                // TODO: Implement createParseRules() method.
40
            }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return SteamMarketProviders\Par...ilder\ParseRulesBuilder. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
41
        };
42
    }
43
44
    public function testSuccessCreating(): void
45
    {
46
         $result = SteamParserFactory::create($this->abstractProvider);
47
         $this->assertInstanceOf(SteamParser::class, $result);
48
    }
49
}