Issues (5)

tests/Fixture/Kernel.php (2 issues)

1
<?php
2
3
namespace Zenstruck\Messenger\Test\Tests\Fixture;
4
5
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
6
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
7
use Symfony\Component\Config\Loader\LoaderInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
11
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
12
use Symfony\Component\Routing\RouteCollectionBuilder;
13
use Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageA;
14
use Zenstruck\Messenger\Test\ZenstruckMessengerTestBundle;
15
16
/**
17
 * @author Kevin Bond <[email protected]>
18
 */
19
class Kernel extends BaseKernel
20
{
21
    use MicroKernelTrait;
0 ignored issues
show
The trait Symfony\Bundle\Framework...Kernel\MicroKernelTrait requires the property $instanceof which is not provided by Zenstruck\Messenger\Test\Tests\Fixture\Kernel.
Loading history...
22
23
    public function dispatch(): Response
24
    {
25
        $this->getContainer()->get('message_bus')->dispatch(new MessageA());
26
27
        return new Response();
28
    }
29
30
    public function registerBundles(): iterable
31
    {
32
        yield new FrameworkBundle();
33
        yield new ZenstruckMessengerTestBundle();
34
    }
35
36
    protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void
0 ignored issues
show
The parameter $c is not used and could be removed. ( Ignorable by Annotation )

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

36
    protected function configureContainer(/** @scrutinizer ignore-unused */ ContainerBuilder $c, LoaderInterface $loader): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        $loader->load(\sprintf('%s/config/%s.yaml', __DIR__, $this->getEnvironment()));
39
    }
40
41
    /**
42
     * @param RouteCollectionBuilder|RoutingConfigurator $routes
43
     */
44
    protected function configureRoutes($routes): void // @phpstan-ignore-line
45
    {
46
        if ($routes instanceof RouteCollectionBuilder) { // @phpstan-ignore-line
47
            $routes->add('/dispatch', 'kernel::dispatch'); // @phpstan-ignore-line
48
49
            return;
50
        }
51
52
        $routes->add('dispatch', '/dispatch')->controller('kernel::dispatch');
53
    }
54
}
55