Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion serendipity_event_markdown/lib/License.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PHP Markdown Lib
Copyright (c) 2004-2021 Michel Fortin
Copyright (c) 2004-2022 Michel Fortin
<https://michelf.ca/>
All rights reserved.

Expand Down
14 changes: 7 additions & 7 deletions serendipity_event_markdown/lib/Michelf/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2019 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand All @@ -18,7 +18,7 @@ class Markdown implements MarkdownInterface {
* Define the package version
* @var string
*/
const MARKDOWNLIB_VERSION = "2.0";
const MARKDOWNLIB_VERSION = "2.0.0";

/**
* Simple function interface - Initialize the parser and return the result
Expand All @@ -29,7 +29,7 @@ class Markdown implements MarkdownInterface {
* @param string $text
* @return string
*/
public static function defaultTransform($text) {
public static function defaultTransform(string $text): string {
// Take parser class on which this function was called.
$parser_class = static::class;

Expand Down Expand Up @@ -127,10 +127,10 @@ public static function defaultTransform($text) {
* Needed to insert a maximum bracked depth while converting to PHP.
*/
protected int $nested_brackets_depth = 6;
protected $nested_brackets_re;
protected string $nested_brackets_re;

protected int $nested_url_parenthesis_depth = 4;
protected $nested_url_parenthesis_re;
protected string $nested_url_parenthesis_re;

/**
* Table of hash values for escaped characters:
Expand Down Expand Up @@ -167,7 +167,7 @@ public function __construct() {
* Internal hashes used during transformation.
*/
protected array $urls = array();
protected $titles = array();
protected array $titles = array();
protected array $html_hashes = array();

/**
Expand Down Expand Up @@ -213,7 +213,7 @@ protected function teardown() {
* @param string $text
* @return string
*/
public function transform($text) {
public function transform(string $text): string {
$this->setup();

# Remove UTF-8 BOM and marker character in input, if present.
Expand Down
5 changes: 3 additions & 2 deletions serendipity_event_markdown/lib/Michelf/MarkdownExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2019 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand Down Expand Up @@ -601,6 +601,7 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
else {
$parsed .= $tag;
}
// @phpstan-ignore-next-line
} while ($depth >= 0);

return array($parsed, $text);
Expand Down Expand Up @@ -682,7 +683,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
// by the pattern.
$parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);

if (count($parts) < 3) {
if ($parts === false || count($parts) < 3) {
// End of $text reached with unbalenced tag(s).
// In that case, we return original text unchanged and pass the
// first character as filtered to prevent an infinite loop in the
Expand Down
6 changes: 3 additions & 3 deletions serendipity_event_markdown/lib/Michelf/MarkdownInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2021 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand All @@ -23,7 +23,7 @@ interface MarkdownInterface {
* @param string $text
* @return string
*/
public static function defaultTransform($text);
public static function defaultTransform(string $text): string;

/**
* Main function. Performs some preprocessing on the input text
Expand All @@ -34,5 +34,5 @@ public static function defaultTransform($text);
* @param string $text
* @return string
*/
public function transform($text);
public function transform(string $text): string;
}
Loading