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.

RbCommentTableGatewayFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
1
<?php
2
namespace RbComment\Factory\Model;
3
4
use Interop\Container\ContainerInterface;
5
use RbComment\Model\Comment;
6
use RbComment\Model\CommentTable;
7
use Zend\Db\Adapter\Adapter;
8
use Zend\Db\ResultSet\ResultSet;
9
use Zend\Db\TableGateway\TableGateway;
10
use Zend\ServiceManager\Factory\FactoryInterface;
11
12
final class RbCommentTableGatewayFactory implements FactoryInterface
13
{
14
    /**
15
     * @param ContainerInterface $container
16
     * @param string             $requestedName
17
     * @param array|null         $options
18
     *
19
     * @return object|CommentTable
20
     */
21
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
22
    {
23
        $databaseAdapter = $container->get(Adapter::class);
24
25
        $resultSetPrototype = new ResultSet();
26
        $resultSetPrototype->setArrayObjectPrototype(new Comment());
0 ignored issues
show
Documentation introduced by
new \RbComment\Model\Comment() is of type object<RbComment\Model\Comment>, but the function expects a object<ArrayObject>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
27
28
        return new TableGateway('rb_comments', $databaseAdapter, null, $resultSetPrototype);
29
    }
30
}
31