summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorGerrit Uitslag <klapinklapin@gmail.com>2014-09-29 21:45:27 +0200
committerGerrit Uitslag <klapinklapin@gmail.com>2014-09-29 21:45:27 +0200
commit59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80 (patch)
treee87df15c5ca81556fd1925ad56ba404f664c890e /inc/parser
parente0c26282a603881e8d2f839d94c28dbbfc57d71b (diff)
downloadrpg-59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80.tar.gz
rpg-59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80.tar.bz2
more scrutinizer issue improvements
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/lexer.php25
-rw-r--r--inc/parser/metadata.php14
-rw-r--r--inc/parser/xhtml.php7
3 files changed, 27 insertions, 19 deletions
diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php
index 2e84eca7c..b46a5f505 100644
--- a/inc/parser/lexer.php
+++ b/inc/parser/lexer.php
@@ -56,12 +56,12 @@ class Doku_LexerParallelRegex {
/**
* Adds a pattern with an optional label.
*
- * @param mixed $pattern Perl style regex. Must be UTF-8
+ * @param mixed $pattern Perl style regex. Must be UTF-8
* encoded. If its a string, the (, )
* lose their meaning unless they
* form part of a lookahead or
* lookbehind assertation.
- * @param string $label Label of regex to be returned
+ * @param bool|string $label Label of regex to be returned
* on a match. Label must be ASCII
* @access public
*/
@@ -151,7 +151,8 @@ class Doku_LexerParallelRegex {
* "or" operator. Caches the regex.
* Will automatically escape (, ) and / tokens.
*
- * @param array $patterns List of patterns in order.
+ * @internal array $_patterns List of patterns in order.
+ * @return null|string
* @access private
*/
function _getCompoundedRegex() {
@@ -297,6 +298,7 @@ class Doku_Lexer {
*/
function Doku_Lexer(&$parser, $start = "accept", $case = false) {
$this->_case = $case;
+ /** @var Doku_LexerParallelRegex[] _regexes */
$this->_regexes = array();
$this->_parser = &$parser;
$this->_mode = new Doku_LexerStateStack($start);
@@ -425,11 +427,13 @@ class Doku_Lexer {
* Sends the matched token and any leading unmatched
* text to the parser changing the lexer to a new
* mode if one is listed.
- * @param string $unmatched Unmatched leading portion.
- * @param string $matched Actual token match.
- * @param string $mode Mode after match. A boolean
+ * @param string $unmatched Unmatched leading portion.
+ * @param string $matched Actual token match.
+ * @param bool|string $mode Mode after match. A boolean
* false mode causes no change.
- * @param int $pos Current byte index location in raw doc
+ * @param int $initialPos
+ * @param int $matchPos
+ * Current byte index location in raw doc
* thats being parsed
* @return boolean False if there was any error
* from the parser.
@@ -498,11 +502,12 @@ class Doku_Lexer {
* Calls the parser method named after the current
* mode. Empty content will be ignored. The lexer
* has a parser handler for each mode in the lexer.
- * @param string $content Text parsed.
- * @param boolean $is_match Token is recognised rather
+ * @param string $content Text parsed.
+ * @param boolean $is_match Token is recognised rather
* than unparsed data.
- * @param int $pos Current byte index location in raw doc
+ * @param int $pos Current byte index location in raw doc
* thats being parsed
+ * @return bool
* @access private
*/
function _invokeParser($content, $is_match, $pos) {
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index 4619c24ce..3fc5d1c9a 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -421,8 +421,8 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* keep track of internal links in $this->meta['relation']['references']
*
- * @param string $id page ID to link to. eg. 'wiki:syntax'
- * @param string|array $name name for the link, array for media file
+ * @param string $id page ID to link to. eg. 'wiki:syntax'
+ * @param string|array|null $name name for the link, array for media file
*/
function internallink($id, $name = null) {
global $ID;
@@ -458,8 +458,8 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render an external link
*
- * @param string $url full URL with scheme
- * @param string|array $name name for the link, array for media file
+ * @param string $url full URL with scheme
+ * @param string|array|null $name name for the link, array for media file
*/
function externallink($url, $name = null) {
if(is_array($name)) {
@@ -628,9 +628,9 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* Construct a title and handle images in titles
*
* @author Harry Fuecks <hfuecks@gmail.com>
- * @param string|array $title either string title or media array
- * @param string $default default title if nothing else is found
- * @param null|string $id linked page id (used to extract title from first heading)
+ * @param string|array|null $title either string title or media array
+ * @param string $default default title if nothing else is found
+ * @param null|string $id linked page id (used to extract title from first heading)
* @return string title text
*/
function _getLinkTitle($title, $default, $id = null) {
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index cd4b3d6e5..aa09058df 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -820,6 +820,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// now first resolve and clean up the $id
resolve_pageid(getNS($ID), $id, $exists);
+ $link = array();
$name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype);
if(!$isImage) {
if($exists) {
@@ -904,6 +905,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
}
//prepare for formating
+ $link = array();
$link['target'] = $conf['target']['extern'];
$link['style'] = '';
$link['pre'] = '';
@@ -981,6 +983,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
global $conf;
//simple setup
+ $link = array();
$link['target'] = $conf['target']['windows'];
$link['pre'] = '';
$link['suf'] = '';
@@ -1656,7 +1659,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// prepare alternative formats
$extensions = array('webm', 'ogv', 'mp4');
$files = media_alternativefiles($src, $extensions);
- $poster = media_alternativefiles($src, array('jpg', 'png'), true);
+ $poster = media_alternativefiles($src, array('jpg', 'png'));
if(!empty($poster)) {
$posterUrl = ml(reset($poster), '', true, '&');
}
@@ -1700,7 +1703,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param array $atts - additional attributes for the <audio> tag
* @return string
*/
- function _audio($src, $atts = null) {
+ function _audio($src, $atts = array()) {
$files = array();
$isExternal = media_isexternal($src);