diff options
author | Andreas Gohr <andi@splitbrain.org> | 2023-09-02 14:42:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 14:42:51 +0200 |
commit | 5ff5424d8c81c7123d8656a787af2ff85b3dec21 (patch) | |
tree | 322929ee01d892bb3c927e7fe1238369c647f820 /inc/parser/parser.php | |
parent | 0613df3287b82a98b1e97cf86ed9d4c8fbd16f1c (diff) | |
parent | 91560755291852b8302767d454183a7662666f7e (diff) | |
download | dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.tar.gz dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.zip |
Merge pull request #4045 from dokuwiki/autofix
Use Rector to autofix code smell
Diffstat (limited to 'inc/parser/parser.php')
-rw-r--r-- | inc/parser/parser.php | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 77f47e3ac..225dee35b 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -1,67 +1,60 @@ <?php use dokuwiki\Debug\PropertyDeprecationHelper; +use dokuwiki\Parsing\Parser; /** * Define various types of modes used by the parser - they are used to * populate the list of modes another mode accepts */ global $PARSER_MODES; -$PARSER_MODES = array( +$PARSER_MODES = [ // containers are complex modes that can contain many other modes // hr breaks the principle but they shouldn't be used in tables / lists // so they are put here - 'container' => array('listblock', 'table', 'quote', 'hr'), - + 'container' => ['listblock', 'table', 'quote', 'hr'], // some mode are allowed inside the base mode only - 'baseonly' => array('header'), - + 'baseonly' => ['header'], // modes for styling text -- footnote behaves similar to styling - 'formatting' => array( - 'strong', 'emphasis', 'underline', 'monospace', - 'subscript', 'superscript', 'deleted', 'footnote' - ), - + 'formatting' => [ + 'strong', 'emphasis', 'underline', 'monospace', 'subscript', 'superscript', 'deleted', 'footnote' + ], // modes where the token is simply replaced - they can not contain any // other modes - 'substition' => array( - 'acronym', 'smiley', 'wordblock', 'entity', - 'camelcaselink', 'internallink', 'media', - 'externallink', 'linebreak', 'emaillink', - 'windowssharelink', 'filelink', 'notoc', - 'nocache', 'multiplyentity', 'quotes', 'rss' - ), - + 'substition' => [ + 'acronym', 'smiley', 'wordblock', 'entity', 'camelcaselink', 'internallink', 'media', 'externallink', + 'linebreak', 'emaillink', 'windowssharelink', 'filelink', 'notoc', 'nocache', 'multiplyentity', 'quotes', 'rss' + ], // modes which have a start and end token but inside which // no other modes should be applied - 'protected' => array('preformatted', 'code', 'file'), - + 'protected' => ['preformatted', 'code', 'file'], // inside this mode no wiki markup should be applied but lineendings // and whitespace isn't preserved - 'disabled' => array('unformatted'), - + 'disabled' => ['unformatted'], // used to mark paragraph boundaries - 'paragraphs' => array('eol') -); + 'paragraphs' => ['eol'], +]; /** * Class Doku_Parser * * @deprecated 2018-05-04 */ -class Doku_Parser extends \dokuwiki\Parsing\Parser { +class Doku_Parser extends Parser +{ use PropertyDeprecationHelper { __set as protected deprecationHelperMagicSet; __get as protected deprecationHelperMagicGet; } /** @inheritdoc */ - public function __construct(Doku_Handler $handler = null) { - dbg_deprecated(\dokuwiki\Parsing\Parser::class); - $this->deprecatePublicProperty('modes', __CLASS__); - $this->deprecatePublicProperty('connected', __CLASS__); + public function __construct(Doku_Handler $handler = null) + { + dbg_deprecated(Parser::class); + $this->deprecatePublicProperty('modes', self::class); + $this->deprecatePublicProperty('connected', self::class); - if ($handler === null) { + if (!$handler instanceof \Doku_Handler) { $handler = new Doku_Handler(); } |