for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the core-bundle package.
*
* (c) 2021 WEBEWEB
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WBW\Bundle\CoreBundle\Tests;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Test case helper.
* @author webeweb <https://github.com/webeweb>
* @package WBW\Bundle\CoreBundle\Tests
class TestCaseHelper {
* Get dispatch() function for an event dispatcher.
* @return callable Returns dispatch() function for an event dispatcher.
public static function getEventDispatcherDispatchFunction(): callable {
return function(Event $event, string $eventName = null): Event {
$eventName
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
return function(Event $event, /** @scrutinizer ignore-unused */ string $eventName = null): Event {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $event;
};
}
* Get generate() function for a router.
* @return callable Returns generate() function for a router.
public static function getRouterGenerateFunction(): callable {
return function($name, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {
$parameters
return function($name, /** @scrutinizer ignore-unused */ array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {
$referenceType
return function($name, array $parameters = [], /** @scrutinizer ignore-unused */ int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {
return $name;
* Get a trans() function for a translator.
* @return callable Returns the trans() function for a translator.
public static function getTranslatorTransFunction(): callable {
return function($id, array $parameters = [], string $domain = null, string $locale = null): ?string {
return function($id, /** @scrutinizer ignore-unused */ array $parameters = [], string $domain = null, string $locale = null): ?string {
$domain
return function($id, array $parameters = [], /** @scrutinizer ignore-unused */ string $domain = null, string $locale = null): ?string {
$locale
return function($id, array $parameters = [], string $domain = null, /** @scrutinizer ignore-unused */ string $locale = null): ?string {
return $id;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.