app.php
foreach ($argv as $argument) { $something->checkAction('getName', $argument); }
Class ApplicationController:
class ApplicationController { public string $argument; public function __construct($argument) { $this->argument = $argument; } public function checkAction(ActionInterface $argument) { }
Interface ActionInterface:
interface ActionInterface { public function handle(VendingMachineInterface $vendingMachine): ResponseInterface; public function getName(): string; }
i podczas użycia $something->checkAction wyskakuje błąd
Fatal error: Uncaught TypeError: VendingMachine\Controller\ApplicationController::checkAction(): Argument #1 ($argument) must be of type VendingMachine\Action\ActionInterface, string given, called in app.php on line 13 and defined in src\Controller\ApplicationController.php:1
5
Stack trace:
#0 app.php(13): VendingMachine\Controller\ApplicationController->checkAction('getName', 'GETA')
#1 {main}
thrown in src\Controller\ApplicationController.php on line 15
jakiej komendy muszę użyć żeby nie wyskakiwał mi błąd ?