Passed
Pull Request — master (#1104)
by Maxim
10:52
created

PaginationBootloader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Bootloader\Http;
6
7
use Spiral\Boot\Bootloader\Bootloader;
8
use Spiral\Core\BinderInterface;
9
use Spiral\Core\Config\DeprecationProxy;
10
use Spiral\Framework\Spiral;
11
use Spiral\Http\PaginationFactory;
12
use Spiral\Pagination\PaginationProviderInterface;
13
14
final class PaginationBootloader extends Bootloader
15
{
16 355
    public function __construct(
17
        private readonly BinderInterface $binder,
18
    ) {
19 355
    }
20
21 355
    public function defineDependencies(): array
22
    {
23 355
        return [
24 355
            HttpBootloader::class,
25 355
        ];
26
    }
27
28 355
    public function defineSingletons(): array
29
    {
30 355
        $httpRequest = $this->binder->getBinder(Spiral::HttpRequest);
0 ignored issues
show
Bug introduced by
The method getBinder() does not exist on Spiral\Core\BinderInterface. It seems like you code against a sub-type of Spiral\Core\BinderInterface such as Spiral\Core\Container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        /** @scrutinizer ignore-call */ 
31
        $httpRequest = $this->binder->getBinder(Spiral::HttpRequest);
Loading history...
31 355
        $httpRequest->bindSingleton(PaginationFactory::class, PaginationFactory::class);
32 355
        $httpRequest->bindSingleton(PaginationProviderInterface::class, PaginationFactory::class);
33
34 355
        $this->binder->bind(
35 355
            PaginationProviderInterface::class,
36 355
            new DeprecationProxy(PaginationProviderInterface::class, true, Spiral::HttpRequest, '4.0')
0 ignored issues
show
Bug introduced by
Spiral\Framework\Spiral::HttpRequest of type Spiral\Framework\Spiral is incompatible with the type BackedEnum|null|string expected by parameter $scope of Spiral\Core\Config\DeprecationProxy::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
            new DeprecationProxy(PaginationProviderInterface::class, true, /** @scrutinizer ignore-type */ Spiral::HttpRequest, '4.0')
Loading history...
37 355
        );
38
39 355
        return [];
40
    }
41
}
42