InvalidCollectionOperationException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 6
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LAG\AdminBundle\Exception\Operation;
6
7
use LAG\AdminBundle\Controller\Index;
8
use LAG\AdminBundle\Exception\Exception;
9
use LAG\AdminBundle\Metadata\CollectionOperationInterface;
10
use LAG\AdminBundle\Metadata\OperationInterface;
11
12
class InvalidCollectionOperationException extends Exception
13
{
14
    public function __construct(OperationInterface $operation)
15
    {
16
        parent::__construct(sprintf(
17
            'The operation "%s" of the resource "%s" is configured to use the "%s" controller but is not an instance of "%s"',
18
            $operation->getName(),
19
            $operation->getResourceName(),
0 ignored issues
show
Bug introduced by
The method getResourceName() does not exist on LAG\AdminBundle\Metadata\OperationInterface. Did you maybe mean getResource()? ( Ignorable by Annotation )

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

19
            $operation->/** @scrutinizer ignore-call */ 
20
                        getResourceName(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
            Index::class,
21
            CollectionOperationInterface::class,
22
        ));
23
    }
24
}
25