From 913763005f61645528e7c5311be26dd3ddb1a287 Mon Sep 17 00:00:00 2001 From: Thoriq Firdaus <2067467+tfirdaus@users.noreply.github.com> Date: Sun, 4 Aug 2024 08:33:49 +0700 Subject: [PATCH] Sync classes (#29) Sync classes from WordPress.org repository. --- app/Markdown.php | 4 ++++ app/Parser.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/app/Markdown.php b/app/Markdown.php index ab3ee28..37b0e08 100644 --- a/app/Markdown.php +++ b/app/Markdown.php @@ -25,6 +25,7 @@ class Markdown extends MarkdownExtra { /** * @param string $text + * * @return string */ public function transform($text) @@ -41,6 +42,7 @@ public function transform($text) /** * @param string $text + * * @return string * * @access protected @@ -62,6 +64,7 @@ protected function code_trick($text) /** * @param array $matches + * * @return string * * @access protected @@ -76,6 +79,7 @@ protected function code_trick_indent_cb($matches) /** * @param array $matches + * * @return string * * @access protected diff --git a/app/Parser.php b/app/Parser.php index 8dc8815..2fff0fb 100644 --- a/app/Parser.php +++ b/app/Parser.php @@ -213,6 +213,7 @@ public function __construct($string = '') /** * @param string $file_or_url + * * @return bool */ protected function parse_readme($file_or_url) @@ -228,6 +229,7 @@ protected function parse_readme($file_or_url) /** * @param string $contents The contents of the readme to parse. + * * @return bool */ protected function parse_readme_contents($contents) @@ -559,6 +561,7 @@ protected function parse_readme_contents($contents) /** * @param string $contents + * * @return string * * @access protected @@ -577,6 +580,7 @@ protected function get_first_nonwhitespace(&$contents) /** * @param string $line + * * @return string * * @access protected @@ -590,6 +594,7 @@ protected function strip_newlines($line) * @param string $desc * @param int $length * @param string $type The type of the length, 'char' or 'words'. + * * @return string * * @access protected @@ -646,6 +651,7 @@ protected function trim_length($desc, $length = 150, $type = 'char') * * @param string $line The line from the readme to parse. * @param bool $only_valid Whether to only return a valid known header. + * * @return false|array * * @access protected @@ -669,6 +675,7 @@ protected function parse_possible_header($line, $only_valid = false) /** * @param string $text + * * @return string * * @access protected @@ -715,6 +722,7 @@ protected function filter_text($text) /** * @param string $text + * * @return string * * @access protected @@ -733,6 +741,7 @@ protected function sanitize_text($text) * Sanitize provided contributors to valid WordPress users * * @param array $users Array of user_login's or user_nicename's. + * * @return array Array of user_logins. */ protected function sanitize_contributors($users) @@ -768,6 +777,7 @@ protected function sanitize_contributors($users) * Sanitize the provided stable tag to something we expect. * * @param string $stable_tag the raw Stable Tag line from the readme. + * * @return string The sanitized $stable_tag. */ protected function sanitize_stable_tag($stable_tag) @@ -789,6 +799,7 @@ protected function sanitize_stable_tag($stable_tag) * Sanitizes the Requires PHP header to ensure that it's a valid version header. * * @param string $version + * * @return string The sanitized $version */ protected function sanitize_requires_php($version) @@ -809,6 +820,7 @@ protected function sanitize_requires_php($version) * Sanitizes the Tested header to ensure that it's a valid version header. * * @param string $version + * * @return string The sanitized $version */ protected function sanitize_tested_version($version) @@ -848,6 +860,7 @@ protected function sanitize_tested_version($version) * Sanitizes the Requires at least header to ensure that it's a valid version header. * * @param string $version + * * @return string The sanitized $version */ protected function sanitize_requires_version($version) @@ -890,6 +903,7 @@ protected function sanitize_requires_version($version) * We support headings which are either `= Heading`, `# Heading` or `** Heading`. * * @param string|array $lines The lines of the section to parse. + * * @return array */ protected function parse_section($lines) @@ -955,6 +969,7 @@ protected function parse_section($lines) /** * @param string $text + * * @return string */ protected function parse_markdown($text) @@ -979,6 +994,7 @@ protected function parse_markdown($text) * NOTE: This does not require a SPDX license to be specified, but it should be a valid license nonetheless. * * @param string $license The specified license. + * * @return string|bool True if it looks good, error code on failure. */ public function validate_license($license)