diff --git a/phpdotnet/phd/Autoloader.php b/phpdotnet/phd/Autoloader.php index 5273af8c..66487f92 100644 --- a/phpdotnet/phd/Autoloader.php +++ b/phpdotnet/phd/Autoloader.php @@ -33,7 +33,7 @@ public static function autoload($name) } /** - * @var array Absolute pathnames to package directories + * @param array $dirs Absolute pathnames to package directories */ public static function setPackageDirs(array $dirs): void { self::$package_dirs = $dirs; diff --git a/phpdotnet/phd/Config.php b/phpdotnet/phd/Config.php index 688525f4..8c561c63 100644 --- a/phpdotnet/phd/Config.php +++ b/phpdotnet/phd/Config.php @@ -28,16 +28,16 @@ class Config public string $outputFilename = ''; /** @var resource */ public $phpErrorOutput = \STDERR; - public string $phpErrorColor = '01;31'; // Red + public string|false $phpErrorColor = '01;31'; // Red /** @var resource */ public $userErrorOutput = \STDERR; - public string $userErrorColor = '01;33'; // Yellow + public string|false $userErrorColor = '01;33'; // Yellow /** @var resource */ public $phdInfoOutput = \STDOUT; - public string $phdInfoColor = '01;32'; // Green + public string|false $phdInfoColor = '01;32'; // Green /** @var resource */ public $phdWarningOutput = \STDOUT; - public string $phdWarningColor = '01;35'; // Magenta + public string|false $phdWarningColor = '01;35'; // Magenta public string $highlighter = 'phpdotnet\\phd\\Highlighter'; /** @var array */ public array $package =['Generic']; @@ -68,7 +68,7 @@ public function __construct() { /** * Sets one or more configuration options from an array * - * @param array + * @param array $configOptions */ public function init(array $configOptions): void { foreach ($configOptions as $option => $value) { diff --git a/phpdotnet/phd/Format.php b/phpdotnet/phd/Format.php index f6b5045c..49b3ece4 100644 --- a/phpdotnet/phd/Format.php +++ b/phpdotnet/phd/Format.php @@ -89,7 +89,7 @@ abstract public function CDATA($value); * @param integer $type Format of description, Format::SDESC or * Format::LDESC * - * @return string Relative or absolute URI to access $for + * @return string|null|void Relative or absolute URI to access $for */ abstract public function createLink( $for, &$desc = null, $type = Format::SDESC @@ -122,7 +122,7 @@ abstract public function appendData($data); * Value is either Render::OPEN or Render::CLOSE * * @param integer $event Event flag (see Render class) - * @param mixed $val Additional value flag. Depends + * @param mixed $value Additional value flag. Depends * on $event type * * @return void diff --git a/phpdotnet/phd/Format/Abstract/PDF.php b/phpdotnet/phd/Format/Abstract/PDF.php index 5db522a0..8ca42513 100644 --- a/phpdotnet/phd/Format/Abstract/PDF.php +++ b/phpdotnet/phd/Format/Abstract/PDF.php @@ -354,7 +354,7 @@ public function add($type, $option = null) { $this->lineJump(); break; case self::DRAW_LINE: - $this->traceLine($option); + $this->traceLine(); break; case self::LINE_JUMP: if ($option) diff --git a/phpdotnet/phd/Highlighter.php b/phpdotnet/phd/Highlighter.php index c90db344..4bff2b57 100644 --- a/phpdotnet/phd/Highlighter.php +++ b/phpdotnet/phd/Highlighter.php @@ -31,7 +31,7 @@ class Highlighter * * @param string $format Output format (pdf, xhtml, troff, ...) * - * @return PhDHighlighter Highlighter object + * @return Highlighter Highlighter object */ public static function factory($format) { @@ -75,7 +75,7 @@ public function highlight($text, $role, $format) } catch (\ParseException $e) { trigger_error(vsprintf("Parse error while highlighting PHP code: %s\nText: %s", [(string) $e, $text]), E_USER_WARNING); - return '
'
+                return '
'
                     . htmlspecialchars($text, ENT_QUOTES, 'UTF-8')
                     . "
\n"; } diff --git a/phpdotnet/phd/Highlighter/GeSHi.php b/phpdotnet/phd/Highlighter/GeSHi.php index f0867462..28dbfe68 100644 --- a/phpdotnet/phd/Highlighter/GeSHi.php +++ b/phpdotnet/phd/Highlighter/GeSHi.php @@ -51,7 +51,7 @@ class Highlighter_GeSHi extends Highlighter * * @param string $format Output format (pdf, xhtml, troff, ...) * - * @return PhDHighlighter Highlighter object + * @return Highlighter Highlighter object */ public static function factory($format) { diff --git a/phpdotnet/phd/Highlighter/GeSHi11x.php b/phpdotnet/phd/Highlighter/GeSHi11x.php index aaaa9fdd..5936582c 100644 --- a/phpdotnet/phd/Highlighter/GeSHi11x.php +++ b/phpdotnet/phd/Highlighter/GeSHi11x.php @@ -45,7 +45,7 @@ class Highlighter_GeSHi11x extends Highlighter * * @param string $format Output format (pdf, xhtml, troff, ...) * - * @return PhDHighlighter Highlighter object + * @return Highlighter Highlighter object */ public static function factory($format) { @@ -122,7 +122,7 @@ public function highlight($text, $role, $format) * * @param string $role Source code role to use (php, xml, html, ...) * - * @return string Language name for GeSHi or null if not found. + * @return ?string Language name for GeSHi or null if not found. */ protected function getGeSHiLanguage($role) { diff --git a/phpdotnet/phd/Options/Handler.php b/phpdotnet/phd/Options/Handler.php index e2eda75e..57ed16ae 100644 --- a/phpdotnet/phd/Options/Handler.php +++ b/phpdotnet/phd/Options/Handler.php @@ -242,7 +242,7 @@ public function option_outputfilename(string $k, mixed $v): array } /** - * @return array + * @return array> */ public function option_p(string $k, mixed $v): array { @@ -288,7 +288,7 @@ public function option_package(string $k, mixed $v): array } /** - * @return array + * @return array */ public function option_q(string $k, mixed $v): array { @@ -296,7 +296,7 @@ public function option_q(string $k, mixed $v): array } /** - * @return array + * @return array */ public function option_quit(string $k, mixed $v): array { diff --git a/phpdotnet/phd/Package/Generic/TocFeed.php b/phpdotnet/phd/Package/Generic/TocFeed.php index 43842dbf..0365b007 100644 --- a/phpdotnet/phd/Package/Generic/TocFeed.php +++ b/phpdotnet/phd/Package/Generic/TocFeed.php @@ -201,7 +201,7 @@ public function close() * Value is either Render::OPEN or Render::CLOSE * * @param integer $event Event flag (see Render class) - * @param mixed $val Additional value flag. Depends + * @param mixed $value Additional value flag. Depends * on $event type * * @return void @@ -490,7 +490,7 @@ public function CDATA($value) * to overwrite this method to return full absolute URIs, * or modify $targetBaseUri. * - * @param string $id Chunk ID + * @param string $for Chunk ID * @param string &$desc Description of link, to be filled if neccessary. * Not used here. * @param integer $type Format of description, Format::SDESC or diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index dde78ac5..35d84854 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -82,7 +82,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML { 'constructorsynopsis' => 'format_methodsynopsis', 'destructorsynopsis' => 'format_methodsynopsis', 'emphasis' => 'format_emphasis', - 'enumname' => 'span', 'entry' => array ( /* DEFAULT */ 'format_entry', 'row' => array( @@ -137,7 +136,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML { 'literal' => 'format_literal', 'literallayout' => 'pre', 'link' => 'format_link', - 'xref' => 'format_xref', 'manvolnum' => 'format_manvolnum', 'inlinemediaobject' => 'format_mediaobject', 'mediaobject' => 'format_mediaobject', @@ -759,7 +757,7 @@ public function format_literal($open, $name, $attrs) public function format_literal_text($value, $tag) { switch ($this->getRole()) { case 'infdec': - $value = (float)$value; + $value = (string) (float)$value; $p = strpos($value, '.'); $str = substr($value, 0, $p + 1); $str .= ''; @@ -840,7 +838,7 @@ public function format_container_chunk_top($open, $name, $attrs, $props) { $this->CURRENT_CHUNK = $id; $this->notify(Render::CHUNK, Render::CLOSE); $toc = ""; - if (!in_array($id, $this->TOC_WRITTEN ?? [])) { + if (!in_array($id, $this->TOC_WRITTEN)) { $toc = $this->createTOC($id, $name, $props); } @@ -877,7 +875,7 @@ public function format_container_chunk_below($open, $name, $attrs, $props) { } $toc = '
    '; - if (!in_array($id, $this->TOC_WRITTEN ?? [])) { + if (!in_array($id, $this->TOC_WRITTEN)) { $toc = $this->createTOC($id, $name, $props); } $toc .= "
\n"; @@ -2005,8 +2003,8 @@ public function format_table($open, $name, $attrs, $props) { if (isset($this->cchunk["tablefootnotes"]) && $this->cchunk["tablefootnotes"]) { $opts = array(Reader::XMLNS_DOCBOOK => array()); - $str = $this->format_tbody(true, "footnote", $opts, $props); - $str .= $this->format_row(true, "footnote", $opts, $props); + $str = $this->format_tbody(true, "footnote", $opts); + $str .= $this->format_row(true, "footnote", $opts); $str .= $this->format_entry(true, "footnote", $opts, $props+array("colspan" => $this->getColCount())); foreach ($this->cchunk["tablefootnotes"] as $k => $noteid) { @@ -2017,8 +2015,8 @@ public function format_table($open, $name, $attrs, $props) { } $str .= $this->format_entry(false, "footnote", $opts, $props); - $str .= $this->format_row(false, "footnote", $opts, $props); - $str .= $this->format_tbody(false, "footnote", $opts, $props); + $str .= $this->format_row(false, "footnote", $opts); + $str .= $this->format_tbody(false, "footnote", $opts); $this->cchunk["tablefootnotes"] = $this->dchunk["tablefootnotes"]; } diff --git a/phpdotnet/phd/Package/IDE/API.php b/phpdotnet/phd/Package/IDE/API.php index 8b4456af..97f6543f 100644 --- a/phpdotnet/phd/Package/IDE/API.php +++ b/phpdotnet/phd/Package/IDE/API.php @@ -83,7 +83,7 @@ public function __construct($dir) * Loads a function file and returns a Package_IDE_API_Function. * * @param string $filename File of the function. - * @return Package_IDE_API_Function Object representing the function. + * @return ?Package_IDE_API_Function Object representing the function. */ private function loadFunction($filename) { diff --git a/phpdotnet/phd/Package/IDE/API/Function.php b/phpdotnet/phd/Package/IDE/API/Function.php index adec46e4..fc0025ce 100644 --- a/phpdotnet/phd/Package/IDE/API/Function.php +++ b/phpdotnet/phd/Package/IDE/API/Function.php @@ -108,7 +108,7 @@ class Package_IDE_API_Function /** * Creates a new instance of Package_IDE_API_Function. * - * @param SimpleXMLElement $xmlElement A new SimpleXMLElement + * @param \SimpleXMLElement $xmlElement A new SimpleXMLElement * of the function file. */ public function __construct(\SimpleXMLElement $xmlElement) diff --git a/phpdotnet/phd/Package/IDE/API/Param.php b/phpdotnet/phd/Package/IDE/API/Param.php index ce34066d..0628964d 100644 --- a/phpdotnet/phd/Package/IDE/API/Param.php +++ b/phpdotnet/phd/Package/IDE/API/Param.php @@ -61,7 +61,7 @@ class Package_IDE_API_Param /** * Creates a new instance. * - * @param SimpleXMLElement $xmlElement + * @param \SimpleXMLElement $xmlElement */ public function __construct(\SimpleXMLElement $xmlElement) { diff --git a/phpdotnet/phd/Package/IDE/Base.php b/phpdotnet/phd/Package/IDE/Base.php index d6d8fda4..f1992040 100644 --- a/phpdotnet/phd/Package/IDE/Base.php +++ b/phpdotnet/phd/Package/IDE/Base.php @@ -121,7 +121,10 @@ function writeChunk() { public function renderHTML() { static $format = null; if ($format == null) { - $format = new Package_Generic_ChunkedXHTML($this->config); + $format = new Package_Generic_ChunkedXHTML( + $this->config, + $this->outputHandler + ); } return $format->parse(trim(ReaderKeeper::getReader()->readInnerXML())); } diff --git a/phpdotnet/phd/Package/IDE/demo.php b/phpdotnet/phd/Package/IDE/demo.php index 91877efe..fd7601cd 100644 --- a/phpdotnet/phd/Package/IDE/demo.php +++ b/phpdotnet/phd/Package/IDE/demo.php @@ -2,7 +2,7 @@ init(array()); function usage() { diff --git a/phpdotnet/phd/Package/PEAR/CHM.php b/phpdotnet/phd/Package/PEAR/CHM.php index f96dd38c..d016be5b 100755 --- a/phpdotnet/phd/Package/PEAR/CHM.php +++ b/phpdotnet/phd/Package/PEAR/CHM.php @@ -258,7 +258,7 @@ protected function appendChm($name, $ref, $hasChild) { if ($hasChild) fwrite($this->hhcStream, "{$this->offset(2)}
    \n"); fwrite($this->hhkStream, "
  • \n" . " \n" . - " \n" . + " \n" . " \n"); } elseif ($this->flags & Render::CLOSE) { if ($hasChild) { diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php index 6b126ec3..dcbc8cd7 100755 --- a/phpdotnet/phd/Package/PEAR/XHTML.php +++ b/phpdotnet/phd/Package/PEAR/XHTML.php @@ -146,7 +146,6 @@ abstract class Package_PEAR_XHTML extends Package_Generic_XHTML { 'phd:toc' => 'format_phd_toc', 'phpdoc:exception' => 'format_exception_chunk', 'releaseinfo' => 'format_div', - 'replaceable' => 'span', 'refname' => 'format_refname', 'refnamediv' => 'format_suppressed_tags', 'refpurpose' => 'format_refpurpose', @@ -678,8 +677,8 @@ public function format_phd_pearapi_text($value, $tag) * Highlighting an such is done in format_programlisting_text() * * - * @param string $value Value of the text to format. - * @param string $tag Tag name + * @param string $open Whether we should open or close this element + * @param string $name Tag name * @param array $attrs Array of attributes * * @return string Generated programlisting html diff --git a/phpdotnet/phd/Package/PHP/EnhancedCHM.php b/phpdotnet/phd/Package/PHP/EnhancedCHM.php index abc8fcb6..9be101cc 100644 --- a/phpdotnet/phd/Package/PHP/EnhancedCHM.php +++ b/phpdotnet/phd/Package/PHP/EnhancedCHM.php @@ -137,6 +137,7 @@ public function footer($id) { if ($noteUser) { $noteUser = '' . htmlspecialchars($noteUser) . ''; } + $noteTimestamp = $noteTimestamp === "" ? null : (int) $noteTimestamp; $noteDate = '' . date("d-M-Y h:i", $noteTimestamp) . ''; $anchor = ''; diff --git a/phpdotnet/phd/Package/PHP/Manpage.php b/phpdotnet/phd/Package/PHP/Manpage.php index 019e6049..9f1ab120 100644 --- a/phpdotnet/phd/Package/PHP/Manpage.php +++ b/phpdotnet/phd/Package/PHP/Manpage.php @@ -4,7 +4,6 @@ class Package_PHP_Manpage extends Package_Generic_Manpage { protected $elementmap = array( - 'phpdoc:varentry' => 'format_chunk', 'phpdoc:classref' => 'format_chunk', 'phpdoc:exception' => 'format_chunk', 'phpdoc:exceptionref' => 'format_chunk', @@ -64,7 +63,7 @@ public function update($event, $value = null) { } break; default: - return parent::update($event, $value); + parent::update($event, $value); break; } } diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 9adb2170..dcd9c2e5 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -668,7 +668,6 @@ public function format_type_methodparam_text($type, $tagname) { public function format_type_text($type, $tagname) { $t = strtr($this->normalizeFQN($type), ["_" => "-", "\\" => "-"]); - $fragment = ""; switch($t) { case "void": @@ -717,10 +716,10 @@ public function format_type_text($type, $tagname) { $classNames = ($type === "?") ? ($tagname . ' null') : ($tagname . ' ' . ltrim($type, "\\")); if ($href && $this->chunked) { - return '' .$type. ''; + return '' .$type. ''; } if ($href) { - return '' .$type. ''; + return '' .$type. ''; } return '' .$type. ''; } diff --git a/phpdotnet/phd/ReaderKeeper.php b/phpdotnet/phd/ReaderKeeper.php index f1a1bb34..d2abe0d9 100644 --- a/phpdotnet/phd/ReaderKeeper.php +++ b/phpdotnet/phd/ReaderKeeper.php @@ -35,7 +35,7 @@ public static function getReader() /** * Removes the reader from the top of the stack. * - * @return void + * @return mixed */ public static function popReader() {