99
1010namespace Joomla \CMS \Workflow ;
1111
12- use Joomla \CMS \Application \CMSApplication ;
12+ use Joomla \CMS \Application \CMSApplicationInterface ;
1313use Joomla \CMS \Event \AbstractEvent ;
1414use Joomla \CMS \Event \Workflow \WorkflowTransitionEvent ;
1515use Joomla \CMS \Extension \ComponentInterface ;
1818use Joomla \CMS \Table \Category ;
1919use Joomla \Database \DatabaseDriver ;
2020use Joomla \Database \ParameterType ;
21+ use Joomla \Event \DispatcherAwareInterface ;
2122use Joomla \Registry \Registry ;
2223use Joomla \Utilities \ArrayHelper ;
2324
@@ -50,7 +51,7 @@ class Workflow
5051 /**
5152 * Application Object
5253 *
53- * @var CMSApplication
54+ * @var CMSApplicationInterface
5455 * @since 4.0.0
5556 */
5657 protected $ app ;
@@ -98,13 +99,13 @@ class Workflow
9899 /**
99100 * Class constructor
100101 *
101- * @param string $extension The extension name
102- * @param ?CMSApplication $app Application Object
103- * @param ?DatabaseDriver $db Database Driver Object
102+ * @param string $extension The extension name
103+ * @param ?CMSApplicationInterface $app Application Object
104+ * @param ?DatabaseDriver $db Database Driver Object
104105 *
105106 * @since 4.0.0
106107 */
107- public function __construct (string $ extension , ?CMSApplication $ app = null , ?DatabaseDriver $ db = null )
108+ public function __construct (string $ extension , ?CMSApplicationInterface $ app = null , ?DatabaseDriver $ db = null )
108109 {
109110 $ this ->extension = $ extension ;
110111
@@ -114,6 +115,10 @@ public function __construct(string $extension, ?CMSApplication $app = null, ?Dat
114115 $ app = Factory::getApplication ();
115116 }
116117
118+ if (!is_a ($ app , DispatcherAwareInterface::class)) {
119+ trigger_error ('The given application object is not Dispatcher aware, which is mandatory. ' , E_ERROR );
120+ }
121+
117122 $ this ->app = $ app ;
118123
119124 if ($ db === null ) {
0 commit comments