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.
Completed
Push — master ( 7568da...3f34ed )
by
unknown
25s queued 10s
created

Compiler/MenuCompilerPassTest.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\MenuBundle\Tests\DependencyInjection\Compiler;
11
12
use Core23\MenuBundle\DependencyInjection\Compiler\MenuCompilerPass;
13
use PHPUnit\Framework\TestCase;
14
use Prophecy\Argument;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
18
final class MenuCompilerPassTest extends TestCase
19
{
20
    /**
21
     * @var ContainerBuilder
22
     */
23
    private $container;
24
25
    private $registryDefinitionMock;
26
27
    protected function setUp(): void
28
    {
29
        $this->registryDefinitionMock = $this->prophesize(Definition::class);
30
31
        $this->container = new ContainerBuilder();
32
        $this->container->setDefinition('sonata.block.menu.registry', $this->registryDefinitionMock->reveal());
33
    }
34
35
    public function testProcess(): void
36
    {
37
        $definition = $this->createMock(Definition::class);
38
        $definition->expects(static::once())->method('addMethodCall')
39
            ->with('add', ['main'])
40
        ;
41
42
        $this->container->setDefinition('sonata.block.menu.registry', $definition);
0 ignored issues
show
$definition is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...cyInjection\Definition>.

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...
43
        $this->container->setParameter('core23_menu.groups', [
44
            'main' => [
45
                'name'       => 'FooMenu',
46
                'attributes' => [
47
                    'class'    => 'my-class',
48
                ],
49
                'items' => [],
50
            ],
51
        ]);
52
53
        $compiler = new MenuCompilerPass();
54
        $compiler->process($this->container);
55
    }
56
57
    public function testProcessWithEmptyGroups(): void
58
    {
59
        $this->container->setParameter('core23_menu.groups', [
60
        ]);
61
62
        $compiler = new MenuCompilerPass();
63
        $compiler->process($this->container);
64
65
        $this->registryDefinitionMock->addMethodCall(Argument::any())->shouldNotHaveBeenCalled();
66
    }
67
}
68