I'm writing a syntax plugin with two syntaxes, one for block use and another for inline. As getPType()
doesn't know which syntax is calling it, I've split the plugin into two files:
syntax/
block.php
inline.php
Everything else is the same between the two syntaxes, so I've also created a base class, meta/Syntax.php
, which states:
namespace dokuwiki\plugin\<name>\meta
The two syntax classes only override the getPType()
method and connect their syntax; they inherit everything else from the base class with:
use dokuwiki\plugin\<name>\meta\Syntax;
At this point DokuWiki fails to load, because it can't find the Doku_Handler class used in the handle()
method of Syntax.php
. Error:
PHP Fatal error: Could not check compatibility between dokuwiki\\plugin\\<name>\\meta\\Syntax::handle($match, $state, $position, dokuwiki\\plugin\\<name>\\meta\\Doku_Handler $handler): array and dokuwiki\\Extension\\SyntaxPlugin::handle($match, $state, $pos, Doku_Handler $handler), because class dokuwiki\\plugin\\<name>\\meta\\Doku_Handler is not available in /var/www/html/lib/plugins/<name>/meta/Syntax.php on line 66
Is there a way to sensibly have the base class reference the Doku_Handler class so it can be found? Should I be loading the base class a different way in the syntax classes?
Thanks,
Iain.