Closed Moonbase59 closed 11 months ago
This might need an update. Installing the example and invoking it produces this error:
root@radio:/var/azuracast# ./docker.sh cli example:list-stations [07-Dec-2023 09:45:23 UTC] PHP Fatal error: Uncaught TypeError: App\Plugins::{closure}(): Argument #1 ($dispatcher) must be of type App\EventDispatcher, App\CallableEventDispatcher given in /var/azuracast/www/plugins/example-plugin/events.php:7 Stack trace: #0 [internal function]: App\Plugins->{closure}() #1 /var/azuracast/www/src/Plugins.php(79): call_user_func() #2 /var/azuracast/www_tmp/CompiledContainer.php(334): App\Plugins->registerEvents() #3 [internal function]: CompiledContainer::{closure}() #4 /var/azuracast/www/vendor/php-di/invoker/src/Invoker.php(74): call_user_func_array() #5 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(108): Invoker\Invoker->call() #6 /var/azuracast/www_tmp/CompiledContainer.php(321): DI\CompiledContainer->resolveFactory() #7 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get17() #8 /var/azuracast/www_tmp/CompiledContainer.php(342): DI\CompiledContainer->get() #9 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get18() #10 /var/azuracast/www/src/AppFactory.php(64): DI\CompiledContainer->get() #11 /var/azuracast/www/src/AppFactory.php(36): App\AppFactory::buildAppFromContainer() #12 /var/azuracast/www/bin/console(11): App\AppFactory::createCli() #13 {main} thrown in /var/azuracast/www/plugins/example-plugin/events.php on line 7 Fatal error: Uncaught TypeError: App\Plugins::{closure}(): Argument #1 ($dispatcher) must be of type App\EventDispatcher, App\CallableEventDispatcher given in /var/azuracast/www/plugins/example-plugin/events.php on line 7 TypeError: App\Plugins::{closure}(): Argument #1 ($dispatcher) must be of type App\EventDispatcher, App\CallableEventDispatcher given in /var/azuracast/www/plugins/example-plugin/events.php on line 7 Call Stack: 0.0002 443680 1. {main}() /var/azuracast/www/bin/console:0 0.0439 642824 2. App\AppFactory::createCli($appEnvironment = ???, $diDefinitions = ???) /var/azuracast/www/bin/console:11 0.0678 1218760 3. App\AppFactory::buildAppFromContainer($container = class CompiledContainer { protected array $resolvedEntries = ['DI\\Container' => ..., 'Psr\\Container\\ContainerInterface' => ..., 'DI\\FactoryInterface' => ..., 'Invoker\\InvokerInterface' => ..., 'App\\Environment' => class App\Environment { ... }, 'Monolog\\Logger' => class Monolog\Logger { ... }, 'Slim\\App' => class Slim\App { ... }, 'App\\Plugins' => class App\Plugins { ... }]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { private ?DI\Definition\Source\MutableDefinitionSource $mutableSource = class DI\Definition\Source\DefinitionArray { ... }; private array $sources = [...] }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { private ?DI\Definition\Resolver\ArrayResolver $arrayResolver = NULL; private ?DI\Definition\Resolver\FactoryResolver $factoryResolver = NULL; private ?DI\Definition\Resolver\DecoratorResolver $decoratorResolver = NULL; private ?DI\Definition\Resolver\ObjectCreator $objectResolver = NULL; private ?DI\Definition\Resolver\InstanceInjector $instanceResolver = NULL; private ?DI\Definition\Resolver\EnvironmentVariableResolver $envVariableResolver = NULL; private Psr\Container\ContainerInterface $container = ...; private DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... } }; private array ${DI\Container}fetchedDefinitions = ['App\\Environment' => class DI\Definition\ValueDefinition { ... }, 'App\\Plugins' => class DI\Definition\ValueDefinition { ... }]; protected array $entriesBeingResolved = ['Psr\\EventDispatcher\\EventDispatcherInterface' => TRUE, 'App\\CallableEventDispatcherInterface' => TRUE]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { private ?ProxyManager\Factory\LazyLoadingValueHolderFactory $proxyManager = NULL; private ?string $proxyDirectory = NULL }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { private $callableResolver = class Invoker\CallableResolver { ... }; private $parameterResolver = class Invoker\ParameterResolver\ResolverChain { ... }; private $container = ... } }) /var/azuracast/www/src/AppFactory.php:36 0.0737 1330064 4. DI\CompiledContainer->get($id = 'Psr\\EventDispatcher\\EventDispatcherInterface') /var/azuracast/www/src/AppFactory.php:64 0.0737 1330064 5. CompiledContainer->get18() /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php:54 0.0737 1330064 6. DI\CompiledContainer->get($id = 'App\\CallableEventDispatcherInterface') /var/azuracast/www_tmp/CompiledContainer.php:342 0.0737 1330064 7. CompiledContainer->get17() /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php:54 0.0737 1330528 8. DI\CompiledContainer->resolveFactory($callable = class Closure { }, $entryName = 'App\\CallableEventDispatcherInterface', $extraParameters = ???) /var/azuracast/www_tmp/CompiledContainer.php:321 0.0737 1330800 9. Invoker\Invoker->call($callable = class Closure { }, $parameters = [0 => class CompiledContainer { protected array $resolvedEntries = [...]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { ... }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { ... }; private array ${DI\Container}fetchedDefinitions = [...]; protected array $entriesBeingResolved = [...]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { ... } }, 1 => class DI\Compiler\RequestedEntryHolder { private string $name = 'App\\CallableEventDispatcherInterface' }]) /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php:108 0.0738 1331472 10. call_user_func_array:{/var/azuracast/www/vendor/php-di/invoker/src/Invoker.php:74}($callback = class Closure { }, $args = [0 => class CompiledContainer { protected array $resolvedEntries = [...]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { ... }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { ... }; private array ${DI\Container}fetchedDefinitions = [...]; protected array $entriesBeingResolved = [...]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { ... } }, 1 => class App\Plugins { private array $plugins = [...]; private Doctrine\Inflector\Inflector $inflector = class Doctrine\Inflector\Inflector { ... } }]) /var/azuracast/www/vendor/php-di/invoker/src/Invoker.php:74 0.0738 1331656 11. CompiledContainer::{closure:/var/azuracast/www_tmp/CompiledContainer.php:321-337}($di = class CompiledContainer { protected array $resolvedEntries = ['DI\\Container' => ..., 'Psr\\Container\\ContainerInterface' => ..., 'DI\\FactoryInterface' => ..., 'Invoker\\InvokerInterface' => ..., 'App\\Environment' => class App\Environment { ... }, 'Monolog\\Logger' => class Monolog\Logger { ... }, 'Slim\\App' => class Slim\App { ... }, 'App\\Plugins' => class App\Plugins { ... }]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { private ?DI\Definition\Source\MutableDefinitionSource $mutableSource = class DI\Definition\Source\DefinitionArray { ... }; private array $sources = [...] }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { private ?DI\Definition\Resolver\ArrayResolver $arrayResolver = NULL; private ?DI\Definition\Resolver\FactoryResolver $factoryResolver = NULL; private ?DI\Definition\Resolver\DecoratorResolver $decoratorResolver = NULL; private ?DI\Definition\Resolver\ObjectCreator $objectResolver = NULL; private ?DI\Definition\Resolver\InstanceInjector $instanceResolver = NULL; private ?DI\Definition\Resolver\EnvironmentVariableResolver $envVariableResolver = NULL; private Psr\Container\ContainerInterface $container = ...; private DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... } }; private array ${DI\Container}fetchedDefinitions = ['App\\Environment' => class DI\Definition\ValueDefinition { ... }, 'App\\Plugins' => class DI\Definition\ValueDefinition { ... }]; protected array $entriesBeingResolved = ['Psr\\EventDispatcher\\EventDispatcherInterface' => TRUE, 'App\\CallableEventDispatcherInterface' => TRUE]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { private ?ProxyManager\Factory\LazyLoadingValueHolderFactory $proxyManager = NULL; private ?string $proxyDirectory = NULL }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { private $callableResolver = class Invoker\CallableResolver { ... }; private $parameterResolver = class Invoker\ParameterResolver\ResolverChain { ... }; private $container = ... } }, $plugins = class App\Plugins { private array $plugins = ['example-plugin' => [...]]; private Doctrine\Inflector\Inflector $inflector = class Doctrine\Inflector\Inflector { private $singularizer = class Doctrine\Inflector\CachedWordInflector { ... }; private $pluralizer = class Doctrine\Inflector\CachedWordInflector { ... } } }) /var/azuracast/www/vendor/php-di/invoker/src/Invoker.php:74 0.0835 1473832 12. App\Plugins->registerEvents($dispatcher = class App\CallableEventDispatcher { private array ${Symfony\Component\EventDispatcher\EventDispatcher}listeners = ['App\\Event\\BuildConsoleCommands' => [...], 'App\\Event\\BuildRoutes' => [...], 'App\\Event\\GetSyncTasks' => [...], 'App\\Event\\GetNotifications' => [...], 'App\\Event\\Media\\GetAlbumArt' => [...], 'App\\Event\\Media\\ReadMetadata' => [...], 'App\\Event\\Media\\WriteMetadata' => [...], 'console.terminate' => [...], 'console.error' => [...], 'App\\Event\\Nginx\\WriteNginxConfiguration' => [...], 'App\\Event\\Radio\\BuildQueue' => [...], 'App\\Event\\Radio\\AnnotateNextSong' => [...], 'App\\Event\\Radio\\WriteLiquidsoapConfiguration' => [...], 'App\\Event\\Radio\\GenerateRawNowPlaying' => [...]]; private array ${Symfony\Component\EventDispatcher\EventDispatcher}sorted = []; private array ${Symfony\Component\EventDispatcher\EventDispatcher}optimized = *uninitialized*; protected DI\Container $di = class CompiledContainer { protected array $resolvedEntries = [...]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { ... }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { ... }; private array ${DI\Container}fetchedDefinitions = [...]; protected array $entriesBeingResolved = [...]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { ... } } }) /var/azuracast/www_tmp/CompiledContainer.php:334 0.0837 1474392 13. call_user_func:{/var/azuracast/www/src/Plugins.php:79}($callback = class Closure { }, $args = class App\CallableEventDispatcher { private array ${Symfony\Component\EventDispatcher\EventDispatcher}listeners = ['App\\Event\\BuildConsoleCommands' => [...], 'App\\Event\\BuildRoutes' => [...], 'App\\Event\\GetSyncTasks' => [...], 'App\\Event\\GetNotifications' => [...], 'App\\Event\\Media\\GetAlbumArt' => [...], 'App\\Event\\Media\\ReadMetadata' => [...], 'App\\Event\\Media\\WriteMetadata' => [...], 'console.terminate' => [...], 'console.error' => [...], 'App\\Event\\Nginx\\WriteNginxConfiguration' => [...], 'App\\Event\\Radio\\BuildQueue' => [...], 'App\\Event\\Radio\\AnnotateNextSong' => [...], 'App\\Event\\Radio\\WriteLiquidsoapConfiguration' => [...], 'App\\Event\\Radio\\GenerateRawNowPlaying' => [...]]; private array ${Symfony\Component\EventDispatcher\EventDispatcher}sorted = []; private array ${Symfony\Component\EventDispatcher\EventDispatcher}optimized = *uninitialized*; protected DI\Container $di = class CompiledContainer { protected array $resolvedEntries = [...]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { ... }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { ... }; private array ${DI\Container}fetchedDefinitions = [...]; protected array $entriesBeingResolved = [...]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { ... } } }) /var/azuracast/www/src/Plugins.php:79 0.0837 1474544 14. App\Plugins->{closure:/var/azuracast/www/plugins/example-plugin/events.php:7-35}($dispatcher = class App\CallableEventDispatcher { private array ${Symfony\Component\EventDispatcher\EventDispatcher}listeners = ['App\\Event\\BuildConsoleCommands' => [...], 'App\\Event\\BuildRoutes' => [...], 'App\\Event\\GetSyncTasks' => [...], 'App\\Event\\GetNotifications' => [...], 'App\\Event\\Media\\GetAlbumArt' => [...], 'App\\Event\\Media\\ReadMetadata' => [...], 'App\\Event\\Media\\WriteMetadata' => [...], 'console.terminate' => [...], 'console.error' => [...], 'App\\Event\\Nginx\\WriteNginxConfiguration' => [...], 'App\\Event\\Radio\\BuildQueue' => [...], 'App\\Event\\Radio\\AnnotateNextSong' => [...], 'App\\Event\\Radio\\WriteLiquidsoapConfiguration' => [...], 'App\\Event\\Radio\\GenerateRawNowPlaying' => [...]]; private array ${Symfony\Component\EventDispatcher\EventDispatcher}sorted = []; private array ${Symfony\Component\EventDispatcher\EventDispatcher}optimized = *uninitialized*; protected DI\Container $di = class CompiledContainer { protected array $resolvedEntries = [...]; private DI\Definition\Source\MutableDefinitionSource ${DI\Container}definitionSource = class DI\Definition\Source\SourceChain { ... }; private DI\Definition\Resolver\DefinitionResolver ${DI\Container}definitionResolver = class DI\Definition\Resolver\ResolverDispatcher { ... }; private array ${DI\Container}fetchedDefinitions = [...]; protected array $entriesBeingResolved = [...]; private ?Invoker\InvokerInterface ${DI\Container}invoker = NULL; protected Psr\Container\ContainerInterface $delegateContainer = ...; protected DI\Proxy\ProxyFactory $proxyFactory = class DI\Proxy\ProxyFactory { ... }; private ?Invoker\InvokerInterface ${DI\CompiledContainer}factoryInvoker = class Invoker\Invoker { ... } } }) /var/azuracast/www/src/Plugins.php:79 [2023-12-07T09:45:23.070466+00:00] AzuraCast.ALERT: Fatal Error (E_ERROR): Uncaught TypeError: App\Plugins::{closure}(): Argument #1 ($dispatcher) must be of type App\EventDispatcher, App\CallableEventDispatcher given in /var/azuracast/www/plugins/example-plugin/events.php:7 Stack trace: #0 [internal function]: App\Plugins->{closure}() #1 /var/azuracast/www/src/Plugins.php(79): call_user_func() #2 /var/azuracast/www_tmp/CompiledContainer.php(334): App\Plugins->registerEvents() #3 [internal function]: CompiledContainer::{closure}() #4 /var/azuracast/www/vendor/php-di/invoker/src/Invoker.php(74): call_user_func_array() #5 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(108): Invoker\Invoker->call() #6 /var/azuracast/www_tmp/CompiledContainer.php(321): DI\CompiledContainer->resolveFactory() #7 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get17() #8 /var/azuracast/www_tmp/CompiledContainer.php(342): DI\CompiledContainer->get() #9 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get18() #10 /var/azuracast/www/src/AppFactory.php(64): DI\CompiledContainer->get() #11 /var/azuracast/www/src/AppFactory.php(36): App\AppFactory::buildAppFromContainer() #12 /var/azuracast/www/bin/console(11): App\AppFactory::createCli() #13 {main} thrown {"code":1,"message":"Uncaught TypeError: App\\Plugins::{closure}(): Argument #1 ($dispatcher) must be of type App\\EventDispatcher, App\\CallableEventDispatcher given in /var/azuracast/www/plugins/example-plugin/events.php:7\nStack trace:\n#0 [internal function]: App\\Plugins->{closure}()\n#1 /var/azuracast/www/src/Plugins.php(79): call_user_func()\n#2 /var/azuracast/www_tmp/CompiledContainer.php(334): App\\Plugins->registerEvents()\n#3 [internal function]: CompiledContainer::{closure}()\n#4 /var/azuracast/www/vendor/php-di/invoker/src/Invoker.php(74): call_user_func_array()\n#5 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(108): Invoker\\Invoker->call()\n#6 /var/azuracast/www_tmp/CompiledContainer.php(321): DI\\CompiledContainer->resolveFactory()\n#7 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get17()\n#8 /var/azuracast/www_tmp/CompiledContainer.php(342): DI\\CompiledContainer->get()\n#9 /var/azuracast/www/vendor/php-di/php-di/src/CompiledContainer.php(54): CompiledContainer->get18()\n#10 /var/azuracast/www/src/AppFactory.php(64): DI\\CompiledContainer->get()\n#11 /var/azuracast/www/src/AppFactory.php(36): App\\AppFactory::buildAppFromContainer()\n#12 /var/azuracast/www/bin/console(11): App\\AppFactory::createCli()\n#13 {main}\n thrown","file":"/var/azuracast/www/plugins/example-plugin/events.php","line":7,"trace":null} [] root@radio:/var/azuracast#
I’m on Rolling Release #f2dd535 (2023-12-07 6:38).
Only just found out since I was playing with @RM-FM’s plugin and wanted to learn a little more about plugins.
Sample plugin is updated to match our current application structure as of the 0.19.x version series.
Thanks! Will test this again one of the days!
This might need an update. Installing the example and invoking it produces this error:
I’m on Rolling Release #f2dd535 (2023-12-07 6:38).
Only just found out since I was playing with @RM-FM’s plugin and wanted to learn a little more about plugins.