fsi-open /
admin-bundle
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * (c) FSi sp. z o.o. <[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 | declare(strict_types=1); |
||||
| 11 | |||||
| 12 | namespace FSi\Bundle\AdminBundle\Menu\Builder; |
||||
| 13 | |||||
| 14 | use FSi\Bundle\AdminBundle\Event\MenuEvent; |
||||
| 15 | use FSi\Bundle\AdminBundle\Menu\Item\Item; |
||||
| 16 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||||
| 17 | |||||
| 18 | class MenuBuilder implements Builder |
||||
| 19 | { |
||||
| 20 | /** |
||||
| 21 | * @var EventDispatcherInterface |
||||
| 22 | */ |
||||
| 23 | private $eventDispatcher; |
||||
| 24 | |||||
| 25 | /** |
||||
| 26 | * @var string |
||||
| 27 | */ |
||||
| 28 | private $eventName; |
||||
| 29 | |||||
| 30 | public function __construct(EventDispatcherInterface $eventDispatcher, string $eventName) |
||||
| 31 | { |
||||
| 32 | $this->eventName = $eventName; |
||||
| 33 | $this->eventDispatcher = $eventDispatcher; |
||||
| 34 | } |
||||
| 35 | |||||
| 36 | public function buildMenu(): Item |
||||
| 37 | { |
||||
| 38 | $menu = new Item(); |
||||
| 39 | |||||
| 40 | $this->eventDispatcher->dispatch($this->eventName, new MenuEvent($menu)); |
||||
|
0 ignored issues
–
show
$this->eventName of type string is incompatible with the type object expected by parameter $event of Symfony\Contracts\EventD...erInterface::dispatch().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 41 | |||||
| 42 | return $menu; |
||||
| 43 | } |
||||
| 44 | } |
||||
| 45 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.