summaryrefslogtreecommitdiff
path: root/vendor/league/commonmark
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2020-05-01 09:15:47 +0100
committerGreg Roach <greg@subaqua.co.uk>2020-05-01 09:15:47 +0100
commitd6acaa74db247ba3b4ae1a6a2b1d54f6b5e96518 (patch)
tree6cac024125fcf3ecd634fe399b28e48bdb72fd02 /vendor/league/commonmark
parentb2e8ac928ca0776aba7835b4a4cbe65b22a8b99f (diff)
downloadwebtrees-d6acaa74db247ba3b4ae1a6a2b1d54f6b5e96518.tar.gz
webtrees-d6acaa74db247ba3b4ae1a6a2b1d54f6b5e96518.tar.bz2
webtrees-d6acaa74db247ba3b4ae1a6a2b1d54f6b5e96518.zip
Update vendor dependencies
Diffstat (limited to 'vendor/league/commonmark')
-rw-r--r--vendor/league/commonmark/.editorconfig14
-rw-r--r--vendor/league/commonmark/.phpstorm.meta.php5
-rw-r--r--vendor/league/commonmark/CHANGELOG.md64
-rw-r--r--vendor/league/commonmark/README.md8
-rwxr-xr-xvendor/league/commonmark/bin/commonmark2
-rw-r--r--vendor/league/commonmark/commonmark-banner.pngbin124118 -> 0 bytes
-rw-r--r--vendor/league/commonmark/composer.json2
-rw-r--r--vendor/league/commonmark/src/Block/Element/AbstractBlock.php12
-rw-r--r--vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php11
-rw-r--r--vendor/league/commonmark/src/Block/Element/BlockQuote.php18
-rw-r--r--vendor/league/commonmark/src/Block/Element/Document.php16
-rw-r--r--vendor/league/commonmark/src/Block/Element/FencedCode.php29
-rw-r--r--vendor/league/commonmark/src/Block/Element/Heading.php16
-rw-r--r--vendor/league/commonmark/src/Block/Element/HtmlBlock.php18
-rw-r--r--vendor/league/commonmark/src/Block/Element/IndentedCode.php16
-rw-r--r--vendor/league/commonmark/src/Block/Element/ListBlock.php32
-rw-r--r--vendor/league/commonmark/src/Block/Element/ListItem.php18
-rw-r--r--vendor/league/commonmark/src/Block/Element/Paragraph.php16
-rw-r--r--vendor/league/commonmark/src/Block/Element/StringContainerInterface.php4
-rw-r--r--vendor/league/commonmark/src/Block/Element/ThematicBreak.php12
-rw-r--r--vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/ListParser.php11
-rw-r--r--vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php6
-rw-r--r--vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php2
-rw-r--r--vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php3
-rw-r--r--vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php2
-rw-r--r--vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php2
-rw-r--r--vendor/league/commonmark/src/CommonMarkConverter.php7
-rw-r--r--vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php8
-rw-r--r--vendor/league/commonmark/src/Context.php34
-rw-r--r--vendor/league/commonmark/src/ContextInterface.php8
-rw-r--r--vendor/league/commonmark/src/Converter.php13
-rw-r--r--vendor/league/commonmark/src/ConverterInterface.php16
-rw-r--r--vendor/league/commonmark/src/Cursor.php34
-rw-r--r--vendor/league/commonmark/src/Delimiter/Delimiter.php46
-rw-r--r--vendor/league/commonmark/src/Delimiter/DelimiterInterface.php35
-rw-r--r--vendor/league/commonmark/src/Delimiter/DelimiterStack.php26
-rw-r--r--vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php2
-rw-r--r--vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php2
-rw-r--r--vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php2
-rw-r--r--vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php18
-rw-r--r--vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php21
-rw-r--r--vendor/league/commonmark/src/DocParser.php61
-rw-r--r--vendor/league/commonmark/src/Environment.php110
-rw-r--r--vendor/league/commonmark/src/Event/AbstractEvent.php1
-rw-r--r--vendor/league/commonmark/src/Event/DocumentParsedEvent.php6
-rw-r--r--vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php48
-rw-r--r--vendor/league/commonmark/src/Exception/InvalidOptionException.php16
-rw-r--r--vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php2
-rw-r--r--vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php12
-rw-r--r--vendor/league/commonmark/src/Extension/Autolink/README.md73
-rw-r--r--vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php10
-rw-r--r--vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php7
-rw-r--r--vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php7
-rw-r--r--vendor/league/commonmark/src/Extension/ExtensionInterface.php5
-rw-r--r--vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php10
-rw-r--r--vendor/league/commonmark/src/Extension/ExternalLink/README.md100
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php33
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php28
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php94
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php62
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php32
-rw-r--r--vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php24
-rw-r--r--vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php3
-rw-r--r--vendor/league/commonmark/src/Extension/InlinesOnly/README.md25
-rw-r--r--vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php5
-rw-r--r--vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php13
-rw-r--r--vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php22
-rw-r--r--vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php2
-rw-r--r--vendor/league/commonmark/src/Extension/SmartPunct/README.md47
-rw-r--r--vendor/league/commonmark/src/Extension/Strikethrough/README.md27
-rw-r--r--vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php3
-rw-r--r--vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php15
-rw-r--r--vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php3
-rw-r--r--vendor/league/commonmark/src/Extension/Table/README.md78
-rw-r--r--vendor/league/commonmark/src/Extension/Table/Table.php3
-rw-r--r--vendor/league/commonmark/src/Extension/Table/TableCell.php3
-rw-r--r--vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php2
-rw-r--r--vendor/league/commonmark/src/Extension/Table/TableParser.php17
-rw-r--r--vendor/league/commonmark/src/Extension/Table/TableSection.php1
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php65
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php31
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php19
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php62
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php18
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php166
-rw-r--r--vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php24
-rw-r--r--vendor/league/commonmark/src/Extension/TaskList/README.md33
-rw-r--r--vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php1
-rw-r--r--vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php8
-rw-r--r--vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php2
-rw-r--r--vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php2
-rw-r--r--vendor/league/commonmark/src/HtmlElement.php17
-rw-r--r--vendor/league/commonmark/src/Inline/AdjacentTextMerger.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Element/AbstractInline.php5
-rw-r--r--vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php4
-rw-r--r--vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php3
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Emphasis.php3
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Image.php5
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Link.php5
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Newline.php7
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Strong.php3
-rw-r--r--vendor/league/commonmark/src/Inline/Element/Text.php2
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/BacktickParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/BangParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php30
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/EntityParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/EscapableParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/NewlineParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php8
-rw-r--r--vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php3
-rw-r--r--vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php3
-rw-r--r--vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php3
-rw-r--r--vendor/league/commonmark/src/InlineParserContext.php16
-rw-r--r--vendor/league/commonmark/src/InlineParserEngine.php7
-rw-r--r--vendor/league/commonmark/src/Input/MarkdownInput.php82
-rw-r--r--vendor/league/commonmark/src/Input/MarkdownInputInterface.php24
-rw-r--r--vendor/league/commonmark/src/MarkdownConverterInterface.php31
-rw-r--r--vendor/league/commonmark/src/Node/Node.php46
-rw-r--r--vendor/league/commonmark/src/Node/NodeWalker.php5
-rw-r--r--vendor/league/commonmark/src/Node/NodeWalkerEvent.php6
-rw-r--r--vendor/league/commonmark/src/Reference/Reference.php18
-rw-r--r--vendor/league/commonmark/src/Reference/ReferenceInterface.php9
-rw-r--r--vendor/league/commonmark/src/Reference/ReferenceMap.php12
-rw-r--r--vendor/league/commonmark/src/UnmatchedBlockCloser.php11
-rw-r--r--vendor/league/commonmark/src/Util/ArrayCollection.php153
-rw-r--r--vendor/league/commonmark/src/Util/Configuration.php17
-rw-r--r--vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php2
-rw-r--r--vendor/league/commonmark/src/Util/ConfigurationInterface.php10
-rw-r--r--vendor/league/commonmark/src/Util/Html5Entities.php2
-rw-r--r--vendor/league/commonmark/src/Util/Html5EntityDecoder.php10
-rw-r--r--vendor/league/commonmark/src/Util/LinkParserHelper.php10
-rw-r--r--vendor/league/commonmark/src/Util/PrioritizedList.php18
-rw-r--r--vendor/league/commonmark/src/Util/RegexHelper.php12
-rw-r--r--vendor/league/commonmark/src/Util/UrlEncoder.php6
143 files changed, 1366 insertions, 1400 deletions
diff --git a/vendor/league/commonmark/.editorconfig b/vendor/league/commonmark/.editorconfig
deleted file mode 100644
index 6923a8d414..0000000000
--- a/vendor/league/commonmark/.editorconfig
+++ /dev/null
@@ -1,14 +0,0 @@
-; top-most EditorConfig file
-root = true
-
-# All files.
-[*]
-end_of_line = LF
-indent_style = space
-indent_size = 4
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-
-[.travis.yml]
-indent_size = 2
diff --git a/vendor/league/commonmark/.phpstorm.meta.php b/vendor/league/commonmark/.phpstorm.meta.php
index d37ba2801f..6664a7abf5 100644
--- a/vendor/league/commonmark/.phpstorm.meta.php
+++ b/vendor/league/commonmark/.phpstorm.meta.php
@@ -11,9 +11,8 @@
namespace PHPSTORM_META
{
- expectedArguments(\League\CommonMark\Context::setEncoding(), 0, 'UTF-8', 'ASCII');
- expectedArguments(\League\CommonMark\Cursor::__construct(), 1, 'UTF-8', 'ASCII');
expectedArguments(\League\CommonMark\HtmlElement::__construct(), 0, 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kdb', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr');
+
expectedArguments(\League\CommonMark\Block\Element\Heading::__construct(), 0, 1, 2, 3, 4, 5, 6);
expectedReturnValues(\League\CommonMark\Block\Element\Heading::getLevel(), 1, 2, 3, 4, 5, 6);
@@ -28,7 +27,7 @@ namespace PHPSTORM_META
expectedArguments(\League\CommonMark\Inline\Element\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types'));
expectedReturnValues(\League\CommonMark\Inline\Element\Newline::getType(), argumentsSet('league_commonmark_newline_types'));
- registerArgumentsSet('league_commonmark_options', 'renderer', 'enable_em', 'enable_strong', 'use_asterisk', 'use_underscore', 'unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level');
+ registerArgumentsSet('league_commonmark_options', 'renderer', 'enable_em', 'enable_strong', 'use_asterisk', 'use_underscore', 'unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level', 'heading_permalink', 'heading_permalink/html_class', 'heading_permalink/id_prefix', 'heading_permalink/inner_contents', 'heading_permalink/insert', 'heading_permalink/title', 'table_of_contents', 'table_of_contents/style', 'table_of_contents/normalize', 'table_of_contents/position', 'table_of_contents/html_class', 'table_of_contents/min_heading_level', 'table_of_contents/max_heading_level');
expectedArguments(\League\CommonMark\EnvironmentInterface::getConfig(), 0, argumentsSet('league_commonmark_options'));
expectedArguments(\League\CommonMark\Util\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options'));
expectedArguments(\League\CommonMark\Util\ConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options'));
diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md
index 4d93c183f7..76c9edc16f 100644
--- a/vendor/league/commonmark/CHANGELOG.md
+++ b/vendor/league/commonmark/CHANGELOG.md
@@ -4,6 +4,64 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
## [Unreleased][unreleased]
+## [1.4.2] - 2020-04-24
+
+### Fixed
+
+ - Fixed inline code blocks not be included within heading permalinks (#457)
+
+## [1.4.1] - 2020-04-20
+
+### Fixed
+
+ - Fixed BC break caused by ConverterInterface alias not being used by some DI containers (#454)
+
+## [1.4.0] - 2020-04-18
+
+### Added
+
+ - Added new [Heading Permalink extension](https://commonmark.thephpleague.com/extensions/heading-permalinks/) (#420)
+ - Added new [Table of Contents extension](https://commonmark.thephpleague.com/extensions/table-of-contents/) (#441)
+ - Added new `MarkdownConverterInterface` as a long-term replacement for `ConverterInterface` (#439)
+ - Added new `DocumentPreParsedEvent` event (#427, #359, #399)
+ - Added new `ListBlock::TYPE_BULLET` constant as a replacement for `ListBlock::TYPE_UNORDERED`
+ - Added new `MarkdownInput` class and `MarkdownInputInterface` to handle pre-parsing and allow listeners to replace Markdown contents
+
+### Changed
+
+ - Block & inline renderers will now render child classes automatically (#222, #209)
+ - The `ListBlock` constants now use fully-lowercased values instead of titlecased values
+ - Significantly improved typing
+
+### Fixed
+
+ - Fixed loose comparison when checking for table alignment
+ - Fixed `StaggeredDelimiterProcessor` returning from a `void` function
+
+### Deprecated
+
+ - The `Converter` class has been deprecated; use `CommonMarkConverter` instead (#438, #439)
+ - The `ConverterInterface` has been deprecated; use `MarkdownConverterInterface` instead (#438, #439)
+ - The `bin/commonmark` script has been deprecated
+ - The following methods of `ArrayCollection` have been deprecated:
+ - `add()`
+ - `set()`
+ - `get()`
+ - `remove()`
+ - `isEmpty()`
+ - `contains()`
+ - `indexOf()`
+ - `containsKey()`
+ - `replaceWith()`
+ - `removeGaps()`
+ - The `ListBlock::TYPE_UNORDERED` constant has been deprecated, use `ListBlock::TYPE_BULLET` instead
+
+## [1.3.4] - 2020-04-13
+
+### Fixed
+
+ - Fixed configuration/environment not being injected into event listeners when adding them via `[$instance, 'method']` callable syntax (#440)
+
## [1.3.3] - 2020-04-05
### Fixed
@@ -237,7 +295,11 @@ No changes were made since 1.0.0-rc1.
- Removed `DelimiterStack::iterateByCharacters()` (use the new `processDelimiters()` method instead)
- Removed the protected `DelimiterStack::findMatchingOpener()` method
-[unreleased]: https://github.com/thephpleague/commonmark/compare/1.3.3...HEAD
+[unreleased]: https://github.com/thephpleague/commonmark/compare/1.4.2...HEAD
+[1.4.2]: https://github.com/thephpleague/commonmark/compare/1.4.1...1.4.2
+[1.4.1]: https://github.com/thephpleague/commonmark/compare/1.4.0...1.4.1
+[1.4.0]: https://github.com/thephpleague/commonmark/compare/1.3.4...1.4.0
+[1.3.4]: https://github.com/thephpleague/commonmark/compare/1.3.3...1.3.4
[1.3.3]: https://github.com/thephpleague/commonmark/compare/1.3.2...1.3.3
[1.3.2]: https://github.com/thephpleague/commonmark/compare/1.3.1...1.3.2
[1.3.1]: https://github.com/thephpleague/commonmark/compare/1.3.0...1.3.1
diff --git a/vendor/league/commonmark/README.md b/vendor/league/commonmark/README.md
index 33a3e59869..5b5f2fdfe1 100644
--- a/vendor/league/commonmark/README.md
+++ b/vendor/league/commonmark/README.md
@@ -8,7 +8,7 @@
[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/126/badge)](https://bestpractices.coreinfrastructure.org/projects/126)
-[![Support development with Patreon](https://img.shields.io/badge/patreon-donate-red.svg)](https://www.patreon.com/colinodell)
+[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor)
![league/commonmark](commonmark-banner.png)
@@ -74,7 +74,7 @@ The `GithubFlavoredMarkdownConverter` shown earlier is a drop-in replacement for
- Tables
- Task Lists
-See the [Extensions documentation](https://commonmark.thephpleague.com/1.0/customization/extensions/) for more details on how to include only certain GFM features if you don't want them all.
+See the [Extensions documentation](https://commonmark.thephpleague.com/customization/extensions/) for more details on how to include only certain GFM features if you don't want them all.
## 🗃️ Related Packages
@@ -91,7 +91,7 @@ See the [Extensions documentation](https://commonmark.thephpleague.com/1.0/custo
### Included Extensions
-See [our extension documentation](https://commonmark.thephpleague.com/1.0/customization/extensions/#included-extensions) for a full list of extensions bundled with this library.
+See [our extension documentation](https://commonmark.thephpleague.com/customization/extensions/#included-extensions) for a full list of extensions bundled with this library.
### Community Extensions
@@ -176,7 +176,7 @@ We'd also like to extend our sincere thanks the following sponsors who support o
- [RIPS Technologies](https://www.ripstech.com/) for supporting this project with a complimentary [RIPS SaaS](https://www.ripstech.com/product/) license
- [JetBrains](https://www.jetbrains.com/) for supporting this project with complimentary [PhpStorm](https://www.jetbrains.com/phpstorm/) licenses
-Are you interested in sponsoring development of this project? [Make a pledge](https://www.patreon.com/join/colinodell) of $10 or more and we'll include your name [on our website](https://commonmark.thephpleague.com/#sponsors)!
+Are you interested in sponsoring development of this project? See <https://www.colinodell.com/sponsor> for a list of ways to contribute.
## 📄 License
diff --git a/vendor/league/commonmark/bin/commonmark b/vendor/league/commonmark/bin/commonmark
index ea3fc3b69b..4c009ac052 100755
--- a/vendor/league/commonmark/bin/commonmark
+++ b/vendor/league/commonmark/bin/commonmark
@@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php
+trigger_error('The "bin/commonmark" command has been deprecated since league/commonmark 1.4', E_USER_DEPRECATED);
+
requireAutoloader();
ini_set('display_errors', 'stderr');
diff --git a/vendor/league/commonmark/commonmark-banner.png b/vendor/league/commonmark/commonmark-banner.png
deleted file mode 100644
index 5ccbd149ff..0000000000
--- a/vendor/league/commonmark/commonmark-banner.png
+++ /dev/null
Binary files differ
diff --git a/vendor/league/commonmark/composer.json b/vendor/league/commonmark/composer.json
index e691593b1b..48f2509d8a 100644
--- a/vendor/league/commonmark/composer.json
+++ b/vendor/league/commonmark/composer.json
@@ -31,7 +31,7 @@
"github/gfm": "0.29.0",
"michelf/php-markdown": "~1.4",
"mikehaertl/php-shellcommand": "^1.4",
- "phpstan/phpstan-shim": "^0.11.5",
+ "phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^7.5",
"scrutinizer/ocular": "^1.5",
"symfony/finder": "^4.2"
diff --git a/vendor/league/commonmark/src/Block/Element/AbstractBlock.php b/vendor/league/commonmark/src/Block/Element/AbstractBlock.php
index 8fcc7e2f39..b8ac83b527 100644
--- a/vendor/league/commonmark/src/Block/Element/AbstractBlock.php
+++ b/vendor/league/commonmark/src/Block/Element/AbstractBlock.php
@@ -28,7 +28,7 @@ abstract class AbstractBlock extends Node
/**
* Used for storage of arbitrary data.
*
- * @var array
+ * @var array<string, mixed>
*/
public $data = [];
@@ -52,9 +52,6 @@ abstract class AbstractBlock extends Node
*/
protected $endLine;
- /**
- * @param Node|null $node
- */
protected function setParent(Node $node = null)
{
if ($node && !$node instanceof self) {
@@ -64,9 +61,6 @@ abstract class AbstractBlock extends Node
parent::setParent($node);
}
- /**
- * @return bool
- */
public function isContainer(): bool
{
return true;
@@ -161,6 +155,8 @@ abstract class AbstractBlock extends Node
/**
* @param bool $blank
+ *
+ * @return void
*/
public function setLastLineBlank(bool $blank)
{
@@ -195,6 +191,8 @@ abstract class AbstractBlock extends Node
*
* @param ContextInterface $context
* @param int $endLineNumber
+ *
+ * @return void
*/
public function finalize(ContextInterface $context, int $endLineNumber)
{
diff --git a/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php b/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php
index 52bf70511b..55466ad24d 100644
--- a/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php
+++ b/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php
@@ -24,7 +24,7 @@ use League\CommonMark\Util\ArrayCollection;
abstract class AbstractStringContainerBlock extends AbstractBlock implements StringContainerInterface
{
/**
- * @var ArrayCollection|string[]
+ * @var ArrayCollection<int, string>
*/
protected $strings;
@@ -41,18 +41,11 @@ abstract class AbstractStringContainerBlock extends AbstractBlock implements Str
$this->strings = new ArrayCollection();
}
- /**
- * @param string $line
- */
public function addLine(string $line)
{
- $this->strings->add($line);
+ $this->strings[] = $line;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
abstract public function handleRemainingContents(ContextInterface $context, Cursor $cursor);
public function getStringContent(): string
diff --git a/vendor/league/commonmark/src/Block/Element/BlockQuote.php b/vendor/league/commonmark/src/Block/Element/BlockQuote.php
index 9973b69096..7cbe6e175e 100644
--- a/vendor/league/commonmark/src/Block/Element/BlockQuote.php
+++ b/vendor/league/commonmark/src/Block/Element/BlockQuote.php
@@ -21,23 +21,11 @@ use League\CommonMark\Cursor;
*/
class BlockQuote extends AbstractBlock
{
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return true;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
@@ -56,12 +44,6 @@ class BlockQuote extends AbstractBlock
return false;
}
- /**
- * @param Cursor $cursor
- * @param int $currentLineNumber
- *
- * @return bool
- */
public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool
{
return false;
diff --git a/vendor/league/commonmark/src/Block/Element/Document.php b/vendor/league/commonmark/src/Block/Element/Document.php
index 4fe386d008..69f21042c9 100644
--- a/vendor/league/commonmark/src/Block/Element/Document.php
+++ b/vendor/league/commonmark/src/Block/Element/Document.php
@@ -23,9 +23,7 @@ use League\CommonMark\Reference\ReferenceMapInterface;
*/
class Document extends AbstractBlock
{
- /***
- * @var ReferenceMapInterface
- */
+ /** @var ReferenceMapInterface */
protected $referenceMap;
public function __construct(?ReferenceMapInterface $referenceMap = null)
@@ -43,23 +41,11 @@ class Document extends AbstractBlock
return $this->referenceMap;
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return true;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
diff --git a/vendor/league/commonmark/src/Block/Element/FencedCode.php b/vendor/league/commonmark/src/Block/Element/FencedCode.php
index ea4e263648..6f87519cf4 100644
--- a/vendor/league/commonmark/src/Block/Element/FencedCode.php
+++ b/vendor/league/commonmark/src/Block/Element/FencedCode.php
@@ -130,23 +130,11 @@ class FencedCode extends AbstractStringContainerBlock
return $this;
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return true;
@@ -173,7 +161,12 @@ class FencedCode extends AbstractStringContainerBlock
parent::finalize($context, $endLineNumber);
// first line becomes info string
- $this->info = RegexHelper::unescape(\trim($this->strings->first()));
+ $firstLine = $this->strings->first();
+ if ($firstLine === false) {
+ $firstLine = '';
+ }
+
+ $this->info = RegexHelper::unescape(\trim($firstLine));
if ($this->strings->count() === 1) {
$this->finalStringContents = '';
@@ -182,10 +175,6 @@ class FencedCode extends AbstractStringContainerBlock
}
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
/** @var self $container */
@@ -205,12 +194,6 @@ class FencedCode extends AbstractStringContainerBlock
$container->addLine($cursor->getRemainder());
}
- /**
- * @param Cursor $cursor
- * @param int $currentLineNumber
- *
- * @return bool
- */
public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool
{
return false;
diff --git a/vendor/league/commonmark/src/Block/Element/Heading.php b/vendor/league/commonmark/src/Block/Element/Heading.php
index f29f6d1876..5b4e470f6b 100644
--- a/vendor/league/commonmark/src/Block/Element/Heading.php
+++ b/vendor/league/commonmark/src/Block/Element/Heading.php
@@ -58,23 +58,11 @@ class Heading extends AbstractStringContainerBlock implements InlineContainerInt
$this->finalStringContents = \implode("\n", $this->strings->toArray());
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
@@ -85,10 +73,6 @@ class Heading extends AbstractStringContainerBlock implements InlineContainerInt
return false;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
// nothing to do; contents were already added via the constructor.
diff --git a/vendor/league/commonmark/src/Block/Element/HtmlBlock.php b/vendor/league/commonmark/src/Block/Element/HtmlBlock.php
index 7a7bedfe08..e869ed5b60 100644
--- a/vendor/league/commonmark/src/Block/Element/HtmlBlock.php
+++ b/vendor/league/commonmark/src/Block/Element/HtmlBlock.php
@@ -54,29 +54,19 @@ class HtmlBlock extends AbstractStringContainerBlock
/**
* @param int $type
+ *
+ * @return void
*/
public function setType(int $type)
{
$this->type = $type;
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return true;
@@ -98,10 +88,6 @@ class HtmlBlock extends AbstractStringContainerBlock
$this->finalStringContents = \implode("\n", $this->strings->toArray());
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
/** @var self $tip */
diff --git a/vendor/league/commonmark/src/Block/Element/IndentedCode.php b/vendor/league/commonmark/src/Block/Element/IndentedCode.php
index d1c03d4175..9dc90840ce 100644
--- a/vendor/league/commonmark/src/Block/Element/IndentedCode.php
+++ b/vendor/league/commonmark/src/Block/Element/IndentedCode.php
@@ -19,23 +19,11 @@ use League\CommonMark\Cursor;
class IndentedCode extends AbstractStringContainerBlock
{
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return true;
@@ -75,10 +63,6 @@ class IndentedCode extends AbstractStringContainerBlock
$this->finalStringContents = $tmp;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
/** @var self $tip */
diff --git a/vendor/league/commonmark/src/Block/Element/ListBlock.php b/vendor/league/commonmark/src/Block/Element/ListBlock.php
index 1d0f53bfce..abd5d054f5 100644
--- a/vendor/league/commonmark/src/Block/Element/ListBlock.php
+++ b/vendor/league/commonmark/src/Block/Element/ListBlock.php
@@ -22,8 +22,13 @@ use League\CommonMark\Cursor;
*/
class ListBlock extends AbstractBlock
{
- const TYPE_UNORDERED = 'Bullet';
- const TYPE_ORDERED = 'Ordered';
+ const TYPE_BULLET = 'bullet';
+ const TYPE_ORDERED = 'ordered';
+
+ /**
+ * @deprecated This constant is deprecated in league/commonmark 1.4 and will be removed in 2.0; use TYPE_BULLET instead
+ */
+ const TYPE_UNORDERED = self::TYPE_BULLET;
/**
* @var bool
@@ -48,9 +53,6 @@ class ListBlock extends AbstractBlock
return $this->listData;
}
- /**
- * @return bool
- */
public function endsWithBlankLine(): bool
{
if ($this->lastLineBlank) {
@@ -64,23 +66,11 @@ class ListBlock extends AbstractBlock
return false;
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return $block instanceof ListItem;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
@@ -119,19 +109,11 @@ class ListBlock extends AbstractBlock
}
}
- /**
- * @return bool
- */
public function isTight(): bool
{
return $this->tight;
}
- /**
- * @param bool $tight
- *
- * @return $this
- */
public function setTight(bool $tight): self
{
$this->tight = $tight;
diff --git a/vendor/league/commonmark/src/Block/Element/ListItem.php b/vendor/league/commonmark/src/Block/Element/ListItem.php
index 2fec6f037b..5675b3510f 100644
--- a/vendor/league/commonmark/src/Block/Element/ListItem.php
+++ b/vendor/league/commonmark/src/Block/Element/ListItem.php
@@ -39,23 +39,11 @@ class ListItem extends AbstractBlock
return $this->listData;
}
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return true;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
@@ -78,12 +66,6 @@ class ListItem extends AbstractBlock
return true;
}
- /**
- * @param Cursor $cursor
- * @param int $currentLineNumber
- *
- * @return bool
- */
public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool
{
return $cursor->isBlank() && $this->startLine < $currentLineNumber;
diff --git a/vendor/league/commonmark/src/Block/Element/Paragraph.php b/vendor/league/commonmark/src/Block/Element/Paragraph.php
index 8f8a1ffbfd..85c9411818 100644
--- a/vendor/league/commonmark/src/Block/Element/Paragraph.php
+++ b/vendor/league/commonmark/src/Block/Element/Paragraph.php
@@ -19,23 +19,11 @@ use League\CommonMark\Cursor;
class Paragraph extends AbstractStringContainerBlock implements InlineContainerInterface
{
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
@@ -91,10 +79,6 @@ class Paragraph extends AbstractStringContainerBlock implements InlineContainerI
return $referenceFound;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
$cursor->advanceToNextNonSpaceOrTab();
diff --git a/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php b/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php
index 54d1865b59..834145e7a8 100644
--- a/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php
+++ b/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php
@@ -24,6 +24,8 @@ interface StringContainerInterface
{
/**
* @param string $line
+ *
+ * @return void
*/
public function addLine(string $line);
@@ -35,6 +37,8 @@ interface StringContainerInterface
/**
* @param ContextInterface $context
* @param Cursor $cursor
+ *
+ * @return void
*/
public function handleRemainingContents(ContextInterface $context, Cursor $cursor);
}
diff --git a/vendor/league/commonmark/src/Block/Element/ThematicBreak.php b/vendor/league/commonmark/src/Block/Element/ThematicBreak.php
index 341e67f0e2..48e2fd66d0 100644
--- a/vendor/league/commonmark/src/Block/Element/ThematicBreak.php
+++ b/vendor/league/commonmark/src/Block/Element/ThematicBreak.php
@@ -18,23 +18,11 @@ use League\CommonMark\Cursor;
class ThematicBreak extends AbstractBlock
{
- /**
- * Returns true if this block can contain the given block as a child node
- *
- * @param AbstractBlock $block
- *
- * @return bool
- */
public function canContain(AbstractBlock $block): bool
{
return false;
}
- /**
- * Whether this is a code block
- *
- * @return bool
- */
public function isCode(): bool
{
return false;
diff --git a/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php b/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php
index 0448f441e2..8f03969deb 100644
--- a/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php
@@ -21,12 +21,6 @@ use League\CommonMark\Util\RegexHelper;
final class ATXHeadingParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php b/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php
index ce0f0c81b7..db18b1abfe 100644
--- a/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php
@@ -20,12 +20,6 @@ use League\CommonMark\Cursor;
final class BlockQuoteParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php b/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php
index 050d62873a..b243ac942b 100644
--- a/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php
@@ -20,12 +20,6 @@ use League\CommonMark\Cursor;
final class FencedCodeParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php b/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php
index 24e8886d78..1eaca70660 100644
--- a/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php
@@ -22,12 +22,6 @@ use League\CommonMark\Util\RegexHelper;
final class HtmlBlockParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php b/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php
index 52cc0e6f74..6846f67493 100644
--- a/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php
@@ -21,12 +21,6 @@ use League\CommonMark\Cursor;
final class IndentedCodeParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if (!$cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php b/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php
index d9bfa249db..754af7c659 100644
--- a/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php
@@ -19,12 +19,6 @@ use League\CommonMark\Cursor;
final class LazyParagraphParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if (!$cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/ListParser.php b/vendor/league/commonmark/src/Block/Parser/ListParser.php
index a438195587..b4cd133b17 100644
--- a/vendor/league/commonmark/src/Block/Parser/ListParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/ListParser.php
@@ -32,20 +32,11 @@ final class ListParser implements BlockParserInterface, ConfigurationAwareInterf
/** @var string|null */
private $listMarkerRegex;
- /**
- * {@inheritdoc}
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented() && !($context->getContainer() instanceof ListBlock)) {
@@ -64,7 +55,7 @@ final class ListParser implements BlockParserInterface, ConfigurationAwareInterf
if (\preg_match($this->listMarkerRegex ?? $this->generateListMarkerRegex(), $rest) === 1) {
$data = new ListData();
$data->markerOffset = $indent;
- $data->type = ListBlock::TYPE_UNORDERED;
+ $data->type = ListBlock::TYPE_BULLET;
$data->delimiter = null;
$data->bulletChar = $rest[0];
$markerLength = 1;
diff --git a/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php b/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php
index e7770ad46d..dc1bb630dd 100644
--- a/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php
@@ -23,12 +23,6 @@ use League\CommonMark\Util\RegexHelper;
final class SetExtHeadingParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php b/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php
index e9e6f214dd..ef1dc21cc5 100644
--- a/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php
+++ b/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php
@@ -21,12 +21,6 @@ use League\CommonMark\Util\RegexHelper;
final class ThematicBreakParser implements BlockParserInterface
{
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
public function parse(ContextInterface $context, Cursor $cursor): bool
{
if ($cursor->isIndented()) {
diff --git a/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php b/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php
index a7df51659d..5c354962b4 100644
--- a/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php
+++ b/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php
@@ -21,7 +21,7 @@ use League\CommonMark\ElementRendererInterface;
final class DocumentRenderer implements BlockRendererInterface
{
/**
- * @param AbstractBlock|Document $block
+ * @param Document $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
*
diff --git a/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php b/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php
index 82e3cdc04f..f45dcaf63b 100644
--- a/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php
+++ b/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php
@@ -52,9 +52,6 @@ final class HtmlBlockRenderer implements BlockRendererInterface, ConfigurationAw
return $block->getStringContent();
}
- /**
- * @param ConfigurationInterface $configuration
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
diff --git a/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php b/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php
index 62c483f597..93518b3aac 100644
--- a/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php
+++ b/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php
@@ -23,7 +23,7 @@ use League\CommonMark\Util\Xml;
final class IndentedCodeRenderer implements BlockRendererInterface
{
/**
- * @param AbstractBlock $block
+ * @param IndentedCode $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
*
diff --git a/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php b/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php
index 9683dbd9ba..8f04b6d5a2 100644
--- a/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php
+++ b/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php
@@ -36,7 +36,7 @@ final class ListBlockRenderer implements BlockRendererInterface
$listData = $block->getListData();
- $tag = $listData->type === ListBlock::TYPE_UNORDERED ? 'ul' : 'ol';
+ $tag = $listData->type === ListBlock::TYPE_BULLET ? 'ul' : 'ol';
$attrs = $block->getData('attributes', []);
diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php
index c10f684391..6833c5cdd1 100644
--- a/vendor/league/commonmark/src/CommonMarkConverter.php
+++ b/vendor/league/commonmark/src/CommonMarkConverter.php
@@ -24,7 +24,7 @@ class CommonMarkConverter extends Converter
*
* This might be a typical `x.y.z` version, or `x.y-dev`.
*/
- public const VERSION = '1.3.3';
+ public const VERSION = '1.4.2';
/** @var EnvironmentInterface */
protected $environment;
@@ -32,7 +32,7 @@ class CommonMarkConverter extends Converter
/**
* Create a new commonmark converter instance.
*
- * @param array $config
+ * @param array<string, mixed> $config
* @param EnvironmentInterface|null $environment
*/
public function __construct(array $config = [], EnvironmentInterface $environment = null)
@@ -50,9 +50,6 @@ class CommonMarkConverter extends Converter
parent::__construct(new DocParser($environment), new HtmlRenderer($environment));
}
- /**
- * @return EnvironmentInterface
- */
public function getEnvironment(): EnvironmentInterface
{
return $this->environment;
diff --git a/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php b/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php
index b47b1b92a0..8cbe47ccf2 100644
--- a/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php
+++ b/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php
@@ -24,12 +24,16 @@ use League\CommonMark\Inline\Renderer\InlineRendererInterface;
interface ConfigurableEnvironmentInterface extends EnvironmentInterface
{
/**
- * @param array $config
+ * @param array<string, mixed> $config
+ *
+ * @return void
*/
public function mergeConfig(array $config = []);
/**
- * @param array $config
+ * @param array<string, mixed> $config
+ *
+ * @return void
*/
public function setConfig(array $config = []);
diff --git a/vendor/league/commonmark/src/Context.php b/vendor/league/commonmark/src/Context.php
index ea10a04f85..9b3d0234a1 100644
--- a/vendor/league/commonmark/src/Context.php
+++ b/vendor/league/commonmark/src/Context.php
@@ -83,6 +83,8 @@ class Context implements ContextInterface
/**
* @param string $line
+ *
+ * @return void
*/
public function setNextLine(string $line)
{
@@ -90,17 +92,11 @@ class Context implements ContextInterface
$this->line = $line;
}
- /**
- * @return Document
- */
public function getDocument(): Document
{
return $this->doc;
}
- /**
- * @return AbstractBlock|null
- */
public function getTip(): ?AbstractBlock
{
return $this->tip;
@@ -118,35 +114,21 @@ class Context implements ContextInterface
return $this;
}
- /**
- * @return int
- */
public function getLineNumber(): int
{
return $this->lineNumber;
}
- /**
- * @return string
- */
public function getLine(): string
{
return $this->line;
}
- /**
- * Finalize and close any unmatched blocks
- *
- * @return UnmatchedBlockCloser
- */
public function getBlockCloser(): UnmatchedBlockCloser
{
return $this->blockCloser;
}
- /**
- * @return AbstractBlock
- */
public function getContainer(): AbstractBlock
{
return $this->container;
@@ -164,9 +146,6 @@ class Context implements ContextInterface
return $this;
}
- /**
- * @param AbstractBlock $block
- */
public function addBlock(AbstractBlock $block)
{
$this->blockCloser->closeUnmatchedBlocks();
@@ -185,9 +164,6 @@ class Context implements ContextInterface
$this->container = $block;
}
- /**
- * @param AbstractBlock $replacement
- */
public function replaceContainerBlock(AbstractBlock $replacement)
{
$this->blockCloser->closeUnmatchedBlocks();
@@ -200,9 +176,6 @@ class Context implements ContextInterface
$this->container = $replacement;
}
- /**
- * @return bool
- */
public function getBlocksParsed(): bool
{
return $this->blocksParsed;
@@ -220,9 +193,6 @@ class Context implements ContextInterface
return $this;
}
- /**
- * @return ReferenceParser
- */
public function getReferenceParser(): ReferenceParser
{
return $this->referenceParser;
diff --git a/vendor/league/commonmark/src/ContextInterface.php b/vendor/league/commonmark/src/ContextInterface.php
index db623a0e45..8d04862d83 100644
--- a/vendor/league/commonmark/src/ContextInterface.php
+++ b/vendor/league/commonmark/src/ContextInterface.php
@@ -32,6 +32,8 @@ interface ContextInterface
/**
* @param AbstractBlock|null $block
+ *
+ * @return void
*/
public function setTip(?AbstractBlock $block);
@@ -59,16 +61,22 @@ interface ContextInterface
/**
* @param AbstractBlock $container
+ *
+ * @return void
*/
public function setContainer(AbstractBlock $container);
/**
* @param AbstractBlock $block
+ *
+ * @return void
*/
public function addBlock(AbstractBlock $block);
/**
* @param AbstractBlock $replacement
+ *
+ * @return void
*/
public function replaceContainerBlock(AbstractBlock $replacement);
diff --git a/vendor/league/commonmark/src/Converter.php b/vendor/league/commonmark/src/Converter.php
index 38d2abc4d0..570e556914 100644
--- a/vendor/league/commonmark/src/Converter.php
+++ b/vendor/league/commonmark/src/Converter.php
@@ -5,9 +5,6 @@
*
* (c) Colin O'Dell <colinodell@gmail.com>
*
- * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
- * - (c) John MacFarlane
- *
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@@ -16,20 +13,22 @@ namespace League\CommonMark;
/**
* Converts CommonMark-compatible Markdown to HTML.
+ *
+ * @deprecated This class is deprecated since league/commonmark 1.4, use CommonMarkConverter instead.
*/
class Converter implements ConverterInterface
{
/**
* The document parser instance.
*
- * @var \League\CommonMark\DocParserInterface
+ * @var DocParserInterface
*/
protected $docParser;
/**
* The html renderer instance.
*
- * @var \League\CommonMark\ElementRendererInterface
+ * @var ElementRendererInterface
*/
protected $htmlRenderer;
@@ -41,6 +40,10 @@ class Converter implements ConverterInterface
*/
public function __construct(DocParserInterface $docParser, ElementRendererInterface $htmlRenderer)
{
+ if (!($this instanceof CommonMarkConverter)) {
+ @trigger_error(sprintf('The %s class is deprecated since league/commonmark 1.4, use %s instead.', self::class, CommonMarkConverter::class), E_USER_DEPRECATED);
+ }
+
$this->docParser = $docParser;
$this->htmlRenderer = $htmlRenderer;
}
diff --git a/vendor/league/commonmark/src/ConverterInterface.php b/vendor/league/commonmark/src/ConverterInterface.php
index 974a20807e..85e261da7b 100644
--- a/vendor/league/commonmark/src/ConverterInterface.php
+++ b/vendor/league/commonmark/src/ConverterInterface.php
@@ -13,19 +13,9 @@ namespace League\CommonMark;
/**
* Interface for a service which converts CommonMark to HTML.
+ *
+ * @deprecated ConverterInterface is deprecated since league/commonmark 1.4, use MarkdownConverterInterface instead
*/
-interface ConverterInterface
+interface ConverterInterface extends MarkdownConverterInterface
{
- /**
- * Converts CommonMark to HTML.
- *
- * @param string $commonMark
- *
- * @throws \RuntimeException
- *
- * @return string HTML
- *
- * @api
- */
- public function convertToHtml(string $commonMark): string;
}
diff --git a/vendor/league/commonmark/src/Cursor.php b/vendor/league/commonmark/src/Cursor.php
index 0bf4386abd..f891347920 100644
--- a/vendor/league/commonmark/src/Cursor.php
+++ b/vendor/league/commonmark/src/Cursor.php
@@ -203,6 +203,8 @@ class Cursor
/**
* Move the cursor forwards
+ *
+ * @return void
*/
public function advance()
{
@@ -214,6 +216,8 @@ class Cursor
*
* @param int $characters Number of characters to advance by
* @param bool $advanceByColumns Whether to advance by columns instead of spaces
+ *
+ * @return void
*/
public function advanceBy(int $characters, bool $advanceByColumns = false)
{
@@ -355,9 +359,6 @@ class Cursor
return $this->currentPosition - $this->previousPosition;
}
- /**
- * @return string
- */
public function getRemainder(): string
{
if ($this->currentPosition >= $this->length) {
@@ -379,17 +380,11 @@ class Cursor
return $prefix . $subString;
}
- /**
- * @return string
- */
public function getLine(): string
{
return $this->line;
}
- /**
- * @return bool
- */
public function isAtEnd(): bool
{
return $this->currentPosition >= $this->length;
@@ -438,7 +433,7 @@ class Cursor
* passing it back into restoreState(), as the number of values and their
* contents may change in any future release without warning.
*
- * @return array
+ * @return array<mixed>
*/
public function saveState()
{
@@ -457,7 +452,9 @@ class Cursor
*
* Pass in the value previously obtained by calling saveState().
*
- * @param array $state
+ * @param array<mixed> $state
+ *
+ * @return void
*/
public function restoreState($state)
{
@@ -471,28 +468,16 @@ class Cursor
) = $state;
}
- /**
- * @return int
- */
public function getPosition(): int
{
return $this->currentPosition;
}
- /**
- * @return string
- */
public function getPreviousText(): string
{
return \mb_substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition, 'UTF-8');
}
- /**
- * @param int $start
- * @param int|null $length
- *
- * @return string
- */
public function getSubstring(int $start, ?int $length = null): string
{
if ($this->isMultibyte) {
@@ -504,9 +489,6 @@ class Cursor
return \substr($this->line, $start);
}
- /**
- * @return int
- */
public function getColumn(): int
{
return $this->column;
diff --git a/vendor/league/commonmark/src/Delimiter/Delimiter.php b/vendor/league/commonmark/src/Delimiter/Delimiter.php
index de01598f60..179543c46a 100644
--- a/vendor/league/commonmark/src/Delimiter/Delimiter.php
+++ b/vendor/league/commonmark/src/Delimiter/Delimiter.php
@@ -68,121 +68,81 @@ final class Delimiter implements DelimiterInterface
$this->index = $index;
}
- /**
- * {@inheritdoc}
- */
public function canClose(): bool
{
return $this->canClose;
}
/**
- * {@inheritdoc}
+ * @param bool $canClose
+ *
+ * @return void
*/
public function setCanClose(bool $canClose)
{
$this->canClose = $canClose;
}
- /**
- * {@inheritdoc}
- */
public function canOpen(): bool
{
return $this->canOpen;
}
- /**
- * {@inheritdoc}
- */
public function isActive(): bool
{
return $this->active;
}
- /**
- * {@inheritdoc}
- */
public function setActive(bool $active)
{
$this->active = $active;
}
- /**
- * {@inheritdoc}
- */
public function getChar(): string
{
return $this->char;
}
- /**
- * {@inheritdoc}
- */
public function getIndex(): ?int
{
return $this->index;
}
- /**
- * {@inheritdoc}
- */
public function getNext(): ?DelimiterInterface
{
return $this->next;
}
- /**
- * {@inheritdoc}
- */
public function setNext(?DelimiterInterface $next)
{
$this->next = $next;
}
- /**
- * {@inheritdoc}
- */
public function getLength(): int
{
return $this->length;
}
- /**
- * {@inheritdoc}
- */
public function setLength(int $length)
{
$this->length = $length;
}
- /**
- * {@inheritdoc}
- */
public function getOriginalLength(): int
{
return $this->originalLength;
}
- /**
- * {@inheritdoc}
- */
public function getInlineNode(): AbstractStringContainer
{
return $this->inlineNode;
}
- /**
- * {@inheritdoc}
- */
public function getPrevious(): ?DelimiterInterface
{
return $this->previous;
}
- /**
- * {@inheritdoc}
- */
public function setPrevious(?DelimiterInterface $previous): DelimiterInterface
{
$this->previous = $previous;
diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php
index abdca1154e..4669e36e75 100644
--- a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php
+++ b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php
@@ -18,23 +18,16 @@ use League\CommonMark\Inline\Element\AbstractStringContainer;
interface DelimiterInterface
{
- /**
- * @return bool
- */
public function canClose(): bool;
- /**
- * @return bool
- */
public function canOpen(): bool;
- /**
- * @return bool
- */
public function isActive(): bool;
/**
* @param bool $active
+ *
+ * @return void
*/
public function setActive(bool $active);
@@ -43,48 +36,36 @@ interface DelimiterInterface
*/
public function getChar(): string;
- /**
- * @return int|null
- */
public function getIndex(): ?int;
- /**
- * @return DelimiterInterface|null
- */
public function getNext(): ?DelimiterInterface;
/**
* @param DelimiterInterface|null $next
+ *
+ * @return void
*/
public function setNext(?DelimiterInterface $next);
- /**
- * @return int
- */
public function getLength(): int;
/**
* @param int $length
+ *
+ * @return void
*/
public function setLength(int $length);
- /**
- * @return int
- */
public function getOriginalLength(): int;
- /**
- * @return AbstractStringContainer
- */
public function getInlineNode(): AbstractStringContainer;
- /**
- * @return DelimiterInterface|null
- */
public function getPrevious(): ?DelimiterInterface;
/**
* @param DelimiterInterface|null $previous
+ *
+ * @return mixed|void
*/
public function setPrevious(?DelimiterInterface $previous);
}
diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php
index f4727d186e..a0bf2f9ff7 100644
--- a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php
+++ b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php
@@ -27,6 +27,11 @@ final class DelimiterStack
*/
private $top;
+ /**
+ * @param DelimiterInterface $newDelimiter
+ *
+ * @return void
+ */
public function push(DelimiterInterface $newDelimiter)
{
$newDelimiter->setPrevious($this->top);
@@ -38,11 +43,6 @@ final class DelimiterStack
$this->top = $newDelimiter;
}
- /**
- * @param DelimiterInterface|null $stackBottom
- *
- * @return DelimiterInterface|null
- */
private function findEarliest(DelimiterInterface $stackBottom = null): ?DelimiterInterface
{
$delimiter = $this->top;
@@ -55,6 +55,8 @@ final class DelimiterStack
/**
* @param DelimiterInterface $delimiter
+ *
+ * @return void
*/
public function removeDelimiter(DelimiterInterface $delimiter)
{
@@ -70,13 +72,13 @@ final class DelimiterStack
}
}
- private function removeDelimiterAndNode(DelimiterInterface $delimiter)
+ private function removeDelimiterAndNode(DelimiterInterface $delimiter): void
{
$delimiter->getInlineNode()->detach();
$this->removeDelimiter($delimiter);
}
- private function removeDelimitersBetween(DelimiterInterface $opener, DelimiterInterface $closer)
+ private function removeDelimitersBetween(DelimiterInterface $opener, DelimiterInterface $closer): void
{
$delimiter = $closer->getPrevious();
while ($delimiter !== null && $delimiter !== $opener) {
@@ -88,6 +90,8 @@ final class DelimiterStack
/**
* @param DelimiterInterface|null $stackBottom
+ *
+ * @return void
*/
public function removeAll(DelimiterInterface $stackBottom = null)
{
@@ -98,6 +102,8 @@ final class DelimiterStack
/**
* @param string $character
+ *
+ * @return void
*/
public function removeEarlierMatches(string $character)
{
@@ -133,6 +139,12 @@ final class DelimiterStack
return $opener;
}
+ /**
+ * @param DelimiterInterface|null $stackBottom
+ * @param DelimiterProcessorCollection $processors
+ *
+ * @return void
+ */
public function processDelimiters(?DelimiterInterface $stackBottom, DelimiterProcessorCollection $processors)
{
$openersBottom = [];
diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php
index 3b6a5cee16..03ced91d44 100644
--- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php
+++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php
@@ -50,7 +50,7 @@ final class DelimiterProcessorCollection implements DelimiterProcessorCollection
return \array_keys($this->processorsByChar);
}
- private function addDelimiterProcessorForChar(string $delimiterChar, DelimiterProcessorInterface $processor)
+ private function addDelimiterProcessorForChar(string $delimiterChar, DelimiterProcessorInterface $processor): void
{
if (isset($this->processorsByChar[$delimiterChar])) {
throw new \InvalidArgumentException(\sprintf('Delim processor for character "%s" already exists', $processor->getOpeningCharacter()));
diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php
index f35e0d16ea..58eba09ea4 100644
--- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php
+++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php
@@ -25,6 +25,8 @@ interface DelimiterProcessorCollectionInterface
* @param DelimiterProcessorInterface $processor The delim processor to add
*
* @throws \InvalidArgumentException Exception will be thrown if attempting to add multiple processors for the same character
+ *
+ * @return void
*/
public function add(DelimiterProcessorInterface $processor);
diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php
index bf2ff80130..d237781709 100644
--- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php
+++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php
@@ -79,6 +79,8 @@ interface DelimiterProcessorInterface
* @param AbstractStringContainer $opener The node that contained the opening delimiter
* @param AbstractStringContainer $closer The node that contained the closing delimiter
* @param int $delimiterUse The number of delimiters that were used
+ *
+ * @return void
*/
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse);
}
diff --git a/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php b/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php
index dfae1f3268..c4c54fdc6b 100644
--- a/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php
+++ b/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php
@@ -40,33 +40,21 @@ final class EmphasisDelimiterProcessor implements DelimiterProcessorInterface, C
$this->char = $char;
}
- /**
- * {@inheritdoc}
- */
public function getOpeningCharacter(): string
{
return $this->char;
}
- /**
- * {@inheritdoc}
- */
public function getClosingCharacter(): string
{
return $this->char;
}
- /**
- * {@inheritdoc}
- */
public function getMinLength(): int
{
return 1;
}
- /**
- * {@inheritdoc}
- */
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
{
// "Multiple of 3" rule for internal delimiter runs
@@ -90,9 +78,6 @@ final class EmphasisDelimiterProcessor implements DelimiterProcessorInterface, C
return 0;
}
- /**
- * {@inheritdoc}
- */
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse)
{
if ($delimiterUse === 1) {
@@ -113,9 +98,6 @@ final class EmphasisDelimiterProcessor implements DelimiterProcessorInterface, C
$opener->insertAfter($emphasis);
}
- /**
- * @param ConfigurationInterface $configuration
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
diff --git a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php b/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php
index ddcf2b8731..d5bdb6d0e6 100644
--- a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php
+++ b/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php
@@ -27,8 +27,10 @@ use League\CommonMark\Inline\Element\AbstractStringContainer;
*/
final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface
{
+ /** @var string */
private $delimiterChar;
+ /** @var int */
private $minLength = 0;
/** @var array<int, DelimiterProcessorInterface>|DelimiterProcessorInterface[] */
@@ -40,25 +42,16 @@ final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface
$this->add($processor);
}
- /**
- * {@inheritdoc}
- */
public function getOpeningCharacter(): string
{
return $this->delimiterChar;
}
- /**
- * {@inheritdoc}
- */
public function getClosingCharacter(): string
{
return $this->delimiterChar;
}
- /**
- * {@inheritdoc}
- */
public function getMinLength(): int
{
return $this->minLength;
@@ -68,6 +61,8 @@ final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface
* Adds the given processor to this staggered delimiter processor
*
* @param DelimiterProcessorInterface $processor
+ *
+ * @return void
*/
public function add(DelimiterProcessorInterface $processor)
{
@@ -83,20 +78,14 @@ final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface
$this->minLength = \min($this->minLength, $len);
}
- /**
- * {@inheritdoc}
- */
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
{
return $this->findProcessor($opener->getLength())->getDelimiterUse($opener, $closer);
}
- /**
- * {@inheritdoc}
- */
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse)
{
- return $this->findProcessor($delimiterUse)->process($opener, $closer, $delimiterUse);
+ $this->findProcessor($delimiterUse)->process($opener, $closer, $delimiterUse);
}
private function findProcessor(int $len): DelimiterProcessorInterface
diff --git a/vendor/league/commonmark/src/DocParser.php b/vendor/league/commonmark/src/DocParser.php
index dfc87d5327..c797290c72 100644
--- a/vendor/league/commonmark/src/DocParser.php
+++ b/vendor/league/commonmark/src/DocParser.php
@@ -20,7 +20,8 @@ use League\CommonMark\Block\Element\Document;
use League\CommonMark\Block\Element\Paragraph;
use League\CommonMark\Block\Element\StringContainerInterface;
use League\CommonMark\Event\DocumentParsedEvent;
-use League\CommonMark\Exception\UnexpectedEncodingException;
+use League\CommonMark\Event\DocumentPreParsedEvent;
+use League\CommonMark\Input\MarkdownInput;
final class DocParser implements DocParserInterface
{
@@ -52,26 +53,6 @@ final class DocParser implements DocParserInterface
/**
* @param string $input
*
- * @return string[]
- */
- private function preProcessInput(string $input): array
- {
- /** @var string[] $lines */
- $lines = \preg_split('/\r\n|\n|\r/', $input);
-
- // Remove any newline which appears at the very end of the string.
- // We've already split the document by newlines, so we can simply drop
- // any empty element which appears on the end.
- if (\end($lines) === '') {
- \array_pop($lines);
- }
-
- return $lines;
- }
-
- /**
- * @param string $input
- *
* @throws \RuntimeException
*
* @return Document
@@ -79,16 +60,19 @@ final class DocParser implements DocParserInterface
public function parse(string $input): Document
{
$document = new Document();
+
+ $preParsedEvent = new DocumentPreParsedEvent($document, new MarkdownInput($input));
+ $this->environment->dispatch($preParsedEvent);
+ $markdown = $preParsedEvent->getMarkdown();
+
$context = new Context($document, $this->environment);
- $this->assertValidUTF8($input);
- $lines = $this->preProcessInput($input);
- foreach ($lines as $line) {
+ foreach ($markdown->getLines() as $line) {
$context->setNextLine($line);
$this->incorporateLine($context);
}
- $lineCount = \count($lines);
+ $lineCount = $markdown->getLineCount();
while ($tip = $context->getTip()) {
$tip->finalize($context, $lineCount);
}
@@ -100,7 +84,7 @@ final class DocParser implements DocParserInterface
return $document;
}
- private function incorporateLine(ContextInterface $context)
+ private function incorporateLine(ContextInterface $context): void
{
$context->getBlockCloser()->resetTip();
$context->setBlocksParsed(false);
@@ -137,7 +121,7 @@ final class DocParser implements DocParserInterface
}
}
- private function processInlines(ContextInterface $context)
+ private function processInlines(ContextInterface $context): void
{
$walker = $context->getDocument()->walker();
@@ -159,7 +143,7 @@ final class DocParser implements DocParserInterface
* @param ContextInterface $context
* @param Cursor $cursor
*/
- private function resetContainer(ContextInterface $context, Cursor $cursor)
+ private function resetContainer(ContextInterface $context, Cursor $cursor): void
{
$container = $context->getDocument();
@@ -188,7 +172,7 @@ final class DocParser implements DocParserInterface
* @param ContextInterface $context
* @param Cursor $cursor
*/
- private function parseBlocks(ContextInterface $context, Cursor $cursor)
+ private function parseBlocks(ContextInterface $context, Cursor $cursor): void
{
while (!$context->getContainer()->isCode() && !$context->getBlocksParsed()) {
$parsed = false;
@@ -206,12 +190,6 @@ final class DocParser implements DocParserInterface
}
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- *
- * @return bool
- */
private function handleLazyParagraphContinuation(ContextInterface $context, Cursor $cursor): bool
{
$tip = $context->getTip();
@@ -230,11 +208,7 @@ final class DocParser implements DocParserInterface
return false;
}
- /**
- * @param ContextInterface $context
- * @param Cursor $cursor
- */
- private function setAndPropagateLastLineBlank(ContextInterface $context, Cursor $cursor)
+ private function setAndPropagateLastLineBlank(ContextInterface $context, Cursor $cursor): void
{
$container = $context->getContainer();
@@ -252,11 +226,4 @@ final class DocParser implements DocParserInterface
$container = $container->parent();
}
}
-
- private function assertValidUTF8(string $input)
- {
- if (!\mb_check_encoding($input, 'UTF-8')) {
- throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected');
- }
- }
}
diff --git a/vendor/league/commonmark/src/Environment.php b/vendor/league/commonmark/src/Environment.php
index c4ad5bde09..36640b9a34 100644
--- a/vendor/league/commonmark/src/Environment.php
+++ b/vendor/league/commonmark/src/Environment.php
@@ -90,6 +90,9 @@ final class Environment implements ConfigurableEnvironmentInterface
*/
private $inlineParserCharacterRegex;
+ /**
+ * @param array<string, mixed> $config
+ */
public function __construct(array $config = [])
{
$this->config = new Configuration($config);
@@ -99,9 +102,6 @@ final class Environment implements ConfigurableEnvironmentInterface
$this->delimiterProcessors = new DelimiterProcessorCollection();
}
- /**
- * {@inheritdoc}
- */
public function mergeConfig(array $config = [])
{
$this->assertUninitialized('Failed to modify configuration.');
@@ -109,9 +109,6 @@ final class Environment implements ConfigurableEnvironmentInterface
$this->config->merge($config);
}
- /**
- * {@inheritdoc}
- */
public function setConfig(array $config = [])
{
$this->assertUninitialized('Failed to modify configuration.');
@@ -119,17 +116,11 @@ final class Environment implements ConfigurableEnvironmentInterface
$this->config->replace($config);
}
- /**
- * {@inheritdoc}
- */
public function getConfig($key = null, $default = null)
{
return $this->config->get($key, $default);
}
- /**
- * {@inheritdoc}
- */
public function addBlockParser(BlockParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add block parser.');
@@ -140,9 +131,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- /**
- * {@inheritdoc}
- */
public function addInlineParser(InlineParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add inline parser.');
@@ -161,9 +149,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- /**
- * {@inheritdoc}
- */
public function addDelimiterProcessor(DelimiterProcessorInterface $processor): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add delimiter processor.');
@@ -173,9 +158,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- /**
- * {@inheritdoc}
- */
public function addBlockRenderer($blockClass, BlockRendererInterface $blockRenderer, int $priority = 0): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add block renderer.');
@@ -190,9 +172,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- /**
- * {@inheritdoc}
- */
public function addInlineRenderer(string $inlineClass, InlineRendererInterface $renderer, int $priority = 0): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add inline renderer.');
@@ -207,9 +186,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- /**
- * {@inheritdoc}
- */
public function getBlockParsers(): iterable
{
if (!$this->extensionsInitialized) {
@@ -219,9 +195,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this->blockParsers->getIterator();
}
- /**
- * {@inheritdoc}
- */
public function getInlineParsersForCharacter(string $character): iterable
{
if (!$this->extensionsInitialized) {
@@ -235,9 +208,6 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this->inlineParsersByCharacter[$character]->getIterator();
}
- /**
- * {@inheritdoc}
- */
public function getDelimiterProcessors(): DelimiterProcessorCollection
{
if (!$this->extensionsInitialized) {
@@ -247,36 +217,22 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this->delimiterProcessors;
}
- /**
- * {@inheritdoc}
- */
public function getBlockRenderersForClass(string $blockClass): iterable
{
if (!$this->extensionsInitialized) {
$this->initializeExtensions();
}
- if (!isset($this->blockRenderersByClass[$blockClass])) {
- return [];
- }
-
- return $this->blockRenderersByClass[$blockClass]->getIterator();
+ return $this->getRenderersByClass($this->blockRenderersByClass, $blockClass, BlockRendererInterface::class);
}
- /**
- * {@inheritdoc}
- */
public function getInlineRenderersForClass(string $inlineClass): iterable
{
if (!$this->extensionsInitialized) {
$this->initializeExtensions();
}
- if (!isset($this->inlineRenderersByClass[$inlineClass])) {
- return [];
- }
-
- return $this->inlineRenderersByClass[$inlineClass]->getIterator();
+ return $this->getRenderersByClass($this->inlineRenderersByClass, $inlineClass, InlineRendererInterface::class);
}
/**
@@ -306,7 +262,7 @@ final class Environment implements ConfigurableEnvironmentInterface
return $this;
}
- private function initializeExtensions()
+ private function initializeExtensions(): void
{
// Ask all extensions to register their components
while (!empty($this->uninitializedExtensions)) {
@@ -323,7 +279,10 @@ final class Environment implements ConfigurableEnvironmentInterface
$this->buildInlineParserCharacterRegex();
}
- private function injectEnvironmentAndConfigurationIfNeeded($object)
+ /**
+ * @param object $object
+ */
+ private function injectEnvironmentAndConfigurationIfNeeded($object): void
{
if ($object instanceof EnvironmentAwareInterface) {
$object->setEnvironment($this);
@@ -360,17 +319,11 @@ final class Environment implements ConfigurableEnvironmentInterface
return $environment;
}
- /**
- * {@inheritdoc}
- */
public function getInlineParserCharacterRegex(): string
{
return $this->inlineParserCharacterRegex;
}
- /**
- * {@inheritdoc}
- */
public function addEventListener(string $eventClass, callable $listener, int $priority = 0): ConfigurableEnvironmentInterface
{
$this->assertUninitialized('Failed to add event listener.');
@@ -383,14 +336,13 @@ final class Environment implements ConfigurableEnvironmentInterface
if (\is_object($listener)) {
$this->injectEnvironmentAndConfigurationIfNeeded($listener);
+ } elseif (\is_array($listener) && \is_object($listener[0])) {
+ $this->injectEnvironmentAndConfigurationIfNeeded($listener[0]);
}
return $this;
}
- /**
- * {@inheritdoc}
- */
public function dispatch(AbstractEvent $event): void
{
if (!$this->extensionsInitialized) {
@@ -408,7 +360,7 @@ final class Environment implements ConfigurableEnvironmentInterface
}
}
- private function buildInlineParserCharacterRegex()
+ private function buildInlineParserCharacterRegex(): void
{
$chars = \array_unique(\array_merge(
\array_keys($this->inlineParsersByCharacter),
@@ -429,10 +381,44 @@ final class Environment implements ConfigurableEnvironmentInterface
*
* @throws \RuntimeException
*/
- private function assertUninitialized(string $message)
+ private function assertUninitialized(string $message): void
{
if ($this->extensionsInitialized) {
throw new \RuntimeException($message . ' Extensions have already been initialized.');
}
}
+
+ /**
+ * @param array<string, PrioritizedList> $list
+ * @param string $class
+ * @param string $type
+ *
+ * @return iterable
+ *
+ * @phpstan-template T
+ *
+ * @phpstan-param array<string, PrioritizedList<T>> $list
+ * @phpstan-param string $class
+ * @phpstan-param class-string<T> $type
+ *
+ * @phpstan-return iterable<T>
+ */
+ private function getRenderersByClass(array &$list, string $class, string $type): iterable
+ {
+ // If renderers are defined for this specific class, return them immediately
+ if (isset($list[$class])) {
+ return $list[$class];
+ }
+
+ while ($parent = \get_parent_class($parent ?? $class)) {
+ if (!isset($list[$parent])) {
+ continue;
+ }
+
+ // "Cache" this result to avoid future loops
+ return $list[$class] = $list[$parent];
+ }
+
+ return [];
+ }
}
diff --git a/vendor/league/commonmark/src/Event/AbstractEvent.php b/vendor/league/commonmark/src/Event/AbstractEvent.php
index b2c04ffb0e..1ab2cc3a4b 100644
--- a/vendor/league/commonmark/src/Event/AbstractEvent.php
+++ b/vendor/league/commonmark/src/Event/AbstractEvent.php
@@ -25,6 +25,7 @@ namespace League\CommonMark\Event;
*/
abstract class AbstractEvent
{
+ /** @var bool */
private $propagationStopped = false;
/**
diff --git a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php
index e002e21c2c..ad5a9d4bf7 100644
--- a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php
+++ b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php
@@ -21,17 +21,11 @@ final class DocumentParsedEvent extends AbstractEvent
/** @var Document */
private $document;
- /**
- * @param Document $document
- */
public function __construct(Document $document)
{
$this->document = $document;
}
- /**
- * @return Document
- */
public function getDocument(): Document
{
return $this->document;
diff --git a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php
new file mode 100644
index 0000000000..b9d897e657
--- /dev/null
+++ b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php
@@ -0,0 +1,48 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Event;
+
+use League\CommonMark\Block\Element\Document;
+use League\CommonMark\Input\MarkdownInputInterface;
+
+/**
+ * Event dispatched when the document is about to be parsed
+ */
+final class DocumentPreParsedEvent extends AbstractEvent
+{
+ /** @var Document */
+ private $document;
+
+ /** @var MarkdownInputInterface */
+ private $markdown;
+
+ public function __construct(Document $document, MarkdownInputInterface $markdown)
+ {
+ $this->document = $document;
+ $this->markdown = $markdown;
+ }
+
+ public function getDocument(): Document
+ {
+ return $this->document;
+ }
+
+ public function getMarkdown(): MarkdownInputInterface
+ {
+ return $this->markdown;
+ }
+
+ public function replaceMarkdown(MarkdownInputInterface $markdownInput): void
+ {
+ $this->markdown = $markdownInput;
+ }
+}
diff --git a/vendor/league/commonmark/src/Exception/InvalidOptionException.php b/vendor/league/commonmark/src/Exception/InvalidOptionException.php
new file mode 100644
index 0000000000..610dde51cb
--- /dev/null
+++ b/vendor/league/commonmark/src/Exception/InvalidOptionException.php
@@ -0,0 +1,16 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Exception;
+
+final class InvalidOptionException extends \RuntimeException
+{
+}
diff --git a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php
index 6916d3c2e2..81be4160c0 100644
--- a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php
+++ b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php
@@ -36,7 +36,7 @@ final class EmailAutolinkProcessor
}
}
- private static function processAutolinks(Text $node)
+ private static function processAutolinks(Text $node): void
{
$contents = \preg_split(self::REGEX, $node->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE);
diff --git a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php b/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php
index 2bbd56c545..ab9a998f40 100644
--- a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php
+++ b/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php
@@ -33,17 +33,11 @@ final class InlineMentionParser implements InlineParserInterface
$this->handleRegex = $handleRegex;
}
- /**
- * {@inheritdoc}
- */
public function getCharacters(): array
{
return ['@'];
}
- /**
- * {@inheritdoc}
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
@@ -77,11 +71,17 @@ final class InlineMentionParser implements InlineParserInterface
return true;
}
+ /**
+ * @return InlineMentionParser
+ */
public static function createTwitterHandleParser()
{
return new self('https://twitter.com/%s', '/^[A-Za-z0-9_]{1,15}(?!\w)/');
}
+ /**
+ * @return InlineMentionParser
+ */
public static function createGithubHandleParser()
{
// RegEx adapted from https://github.com/shinnn/github-username-regex/blob/master/index.js
diff --git a/vendor/league/commonmark/src/Extension/Autolink/README.md b/vendor/league/commonmark/src/Extension/Autolink/README.md
deleted file mode 100644
index 3dfdb62477..0000000000
--- a/vendor/league/commonmark/src/Extension/Autolink/README.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# URL and email autolinking extension for `league/commonmark`
-
-This extension adds [GFM-style autolinking][link-gfm-spec-autolinking] to the [`league/commonmark` Markdown parser for PHP][link-league-commonmark]. It automatically link URLs and email addresses even when the CommonMark `<...>` autolink syntax is not used.
-
-It also provides a parser to autolink `@mentions` to Twitter, Github, or any custom service you wish, though this is disabled by default.
-
-## Usage
-
-Configure your `Environment` as usual and simply add the `AutolinkExtension` provided by this package:
-
-```php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\Autolink\AutolinkExtension;
-
-// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new AutolinkExtension());
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter([], $environment);
-echo $converter->convertToHtml('I successfully installed the https://github.com/thephpleague/commonmark project with the Autolink extension!');
-```
-
-## `@mention` Autolinking
-
-This extension also provides functionality to automatically link "mentions" like `@colinodell` to Twitter, Github, or any other site of your choice!
-
-For Twitter:
-
-```php
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\Autolink\InlineMentionParser;
-
-$environment = Environment::createCommonMarkEnvironment();
-$environment->addInlineParser(InlineMentionParser::createTwitterHandleParser());
-
-// TODO: Instantiate your converter and convert some Markdown
-```
-
-For GitHub:
-
-```php
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\Autolink\InlineMentionParser;
-
-$environment = Environment::createCommonMarkEnvironment();
-$environment->addInlineParser(InlineMentionParser::createGithubHandleParser());
-
-// TODO: Instantiate your converter and convert some Markdown
-```
-
-Or configure your own custom one:
-
-```php
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\Autolink\InlineMentionParser;
-
-$environment = Environment::createCommonMarkEnvironment();
-$environment->addInlineParser(new InlineMentionParser('https://www.example.com/users/%s/profile'));
-
-// TODO: Instantiate your converter and convert some Markdown
-```
-
-When creating your own, you can provide two parameters to the constructor:
-
- - A URL template where `%s` is replaced with the username (required)
- - A regular expression to parse and validate the username (optional - defaults to `'/^[A-Za-z0-9_]+(?!\w)/'`)
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
-[link-gfm-spec-autolinking]: https://github.github.com/gfm/#autolinks-extension-
diff --git a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php
index 8783e4e2e7..0c6c92c614 100644
--- a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php
+++ b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php
@@ -41,8 +41,12 @@ final class UrlAutolinkProcessor
(?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional)
)~ixu';
+ /** @var string */
private $finalRegex;
+ /**
+ * @param array<int, string> $allowedProtocols
+ */
public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'])
{
$this->finalRegex = \sprintf(self::REGEX, \implode('|', $allowedProtocols));
@@ -65,7 +69,7 @@ final class UrlAutolinkProcessor
}
}
- private static function processAutolinks(Text $node, $regex)
+ private static function processAutolinks(Text $node, string $regex): void
{
$contents = \preg_split($regex, $node->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -114,7 +118,7 @@ final class UrlAutolinkProcessor
$node->detach();
}
- private static function addLink(Text $node, $url)
+ private static function addLink(Text $node, string $url): void
{
// Auto-prefix 'http://' onto 'www' URLs
if (\substr($url, 0, 4) === 'www.') {
@@ -131,7 +135,7 @@ final class UrlAutolinkProcessor
*
* @return bool
*/
- private static function hasMoreCloserParensThanOpeners($content)
+ private static function hasMoreCloserParensThanOpeners(string $content): bool
{
// Scan the entire autolink for the total number of parentheses.
// If there is a greater number of closing parentheses than opening ones,
diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php
index 7947c5e7e5..1bd17d8692 100644
--- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php
+++ b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php
@@ -19,6 +19,7 @@ use League\CommonMark\Util\ConfigurationInterface;
final class DisallowedRawHtmlBlockRenderer implements BlockRendererInterface, ConfigurationAwareInterface
{
+ /** @var BlockRendererInterface */
private $htmlBlockRenderer;
public function __construct(BlockRendererInterface $htmlBlockRenderer)
@@ -26,9 +27,6 @@ final class DisallowedRawHtmlBlockRenderer implements BlockRendererInterface, Co
$this->htmlBlockRenderer = $htmlBlockRenderer;
}
- /**
- * {@inheritdoc}
- */
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false)
{
$rendered = $this->htmlBlockRenderer->render($block, $htmlRenderer, $inTightList);
@@ -41,9 +39,6 @@ final class DisallowedRawHtmlBlockRenderer implements BlockRendererInterface, Co
return preg_replace('/<(\/?(?:title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)[ \/>])/i', '&lt;$1', $rendered);
}
- /**
- * {@inheritdoc}
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
if ($this->htmlBlockRenderer instanceof ConfigurationAwareInterface) {
diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php
index 2783281ec9..12eaa78e7d 100644
--- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php
+++ b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php
@@ -19,6 +19,7 @@ use League\CommonMark\Util\ConfigurationInterface;
final class DisallowedRawHtmlInlineRenderer implements InlineRendererInterface, ConfigurationAwareInterface
{
+ /** @var InlineRendererInterface */
private $htmlInlineRenderer;
public function __construct(InlineRendererInterface $htmlBlockRenderer)
@@ -26,9 +27,6 @@ final class DisallowedRawHtmlInlineRenderer implements InlineRendererInterface,
$this->htmlInlineRenderer = $htmlBlockRenderer;
}
- /**
- * {@inheritdoc}
- */
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
{
$rendered = $this->htmlInlineRenderer->render($inline, $htmlRenderer);
@@ -41,9 +39,6 @@ final class DisallowedRawHtmlInlineRenderer implements InlineRendererInterface,
return preg_replace('/<(\/?(?:title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)[ \/>])/i', '&lt;$1', $rendered);
}
- /**
- * {@inheritdoc}
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
if ($this->htmlInlineRenderer instanceof ConfigurationAwareInterface) {
diff --git a/vendor/league/commonmark/src/Extension/ExtensionInterface.php b/vendor/league/commonmark/src/Extension/ExtensionInterface.php
index b2e1166138..d461ef6551 100644
--- a/vendor/league/commonmark/src/Extension/ExtensionInterface.php
+++ b/vendor/league/commonmark/src/Extension/ExtensionInterface.php
@@ -18,5 +18,10 @@ use League\CommonMark\ConfigurableEnvironmentInterface;
interface ExtensionInterface
{
+ /**
+ * @param ConfigurableEnvironmentInterface $environment
+ *
+ * @return void
+ */
public function register(ConfigurableEnvironmentInterface $environment);
}
diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php
index 200f35c0f1..5a2f66481b 100644
--- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php
+++ b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php
@@ -20,9 +20,6 @@ final class ExternalLinkProcessor
/** @var EnvironmentInterface */
private $environment;
- /**
- * @param EnvironmentInterface $environment
- */
public function __construct(EnvironmentInterface $environment)
{
$this->environment = $environment;
@@ -30,6 +27,8 @@ final class ExternalLinkProcessor
/**
* @param DocumentParsedEvent $e
+ *
+ * @return void
*/
public function __invoke(DocumentParsedEvent $e)
{
@@ -60,11 +59,6 @@ final class ExternalLinkProcessor
}
}
- /**
- * @param Link $link
- * @param bool $openInNewWindow
- * @param string $classes
- */
private function markLinkAsExternal(Link $link, bool $openInNewWindow, string $classes): void
{
$link->data['external'] = true;
diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/README.md b/vendor/league/commonmark/src/Extension/ExternalLink/README.md
deleted file mode 100644
index 2eec7e22c4..0000000000
--- a/vendor/league/commonmark/src/Extension/ExternalLink/README.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# Extension to denote external links for `league/commonmark`
-
-This extension to the [`league/commonmark` PHP Markdown parser][link-league-commonmark] can detect links to external sites and adjust the markup accordingly:
-
- - Adds a `rel="noopener noreferrer"` attribute
- - Optionally adds any custom HTML classes
-
-## Usage
-
-Configure your `Environment` as usual and simply add the `ExternalLinkExtension` provided by this package:
-
-```php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension;
-
-// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new ExternalLinkExtension());
-
-// Set your configuration
-$config = [
- 'external_link' => [
- 'internal_hosts' => 'www.example.com',
- 'open_in_new_window' => true,
- 'html_class' => 'external-link',
- ],
-];
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter($config, $environment);
-echo $converter->convertToHtml('I successfully installed the https://github.com/thephpleague/commonmark project with the Autolink extension!');
-```
-
-## Configuration
-
-This extension supports three configuration options under the `external_link` configuration:
-
-### `internal_hosts`
-
-This option defines a whitelist of hosts which are considered non-external and should not receive the external link treatment.
-
-This can be a single host name, like `'example.com'`, which must match exactly.
-
-If you need to match subdomains, use a regular expression like `'/(^|\.)example\.com$/'`. Note that you must use `/` characters to delimit your regex.
-
-This configuration option also accepts an array of multiple strings and/or regexes:
-
-```php
-$config = [
- 'external_link' => [
- 'internal_hosts' => ['foo.example.com', 'bar.example.com', '/(^|\.)google\.com$/],
- ],
-];
-```
-
-By default, if this option is not provided, all links will be considered external.
-
-### `open_in_new_window`
-
-This option (which defaults to `false`) determines whether any external links should open in a new tab/window.
-
-### `html_class`
-
-This option allows you to provide a `string` containing one or more HTML classes that should be added to the external link `<a>` tags: No classes are added by default.
-
-## Advanced Rendering
-
-When an external link is detected, the `ExternalLinkProcessor` will set the `external` data option on the `Link` node to either `true` or `false`. You can therefore create a [custom link renderer](https://commonmark.thephpleague.com/customization/inline-rendering/) which checks this value and behaves accordingly:
-
-```php
-class MyCustomLinkRenderer implements InlineRendererInterface
-{
-
- /**
- * @param Link $inline
- * @param ElementRendererInterface $htmlRenderer
- *
- * @return HtmlElement
- */
- public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
- {
- if (!($inline instanceof Link)) {
- throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline));
- }
-
- if ($inline->getData('external')) {
- // This is an external link - render it accordingly
- } else {
- // This is an internal link
- }
-
- // ...
- }
-}
-```
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php
new file mode 100644
index 0000000000..c5975ed479
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php
@@ -0,0 +1,33 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink;
+
+use League\CommonMark\Inline\Element\AbstractInline;
+
+/**
+ * Represents an anchor link within a heading
+ */
+final class HeadingPermalink extends AbstractInline
+{
+ /** @var string */
+ private $slug;
+
+ public function __construct(string $slug)
+ {
+ $this->slug = $slug;
+ }
+
+ public function getSlug(): string
+ {
+ return $this->slug;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php
new file mode 100644
index 0000000000..161674384b
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink;
+
+use League\CommonMark\ConfigurableEnvironmentInterface;
+use League\CommonMark\Event\DocumentParsedEvent;
+use League\CommonMark\Extension\ExtensionInterface;
+
+/**
+ * Extension which automatically anchor links to heading elements
+ */
+final class HeadingPermalinkExtension implements ExtensionInterface
+{
+ public function register(ConfigurableEnvironmentInterface $environment)
+ {
+ $environment->addEventListener(DocumentParsedEvent::class, new HeadingPermalinkProcessor(), -100);
+ $environment->addInlineRenderer(HeadingPermalink::class, new HeadingPermalinkRenderer());
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php
new file mode 100644
index 0000000000..c082e10b84
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php
@@ -0,0 +1,94 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink;
+
+use League\CommonMark\Block\Element\Heading;
+use League\CommonMark\Event\DocumentParsedEvent;
+use League\CommonMark\Extension\HeadingPermalink\Slug\DefaultSlugGenerator;
+use League\CommonMark\Extension\HeadingPermalink\Slug\SlugGeneratorInterface;
+use League\CommonMark\Inline\Element\Code;
+use League\CommonMark\Inline\Element\Text;
+use League\CommonMark\Node\Node;
+use League\CommonMark\Util\ConfigurationAwareInterface;
+use League\CommonMark\Util\ConfigurationInterface;
+
+/**
+ * Searches the Document for Heading elements and adds HeadingPermalinks to each one
+ */
+final class HeadingPermalinkProcessor implements ConfigurationAwareInterface
+{
+ const INSERT_BEFORE = 'before';
+ const INSERT_AFTER = 'after';
+
+ /** @var SlugGeneratorInterface */
+ private $slugGenerator;
+
+ /** @var ConfigurationInterface */
+ private $config;
+
+ public function __construct(SlugGeneratorInterface $slugGenerator = null)
+ {
+ $this->slugGenerator = $slugGenerator ?? new DefaultSlugGenerator();
+ }
+
+ public function setConfiguration(ConfigurationInterface $configuration)
+ {
+ $this->config = $configuration;
+ }
+
+ public function __invoke(DocumentParsedEvent $e): void
+ {
+ $walker = $e->getDocument()->walker();
+
+ while ($event = $walker->next()) {
+ $node = $event->getNode();
+ if ($node instanceof Heading && $event->isEntering()) {
+ $this->addHeadingLink($node);
+ }
+ }
+ }
+
+ private function addHeadingLink(Heading $heading): void
+ {
+ $text = $this->getChildText($heading);
+ $slug = $this->slugGenerator->createSlug($text);
+
+ $headingLinkAnchor = new HeadingPermalink($slug);
+
+ switch ($this->config->get('heading_permalink/insert', 'before')) {
+ case self::INSERT_BEFORE:
+ $heading->prependChild($headingLinkAnchor);
+
+ return;
+ case self::INSERT_AFTER:
+ $heading->appendChild($headingLinkAnchor);
+
+ return;
+ default:
+ throw new \RuntimeException("Invalid configuration value for heading_permalink/insert; expected 'before' or 'after'");
+ }
+ }
+
+ private function getChildText(Node $node): string
+ {
+ $text = '';
+
+ $walker = $node->walker();
+ while ($event = $walker->next()) {
+ if ($event->isEntering() && (($child = $event->getNode()) instanceof Text || $child instanceof Code)) {
+ $text .= $child->getContent();
+ }
+ }
+
+ return $text;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php
new file mode 100644
index 0000000000..22ab795436
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php
@@ -0,0 +1,62 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink;
+
+use League\CommonMark\ElementRendererInterface;
+use League\CommonMark\HtmlElement;
+use League\CommonMark\Inline\Element\AbstractInline;
+use League\CommonMark\Inline\Renderer\InlineRendererInterface;
+use League\CommonMark\Util\ConfigurationAwareInterface;
+use League\CommonMark\Util\ConfigurationInterface;
+
+/**
+ * Renders the HeadingPermalink elements
+ */
+final class HeadingPermalinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface
+{
+ const DEFAULT_INNER_CONTENTS = '<svg class="heading-permalink-icon" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>';
+
+ /** @var ConfigurationInterface */
+ private $config;
+
+ public function setConfiguration(ConfigurationInterface $configuration)
+ {
+ $this->config = $configuration;
+ }
+
+ public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
+ {
+ if (!$inline instanceof HeadingPermalink) {
+ throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline));
+ }
+
+ $slug = $inline->getSlug();
+
+ $idPrefix = (string) $this->config->get('heading_permalink/id_prefix', 'user-content');
+ if ($idPrefix !== '') {
+ $idPrefix .= '-';
+ }
+
+ $attrs = [
+ 'id' => $idPrefix . $slug,
+ 'href' => '#' . $slug,
+ 'name' => $slug,
+ 'class' => $this->config->get('heading_permalink/html_class', 'heading-permalink'),
+ 'aria-hidden' => 'true',
+ 'title' => $this->config->get('heading_permalink/title', 'Permalink'),
+ ];
+
+ $innerContents = $this->config->get('heading_permalink/inner_contents', self::DEFAULT_INNER_CONTENTS);
+
+ return new HtmlElement('a', $attrs, $innerContents, false);
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php
new file mode 100644
index 0000000000..6207da0b5d
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink\Slug;
+
+/**
+ * Creates URL-friendly strings
+ */
+final class DefaultSlugGenerator implements SlugGeneratorInterface
+{
+ public function createSlug(string $input): string
+ {
+ // Trim whitespace
+ $slug = \trim($input);
+ // Convert to lowercase
+ $slug = \mb_strtolower($slug);
+ // Try replacing whitespace with a dash
+ $slug = \preg_replace('/\s+/u', '-', $slug) ?? $slug;
+ // Try removing non-alphanumeric and non-dash characters
+ $slug = \preg_replace('/[^\p{Lu}\p{Ll}\p{Lt}\p{Nd}\p{Nl}\-]/u', '', $slug) ?? $slug;
+
+ return $slug;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php
new file mode 100644
index 0000000000..9ae05a4420
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\HeadingPermalink\Slug;
+
+interface SlugGeneratorInterface
+{
+ /**
+ * Create a URL-friendly slug based on the given input string
+ *
+ * @param string $input
+ *
+ * @return string
+ */
+ public function createSlug(string $input): string;
+}
diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php b/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php
index defd4ceed9..a7b7a253ec 100644
--- a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php
+++ b/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php
@@ -23,9 +23,6 @@ use League\CommonMark\Inline\Element\AbstractInline;
*/
final class ChildRenderer implements BlockRendererInterface
{
- /**
- * {@inheritdoc}
- */
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false)
{
$out = '';
diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/README.md b/vendor/league/commonmark/src/Extension/InlinesOnly/README.md
deleted file mode 100644
index c8eb410c0c..0000000000
--- a/vendor/league/commonmark/src/Extension/InlinesOnly/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Inline-only extension for `league/commonmark`
-
-This extension configures the [`league/commonmark` Markdown parser for PHP](https://github.com/thephpleague/commonmark) to only render inline elements - no paragraph tags, headers, code blocks, etc.
-
-## Usage
-
-Although you normally add extra extensions to the default core one, we're not going to do that here, because this is essentially a slimmed-down version of the core extension:
-
-```php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\InlinesOnly\InlinesOnlyExtension;
-
-// Create a new, empty environment
-$environment = new Environment();
-
-// Add this extension
-$environment->addExtension(new InlinesOnlyExtension());
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter($config, $environment);
-echo $converter->convertToHtml('**Hello World!**');
-```
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php
index 4247333035..64cec44618 100644
--- a/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php
+++ b/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php
@@ -28,11 +28,6 @@ final class PunctuationParser implements InlineParserInterface
return ['-', '.'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
index bc3ea0cd24..ffd77eaa7c 100644
--- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
+++ b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
@@ -34,10 +34,6 @@ final class QuoteParser implements InlineParserInterface
/**
* Normalizes any quote characters found and manually adds them to the delimiter stack
- *
- * @param InlineParserContext $inlineContext
- *
- * @return bool
*/
public function parse(InlineParserContext $inlineContext): bool
{
@@ -69,12 +65,7 @@ final class QuoteParser implements InlineParserInterface
return true;
}
- /**
- * @param string $character
- *
- * @return string|null
- */
- private function getNormalizedQuoteCharacter($character)
+ private function getNormalizedQuoteCharacter(string $character): string
{
if (in_array($character, self::DOUBLE_QUOTES)) {
return Quote::DOUBLE_QUOTE;
@@ -91,7 +82,7 @@ final class QuoteParser implements InlineParserInterface
*
* @return bool[]
*/
- private function determineFlanking($charBefore, $charAfter)
+ private function determineFlanking(string $charBefore, string $charAfter)
{
$afterIsWhitespace = preg_match('/\pZ|\s/u', $charAfter);
$afterIsPunctuation = preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter);
diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php
index e8d4bc71de..132ce46b9a 100644
--- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php
+++ b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php
@@ -29,13 +29,6 @@ final class QuoteProcessor implements DelimiterProcessorInterface
/** @var string */
private $closerCharacter;
- /**
- * QuoteProcessor constructor.
- *
- * @param string $char
- * @param string $opener
- * @param string $closer
- */
private function __construct(string $char, string $opener, string $closer)
{
$this->normalizedCharacter = $char;
@@ -43,41 +36,26 @@ final class QuoteProcessor implements DelimiterProcessorInterface
$this->closerCharacter = $closer;
}
- /**
- * {@inheritdoc}
- */
public function getOpeningCharacter(): string
{
return $this->normalizedCharacter;
}
- /**
- * {@inheritdoc}
- */
public function getClosingCharacter(): string
{
return $this->normalizedCharacter;
}
- /**
- * {@inheritdoc}
- */
public function getMinLength(): int
{
return 1;
}
- /**
- * {@inheritdoc}
- */
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
{
return 1;
}
- /**
- * {@inheritdoc}
- */
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse)
{
$opener->insertAfter(new Quote($this->openerCharacter));
diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php
index 8cc18974b3..ac2c2fb6e6 100644
--- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php
+++ b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php
@@ -22,7 +22,7 @@ use League\CommonMark\Inline\Renderer\InlineRendererInterface;
final class QuoteRenderer implements InlineRendererInterface
{
/**
- * @param AbstractInline $inline
+ * @param Quote $inline
* @param ElementRendererInterface $htmlRenderer
*
* @return HtmlElement|string|null
diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/README.md b/vendor/league/commonmark/src/Extension/SmartPunct/README.md
deleted file mode 100644
index 0cc1b3dc9f..0000000000
--- a/vendor/league/commonmark/src/Extension/SmartPunct/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Smart Punctuation for `league/commonmark`
-
-Intelligently converts ASCII quotes, dashes, and ellipses to their Unicode equivalents. For use with the [`league/commonmark` Markdown parser for PHP](https://github.com/thephpleague/commonmark).
-
-For example, this Markdown...
-
-```md
-"CommonMark is the PHP League's Markdown parser," she said. "It's super-configurable... you can even use additional extensions to expand its capabilities -- just like this one!"
-```
-
-Will result in this HTML:
-
-```html
-<p>“CommonMark is the PHP League’s Markdown parser,” she said. “It’s super-configurable… you can even use additional extensions to expand its capabilities – just like this one!”</p>
-```
-
-## Usage
-
-Extensions can be added to any new `Environment`:
-
-``` php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\SmartPunct\SmartPunctExtension;
-
-// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new SmartPunctExtension());
-
-// Set your configuration
-$config = [
- 'smartpunct' => [
- 'double_quote_opener' => '“',
- 'double_quote_closer' => '”',
- 'single_quote_opener' => '‘',
- 'single_quote_closer' => '’',
- ],
-];
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter($config, $environment);
-echo $converter->convertToHtml('# Hello World!');
-```
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/README.md b/vendor/league/commonmark/src/Extension/Strikethrough/README.md
deleted file mode 100644
index c93f622161..0000000000
--- a/vendor/league/commonmark/src/Extension/Strikethrough/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Strikethrough support for `league/commonmark`
-
-This extension adds strikethrough Markdown support for the [league/commonmark](link-league-commonmark) PHP Markdown parsing engine, which itself is based on the CommonMark spec.
-
-It allows users to use `~~` in order to indicate text that should be rendered within `<del>` tags.
-
-## Usage
-
-Extensions can be added to any new `Environment`:
-
-```php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
-
-// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new StrikethroughExtension());
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter($config, $environment);
-echo $converter->convertToHtml('This extension is ~~good~~ great!');
-```
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php b/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php
index 09c8f20eb7..8219b7592b 100644
--- a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php
+++ b/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php
@@ -15,9 +15,6 @@ use League\CommonMark\Inline\Element\AbstractInline;
final class Strikethrough extends AbstractInline
{
- /**
- * @return bool
- */
public function isContainer(): bool
{
return true;
diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php
index 25983435c8..eda318d879 100644
--- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php
+++ b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php
@@ -17,33 +17,21 @@ use League\CommonMark\Inline\Element\AbstractStringContainer;
final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterface
{
- /**
- * {@inheritdoc}
- */
public function getOpeningCharacter(): string
{
return '~';
}
- /**
- * {@inheritdoc}
- */
public function getClosingCharacter(): string
{
return '~';
}
- /**
- * {@inheritdoc}
- */
public function getMinLength(): int
{
return 2;
}
- /**
- * {@inheritdoc}
- */
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
{
$min = \min($opener->getLength(), $closer->getLength());
@@ -51,9 +39,6 @@ final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterfa
return $min >= 2 ? $min : 0;
}
- /**
- * {@inheritdoc}
- */
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse)
{
$strikethrough = new Strikethrough();
diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php
index 8b747de5ba..8772939c20 100644
--- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php
+++ b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php
@@ -18,9 +18,6 @@ use League\CommonMark\Inline\Renderer\InlineRendererInterface;
final class StrikethroughRenderer implements InlineRendererInterface
{
- /**
- * {@inheritdoc}
- */
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
{
if (!($inline instanceof Strikethrough)) {
diff --git a/vendor/league/commonmark/src/Extension/Table/README.md b/vendor/league/commonmark/src/Extension/Table/README.md
deleted file mode 100644
index ff8de545d4..0000000000
--- a/vendor/league/commonmark/src/Extension/Table/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-CommonMark Table Extension
-==========================
-
-The Table extension adds the ability to create tables in CommonMark documents.
-
-Usage
------
-
-Configure your `Environment` as usual and simply add the `TableExtension` provided by this package:
-
-```php
-use League\CommonMark\Converter;
-use League\CommonMark\DocParser;
-use League\CommonMark\Environment;
-use League\CommonMark\HtmlRenderer;
-use League\CommonMark\Extension\Table\TableExtension;
-
-// Obtain a pre-configured Environment with all the standard CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new TableExtension());
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));
-
-echo $converter->convertToHtml('# Hello World!');
-```
-
-Syntax
-------
-
-This package is fully compatible with GFM-style tables:
-
-### Simple
-
-Code:
-```markdown
-th | th(center) | th(right)
----|:----------:|----------:
-td | td | td
-```
-
-Result:
-```html
-<table>
-<thead>
-<tr>
-<th style="text-align: left">th</th>
-<th style="text-align: center">th(center)</th>
-<th style="text-align: right">th(right<)/th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td style="text-align: left">td</td>
-<td style="text-align: center">td</td>
-<td style="text-align: right">td</td>
-</tr>
-</tbody>
-</table>
-```
-
-### Advanced
-
-```markdown
-| header 1 | header 2 | header 2 |
-| :------- | :------: | -------: |
-| cell 1.1 | cell 1.2 | cell 1.3 |
-| cell 2.1 | cell 2.2 | cell 2.3 |
-```
-
-Credits
--------
-
-- [Martin Hasoň](https://github.com/hason)
-- [Webuni s.r.o.](https://www.webuni.cz)
-- [Colin O'Dell](https://github.com/colinodell)
diff --git a/vendor/league/commonmark/src/Extension/Table/Table.php b/vendor/league/commonmark/src/Extension/Table/Table.php
index 7d1406d907..10beab2b1e 100644
--- a/vendor/league/commonmark/src/Extension/Table/Table.php
+++ b/vendor/league/commonmark/src/Extension/Table/Table.php
@@ -23,8 +23,11 @@ use League\CommonMark\Cursor;
final class Table extends AbstractStringContainerBlock implements InlineContainerInterface
{
+ /** @var TableSection */
private $head;
+ /** @var TableSection */
private $body;
+ /** @var \Closure */
private $parser;
public function __construct(\Closure $parser)
diff --git a/vendor/league/commonmark/src/Extension/Table/TableCell.php b/vendor/league/commonmark/src/Extension/Table/TableCell.php
index e71b003924..74128931cc 100644
--- a/vendor/league/commonmark/src/Extension/Table/TableCell.php
+++ b/vendor/league/commonmark/src/Extension/Table/TableCell.php
@@ -30,7 +30,10 @@ final class TableCell extends AbstractStringContainerBlock implements InlineCont
const ALIGN_RIGHT = 'right';
const ALIGN_CENTER = 'center';
+ /** @var string */
public $type = self::TYPE_BODY;
+
+ /** @var string|null */
public $align;
public function __construct(string $string = '', string $type = self::TYPE_BODY, string $align = null)
diff --git a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php
index c149633efa..248f70781c 100644
--- a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php
+++ b/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php
@@ -30,7 +30,7 @@ final class TableCellRenderer implements BlockRendererInterface
$attrs = $block->getData('attributes', []);
- if ($block->align) {
+ if ($block->align !== null) {
$attrs['align'] = $block->align;
}
diff --git a/vendor/league/commonmark/src/Extension/Table/TableParser.php b/vendor/league/commonmark/src/Extension/Table/TableParser.php
index 4f53fca56a..ce44332b0e 100644
--- a/vendor/league/commonmark/src/Extension/Table/TableParser.php
+++ b/vendor/league/commonmark/src/Extension/Table/TableParser.php
@@ -99,6 +99,13 @@ final class TableParser implements BlockParserInterface, EnvironmentAwareInterfa
return true;
}
+ /**
+ * @param string $line
+ * @param array<int, string> $columns
+ * @param string $type
+ *
+ * @return TableRow|null
+ */
private function parseRow(string $line, array $columns, string $type = TableCell::TYPE_BODY): ?TableRow
{
$cells = $this->split(new Cursor(\trim($line)));
@@ -129,6 +136,11 @@ final class TableParser implements BlockParserInterface, EnvironmentAwareInterfa
return $row;
}
+ /**
+ * @param Cursor $cursor
+ *
+ * @return array<int, string>
+ */
private function split(Cursor $cursor): array
{
if ($cursor->getCharacter() === '|') {
@@ -172,7 +184,7 @@ final class TableParser implements BlockParserInterface, EnvironmentAwareInterfa
/**
* @param Cursor $cursor
*
- * @return array
+ * @return array<int, string>
*/
private function parseColumns(Cursor $cursor): array
{
@@ -248,9 +260,6 @@ final class TableParser implements BlockParserInterface, EnvironmentAwareInterfa
return null;
}
- /**
- * {@inheritdoc}
- */
public function setEnvironment(EnvironmentInterface $environment)
{
$this->environment = $environment;
diff --git a/vendor/league/commonmark/src/Extension/Table/TableSection.php b/vendor/league/commonmark/src/Extension/Table/TableSection.php
index 5d299a1625..2df09157d9 100644
--- a/vendor/league/commonmark/src/Extension/Table/TableSection.php
+++ b/vendor/league/commonmark/src/Extension/Table/TableSection.php
@@ -26,6 +26,7 @@ final class TableSection extends AbstractStringContainerBlock implements InlineC
const TYPE_HEAD = 'thead';
const TYPE_BODY = 'tbody';
+ /** @var string */
public $type = self::TYPE_BODY;
public function __construct(string $type = self::TYPE_BODY)
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php
new file mode 100644
index 0000000000..892d084584
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents\Normalizer;
+
+use League\CommonMark\Block\Element\ListBlock;
+use League\CommonMark\Block\Element\ListItem;
+use League\CommonMark\Extension\TableOfContents\TableOfContents;
+
+final class AsIsNormalizerStrategy implements NormalizerStrategyInterface
+{
+ /** @var ListBlock */
+ private $parentListBlock;
+ /** @var int */
+ private $parentLevel = 1;
+ /** @var ListItem|null */
+ private $lastListItem;
+
+ public function __construct(TableOfContents $toc)
+ {
+ $this->parentListBlock = $toc;
+ }
+
+ public function addItem(int $level, ListItem $listItemToAdd): void
+ {
+ while ($level > $this->parentLevel) {
+ // Descend downwards, creating new ListBlocks if needed, until we reach the correct depth
+ if ($this->lastListItem === null) {
+ $this->lastListItem = new ListItem($this->parentListBlock->getListData());
+ $this->parentListBlock->appendChild($this->lastListItem);
+ }
+
+ $newListBlock = new ListBlock($this->parentListBlock->getListData());
+ $this->lastListItem->appendChild($newListBlock);
+ $this->parentListBlock = $newListBlock;
+ $this->lastListItem = null;
+
+ $this->parentLevel++;
+ }
+
+ while ($level < $this->parentLevel) {
+ // Search upwards for the previous parent list block
+ while (true) {
+ $this->parentListBlock = $this->parentListBlock->parent();
+ if ($this->parentListBlock instanceof ListBlock) {
+ break;
+ }
+ }
+
+ $this->parentLevel--;
+ }
+
+ $this->parentListBlock->appendChild($listItemToAdd);
+
+ $this->lastListItem = $listItemToAdd;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php
new file mode 100644
index 0000000000..b0626b7f62
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents\Normalizer;
+
+use League\CommonMark\Block\Element\ListItem;
+use League\CommonMark\Extension\TableOfContents\TableOfContents;
+
+final class FlatNormalizerStrategy implements NormalizerStrategyInterface
+{
+ /** @var TableOfContents */
+ private $toc;
+
+ public function __construct(TableOfContents $toc)
+ {
+ $this->toc = $toc;
+ }
+
+ public function addItem(int $level, ListItem $listItemToAdd): void
+ {
+ $this->toc->appendChild($listItemToAdd);
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php
new file mode 100644
index 0000000000..b69c415102
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php
@@ -0,0 +1,19 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents\Normalizer;
+
+use League\CommonMark\Block\Element\ListItem;
+
+interface NormalizerStrategyInterface
+{
+ public function addItem(int $level, ListItem $listItemToAdd): void;
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php
new file mode 100644
index 0000000000..ebbfd4b697
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php
@@ -0,0 +1,62 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents\Normalizer;
+
+use League\CommonMark\Block\Element\ListBlock;
+use League\CommonMark\Block\Element\ListItem;
+use League\CommonMark\Extension\TableOfContents\TableOfContents;
+
+final class RelativeNormalizerStrategy implements NormalizerStrategyInterface
+{
+ /** @var TableOfContents */
+ private $toc;
+
+ /** @var array<int, ListItem> */
+ private $listItemStack = [];
+
+ public function __construct(TableOfContents $toc)
+ {
+ $this->toc = $toc;
+ }
+
+ public function addItem(int $level, ListItem $listItemToAdd): void
+ {
+ \end($this->listItemStack);
+ $previousLevel = \key($this->listItemStack);
+
+ // Pop the stack if we're too deep
+ while ($previousLevel !== null && $level < $previousLevel) {
+ array_pop($this->listItemStack);
+ \end($this->listItemStack);
+ $previousLevel = \key($this->listItemStack);
+ }
+
+ /** @var ListItem|false $lastListItem */
+ $lastListItem = \current($this->listItemStack);
+
+ // Need to go one level deeper? Add that level
+ if ($lastListItem !== false && $level > $previousLevel) {
+ $targetListBlock = new ListBlock($lastListItem->getListData());
+ $lastListItem->appendChild($targetListBlock);
+ // Otherwise we're at the right level
+ // If there's no stack we're adding this item directly to the TOC element
+ } elseif ($lastListItem === false) {
+ $targetListBlock = $this->toc;
+ // Otherwise add it to the last list item
+ } else {
+ $targetListBlock = $lastListItem->parent();
+ }
+
+ $targetListBlock->appendChild($listItemToAdd);
+ $this->listItemStack[$level] = $listItemToAdd;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php
new file mode 100644
index 0000000000..c5f0b2de69
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents;
+
+use League\CommonMark\Block\Element\ListBlock;
+
+final class TableOfContents extends ListBlock
+{
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php
new file mode 100644
index 0000000000..05d8be9d57
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php
@@ -0,0 +1,166 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents;
+
+use League\CommonMark\Block\Element\Document;
+use League\CommonMark\Block\Element\Heading;
+use League\CommonMark\Block\Element\ListBlock;
+use League\CommonMark\Block\Element\ListData;
+use League\CommonMark\Block\Element\ListItem;
+use League\CommonMark\Block\Element\Paragraph;
+use League\CommonMark\Event\DocumentParsedEvent;
+use League\CommonMark\Exception\InvalidOptionException;
+use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink;
+use League\CommonMark\Extension\TableOfContents\Normalizer\AsIsNormalizerStrategy;
+use League\CommonMark\Extension\TableOfContents\Normalizer\FlatNormalizerStrategy;
+use League\CommonMark\Extension\TableOfContents\Normalizer\NormalizerStrategyInterface;
+use League\CommonMark\Extension\TableOfContents\Normalizer\RelativeNormalizerStrategy;
+use League\CommonMark\Inline\Element\Link;
+use League\CommonMark\Util\ConfigurationAwareInterface;
+use League\CommonMark\Util\ConfigurationInterface;
+
+final class TableOfContentsBuilder implements ConfigurationAwareInterface
+{
+ public const STYLE_BULLET = ListBlock::TYPE_BULLET;
+ public const STYLE_ORDERED = ListBlock::TYPE_ORDERED;
+
+ public const NORMALIZE_DISABLED = 'as-is';
+ public const NORMALIZE_RELATIVE = 'relative';
+ public const NORMALIZE_FLAT = 'flat';
+
+ public const POSITION_TOP = 'top';
+ public const POSITION_BEFORE_HEADINGS = 'before-headings';
+
+ /** @var ConfigurationInterface */
+ private $config;
+
+ public function onDocumentParsed(DocumentParsedEvent $event): void
+ {
+ $document = $event->getDocument();
+ $toc = $this->createToc();
+
+ $normalizer = $this->getNormalizer($toc);
+ [$min, $max] = $this->getMinAndMaxHeadingLevels();
+
+ $firstHeading = null;
+
+ foreach ($this->getHeadingLinks($document) as $headingLink) {
+ $heading = $headingLink->parent();
+ // Make sure this is actually tied to a heading
+ if (!$heading instanceof Heading) {
+ continue;
+ }
+
+ // Skip any headings outside the configured min/max levels
+ if ($heading->getLevel() < $min || $heading->getLevel() > $max) {
+ continue;
+ }
+
+ // Keep track of the first heading we see - we might need this later
+ $firstHeading = $firstHeading ?? $heading;
+
+ // Create the new link
+ $link = new Link('#' . $headingLink->getSlug(), $heading->getStringContent());
+ $paragraph = new Paragraph();
+ $paragraph->appendChild($link);
+
+ $listItem = new ListItem($toc->getListData());
+ $listItem->appendChild($paragraph);
+
+ // Add it to the correct place
+ $normalizer->addItem($heading->getLevel(), $listItem);
+ }
+
+ // Don't add the TOC if no headings were present
+ if (!$toc->hasChildren() || $firstHeading === null) {
+ return;
+ }
+
+ // Add the TOC to the Document
+ $position = $this->config->get('table_of_contents/position', self::POSITION_TOP);
+ if ($position === self::POSITION_TOP) {
+ $document->prependChild($toc);
+ } elseif ($position === self::POSITION_BEFORE_HEADINGS) {
+ $firstHeading->insertBefore($toc);
+ } else {
+ throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/position"', $position));
+ }
+ }
+
+ private function createToc(): TableOfContents
+ {
+ $listData = new ListData();
+
+ $style = $this->config->get('table_of_contents/style', self::STYLE_BULLET);
+ if ($style === self::STYLE_BULLET) {
+ $listData->type = ListBlock::TYPE_BULLET;
+ } elseif ($style === self::STYLE_ORDERED) {
+ $listData->type = ListBlock::TYPE_ORDERED;
+ } else {
+ throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/style"', $style));
+ }
+
+ $toc = new TableOfContents($listData);
+
+ $class = $this->config->get('table_of_contents/html_class', 'table-of-contents');
+ if (!empty($class)) {
+ $toc->data['attributes']['class'] = $class;
+ }
+
+ return $toc;
+ }
+
+ /**
+ * @return array<int>
+ */
+ private function getMinAndMaxHeadingLevels(): array
+ {
+ return [
+ (int) $this->config->get('table_of_contents/min_heading_level', 1),
+ (int) $this->config->get('table_of_contents/max_heading_level', 6),
+ ];
+ }
+
+ /**
+ * @param Document $document
+ *
+ * @return iterable<HeadingPermalink>
+ */
+ private function getHeadingLinks(Document $document)
+ {
+ $walker = $document->walker();
+ while ($event = $walker->next()) {
+ if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink) {
+ yield $node;
+ }
+ }
+ }
+
+ private function getNormalizer(TableOfContents $toc): NormalizerStrategyInterface
+ {
+ $strategy = $this->config->get('table_of_contents/normalize', self::NORMALIZE_RELATIVE);
+ if ($strategy === self::NORMALIZE_DISABLED) {
+ return new AsIsNormalizerStrategy($toc);
+ } elseif ($strategy === self::NORMALIZE_RELATIVE) {
+ return new RelativeNormalizerStrategy($toc);
+ } elseif ($strategy === self::NORMALIZE_FLAT) {
+ return new FlatNormalizerStrategy($toc);
+ }
+
+ throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/normalize"', $strategy));
+ }
+
+ public function setConfiguration(ConfigurationInterface $config)
+ {
+ $this->config = $config;
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php
new file mode 100644
index 0000000000..50ed942d90
--- /dev/null
+++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Extension\TableOfContents;
+
+use League\CommonMark\ConfigurableEnvironmentInterface;
+use League\CommonMark\Event\DocumentParsedEvent;
+use League\CommonMark\Extension\ExtensionInterface;
+
+final class TableOfContentsExtension implements ExtensionInterface
+{
+ public function register(ConfigurableEnvironmentInterface $environment): void
+ {
+ $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150);
+ }
+}
diff --git a/vendor/league/commonmark/src/Extension/TaskList/README.md b/vendor/league/commonmark/src/Extension/TaskList/README.md
deleted file mode 100644
index 8d47593029..0000000000
--- a/vendor/league/commonmark/src/Extension/TaskList/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# GFM-style task list extension for `league/commonmark`
-
-This extension adds [GFM-style task list items][link-gfm-spec-task-lists] to the [`league/commonmark` Markdown parser for PHP][link-league-commonmark].
-
-## Usage
-
-Configure your `Environment` as usual and simply add the `TaskListExtension` provided by this package:
-
-```php
-use League\CommonMark\CommonMarkConverter;
-use League\CommonMark\Environment;
-use League\CommonMark\Extension\TaskList\TaskListExtension;
-
-// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
-$environment = Environment::createCommonMarkEnvironment();
-
-// Add this extension
-$environment->addExtension(new TaskListExtension());
-
-// Instantiate the converter engine and start converting some Markdown!
-$converter = new CommonMarkConverter([], $environment);
-
-$markdown = <<<EOT
- - [x] Install this extension
- - [ ] ???
- - [ ] Profit!
-EOT;
-
-echo $converter->convertToHtml($markdown);
-```
-
-[link-league-commonmark]: https://github.com/thephpleague/commonmark
-[link-gfm-spec-task-lists]: https://github.github.com/gfm/#task-list-items-extension-
diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php
index a6cf65dc6d..d9a3a05a8c 100644
--- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php
+++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php
@@ -15,6 +15,7 @@ use League\CommonMark\Inline\Element\AbstractInline;
final class TaskListItemMarker extends AbstractInline
{
+ /** @var bool */
protected $checked = false;
public function __construct(bool $isCompleted)
diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php
index 24491b1680..1c19c5d1d5 100644
--- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php
+++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php
@@ -18,19 +18,11 @@ use League\CommonMark\InlineParserContext;
final class TaskListItemMarkerParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['['];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$container = $inlineContext->getContainer();
diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php
index a65513adc1..89a85cdd4f 100644
--- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php
+++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php
@@ -19,7 +19,7 @@ use League\CommonMark\Inline\Renderer\InlineRendererInterface;
final class TaskListItemMarkerRenderer implements InlineRendererInterface
{
/**
- * @param AbstractInline $inline
+ * @param TaskListItemMarker $inline
* @param ElementRendererInterface $htmlRenderer
*
* @return HtmlElement|string|null
diff --git a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php
index ef4b5946a1..a8ed5ae4bd 100644
--- a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php
+++ b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php
@@ -19,7 +19,7 @@ class GithubFlavoredMarkdownConverter extends CommonMarkConverter
/**
* Create a new commonmark converter instance.
*
- * @param array $config
+ * @param array<string, mixed> $config
* @param EnvironmentInterface|null $environment
*/
public function __construct(array $config = [], EnvironmentInterface $environment = null)
diff --git a/vendor/league/commonmark/src/HtmlElement.php b/vendor/league/commonmark/src/HtmlElement.php
index 93f1046305..38057f0265 100644
--- a/vendor/league/commonmark/src/HtmlElement.php
+++ b/vendor/league/commonmark/src/HtmlElement.php
@@ -53,9 +53,6 @@ class HtmlElement
$this->setContents($contents ?? '');
}
- /**
- * @return string
- */
public function getTagName(): string
{
return $this->tagName;
@@ -69,11 +66,6 @@ class HtmlElement
return $this->attributes;
}
- /**
- * @param string $key
- *
- * @return string|null
- */
public function getAttribute(string $key): ?string
{
if (!isset($this->attributes[$key])) {
@@ -83,12 +75,6 @@ class HtmlElement
return $this->attributes[$key];
}
- /**
- * @param string $key
- * @param string $value
- *
- * @return $this
- */
public function setAttribute(string $key, string $value): self
{
$this->attributes[$key] = $value;
@@ -124,9 +110,6 @@ class HtmlElement
return $this;
}
- /**
- * @return string
- */
public function __toString(): string
{
$result = '<' . $this->tagName;
diff --git a/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php b/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php
index da28c3990e..d6ddca3985 100644
--- a/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php
+++ b/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php
@@ -22,7 +22,7 @@ use League\CommonMark\Node\Node;
*/
final class AdjacentTextMerger
{
- public static function mergeChildNodes(Node $node)
+ public static function mergeChildNodes(Node $node): void
{
// No children or just one child node, no need for merging
if ($node->firstChild() === $node->lastChild() || $node->firstChild() === null || $node->lastChild() === null) {
@@ -32,7 +32,7 @@ final class AdjacentTextMerger
self::mergeTextNodesInclusive($node->firstChild(), $node->lastChild());
}
- public static function mergeTextNodesBetweenExclusive(Node $fromNode, Node $toNode)
+ public static function mergeTextNodesBetweenExclusive(Node $fromNode, Node $toNode): void
{
// No nodes between them
if ($fromNode === $toNode || $fromNode->next() === $toNode || $fromNode->next() === null || $toNode->previous() === null) {
@@ -42,7 +42,7 @@ final class AdjacentTextMerger
self::mergeTextNodesInclusive($fromNode->next(), $toNode->previous());
}
- private static function mergeTextNodesInclusive(Node $fromNode, Node $toNode)
+ private static function mergeTextNodesInclusive(Node $fromNode, Node $toNode): void
{
$first = null;
$last = null;
@@ -68,7 +68,7 @@ final class AdjacentTextMerger
self::mergeIfNeeded($first, $last);
}
- private static function mergeIfNeeded(?Text $first, ?Text $last)
+ private static function mergeIfNeeded(?Text $first, ?Text $last): void
{
if ($first === null || $last === null || $first === $last) {
// No merging needed
diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractInline.php b/vendor/league/commonmark/src/Inline/Element/AbstractInline.php
index c597f37b30..d41489592e 100644
--- a/vendor/league/commonmark/src/Inline/Element/AbstractInline.php
+++ b/vendor/league/commonmark/src/Inline/Element/AbstractInline.php
@@ -22,15 +22,12 @@ use League\CommonMark\Node\Node;
abstract class AbstractInline extends Node
{
/**
- * @var array
+ * @var array<string, mixed>
*
* Used for storage of arbitrary data
*/
public $data = [];
- /**
- * @return bool
- */
public function isContainer(): bool
{
return false;
diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php b/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php
index 4cc5221274..4a9c4b16c4 100644
--- a/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php
+++ b/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php
@@ -22,8 +22,8 @@ class AbstractStringContainer extends AbstractInline
protected $content = '';
/**
- * @param string $contents
- * @param array $data
+ * @param string $contents
+ * @param array<string, mixed> $data
*/
public function __construct(string $contents = '', array $data = [])
{
diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php b/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php
index ed1eb94015..22ff07d007 100644
--- a/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php
+++ b/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php
@@ -46,9 +46,6 @@ abstract class AbstractWebResource extends AbstractInline
return $this;
}
- /**
- * {@inheritdoc}
- */
public function isContainer(): bool
{
return true;
diff --git a/vendor/league/commonmark/src/Inline/Element/Emphasis.php b/vendor/league/commonmark/src/Inline/Element/Emphasis.php
index 50dbff5f1e..536b41625a 100644
--- a/vendor/league/commonmark/src/Inline/Element/Emphasis.php
+++ b/vendor/league/commonmark/src/Inline/Element/Emphasis.php
@@ -16,9 +16,6 @@ namespace League\CommonMark\Inline\Element;
class Emphasis extends AbstractInline
{
- /**
- * {@inheritdoc}
- */
public function isContainer(): bool
{
return true;
diff --git a/vendor/league/commonmark/src/Inline/Element/Image.php b/vendor/league/commonmark/src/Inline/Element/Image.php
index 250f930c58..7f122e70af 100644
--- a/vendor/league/commonmark/src/Inline/Element/Image.php
+++ b/vendor/league/commonmark/src/Inline/Element/Image.php
@@ -16,11 +16,6 @@ namespace League\CommonMark\Inline\Element;
class Image extends AbstractWebResource
{
- /**
- * @param string $url
- * @param string|null $label
- * @param string|null $title
- */
public function __construct(string $url, ?string $label = null, ?string $title = null)
{
parent::__construct($url);
diff --git a/vendor/league/commonmark/src/Inline/Element/Link.php b/vendor/league/commonmark/src/Inline/Element/Link.php
index 4967c2611a..8580cf545d 100644
--- a/vendor/league/commonmark/src/Inline/Element/Link.php
+++ b/vendor/league/commonmark/src/Inline/Element/Link.php
@@ -16,11 +16,6 @@ namespace League\CommonMark\Inline\Element;
class Link extends AbstractWebResource
{
- /**
- * @param string $url
- * @param string|null $label
- * @param string|null $title
- */
public function __construct(string $url, ?string $label = null, ?string $title = null)
{
parent::__construct($url);
diff --git a/vendor/league/commonmark/src/Inline/Element/Newline.php b/vendor/league/commonmark/src/Inline/Element/Newline.php
index dc86d2dcce..4431d47f40 100644
--- a/vendor/league/commonmark/src/Inline/Element/Newline.php
+++ b/vendor/league/commonmark/src/Inline/Element/Newline.php
@@ -20,19 +20,14 @@ class Newline extends AbstractInline
const HARDBREAK = 0;
const SOFTBREAK = 1;
+ /** @var int */
protected $type;
- /**
- * @param int $breakType
- */
public function __construct(int $breakType = self::HARDBREAK)
{
$this->type = $breakType;
}
- /**
- * @return int
- */
public function getType(): int
{
return $this->type;
diff --git a/vendor/league/commonmark/src/Inline/Element/Strong.php b/vendor/league/commonmark/src/Inline/Element/Strong.php
index 3ff3226a18..e687c1811c 100644
--- a/vendor/league/commonmark/src/Inline/Element/Strong.php
+++ b/vendor/league/commonmark/src/Inline/Element/Strong.php
@@ -16,9 +16,6 @@ namespace League\CommonMark\Inline\Element;
class Strong extends AbstractInline
{
- /**
- * {@inheritdoc}
- */
public function isContainer(): bool
{
return true;
diff --git a/vendor/league/commonmark/src/Inline/Element/Text.php b/vendor/league/commonmark/src/Inline/Element/Text.php
index 6afbe36d88..93e5e2a512 100644
--- a/vendor/league/commonmark/src/Inline/Element/Text.php
+++ b/vendor/league/commonmark/src/Inline/Element/Text.php
@@ -18,6 +18,8 @@ class Text extends AbstractStringContainer
{
/**
* @param string $character
+ *
+ * @return void
*/
public function append(string $character)
{
diff --git a/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php b/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php
index 2d35e43743..1a485fce11 100644
--- a/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php
@@ -23,19 +23,11 @@ final class AutolinkParser implements InlineParserInterface
const EMAIL_REGEX = '/^<([a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/';
const OTHER_LINK_REGEX = '/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i';
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['<'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
diff --git a/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php b/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php
index 896771e494..1f32217ff7 100644
--- a/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php
@@ -20,19 +20,11 @@ use League\CommonMark\InlineParserContext;
final class BacktickParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['`'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
diff --git a/vendor/league/commonmark/src/Inline/Parser/BangParser.php b/vendor/league/commonmark/src/Inline/Parser/BangParser.php
index f5d72cabc9..a6c6c33848 100644
--- a/vendor/league/commonmark/src/Inline/Parser/BangParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/BangParser.php
@@ -20,19 +20,11 @@ use League\CommonMark\InlineParserContext;
final class BangParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['!'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
diff --git a/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php b/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php
index f187e27686..018fe07fd4 100644
--- a/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php
@@ -35,19 +35,11 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
*/
private $environment;
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return [']'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
// Look through stack of delimiters for a [ or !
@@ -105,9 +97,6 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
return true;
}
- /**
- * @param EnvironmentInterface $environment
- */
public function setEnvironment(EnvironmentInterface $environment)
{
$this->environment = $environment;
@@ -119,7 +108,7 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
* @param DelimiterInterface $opener
* @param int $startPos
*
- * @return array|bool
+ * @return array<string, string>|false
*/
private function tryParseLink(Cursor $cursor, ReferenceMapInterface $referenceMap, DelimiterInterface $opener, int $startPos)
{
@@ -139,7 +128,7 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
/**
* @param Cursor $cursor
*
- * @return array|bool
+ * @return array<string, string>|false
*/
private function tryParseInlineLinkAndTitle(Cursor $cursor)
{
@@ -178,14 +167,6 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
return ['url' => $dest, 'title' => $title];
}
- /**
- * @param Cursor $cursor
- * @param ReferenceMapInterface $referenceMap
- * @param DelimiterInterface $opener
- * @param int $startPos
- *
- * @return ReferenceInterface|null
- */
private function tryParseReference(Cursor $cursor, ReferenceMapInterface $referenceMap, DelimiterInterface $opener, int $startPos): ?ReferenceInterface
{
if ($opener->getIndex() === null) {
@@ -213,13 +194,6 @@ final class CloseBracketParser implements InlineParserInterface, EnvironmentAwar
return $referenceMap->getReference($referenceLabel);
}
- /**
- * @param string $url
- * @param string $title
- * @param bool $isImage
- *
- * @return AbstractWebResource
- */
private function createInline(string $url, string $title, bool $isImage): AbstractWebResource
{
if ($isImage) {
diff --git a/vendor/league/commonmark/src/Inline/Parser/EntityParser.php b/vendor/league/commonmark/src/Inline/Parser/EntityParser.php
index 29535c24e3..616d6fbb13 100644
--- a/vendor/league/commonmark/src/Inline/Parser/EntityParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/EntityParser.php
@@ -21,19 +21,11 @@ use League\CommonMark\Util\RegexHelper;
final class EntityParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['&'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
if ($m = $inlineContext->getCursor()->match('/^' . RegexHelper::PARTIAL_ENTITY . '/i')) {
diff --git a/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php b/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php
index 6da015e99e..77b7fd3b7a 100644
--- a/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php
@@ -21,19 +21,11 @@ use League\CommonMark\Util\RegexHelper;
final class EscapableParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['\\'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
diff --git a/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php b/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php
index 5dc52e11a4..1377e39e7d 100644
--- a/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php
@@ -20,19 +20,11 @@ use League\CommonMark\Util\RegexHelper;
final class HtmlInlineParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['<'];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
if ($m = $inlineContext->getCursor()->match('/^' . RegexHelper::PARTIAL_HTMLTAG . '/i')) {
diff --git a/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php b/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php
index d32e8a37b4..a346ef1921 100644
--- a/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php
@@ -20,19 +20,11 @@ use League\CommonMark\InlineParserContext;
final class NewlineParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ["\n"];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$inlineContext->getCursor()->advanceBy(1);
diff --git a/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php b/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php
index 06f52c84c4..03f3c1bbfb 100644
--- a/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php
+++ b/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php
@@ -20,19 +20,11 @@ use League\CommonMark\InlineParserContext;
final class OpenBracketParser implements InlineParserInterface
{
- /**
- * @return string[]
- */
public function getCharacters(): array
{
return ['['];
}
- /**
- * @param InlineParserContext $inlineContext
- *
- * @return bool
- */
public function parse(InlineParserContext $inlineContext): bool
{
$inlineContext->getCursor()->advanceBy(1);
diff --git a/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php
index 66ef6da143..5a9816953a 100644
--- a/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php
+++ b/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php
@@ -51,9 +51,6 @@ final class HtmlInlineRenderer implements InlineRendererInterface, Configuration
return $inline->getContent();
}
- /**
- * @param ConfigurationInterface $configuration
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
diff --git a/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php
index e43a0a5d25..8161812b14 100644
--- a/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php
+++ b/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php
@@ -61,9 +61,6 @@ final class ImageRenderer implements InlineRendererInterface, ConfigurationAware
return new HtmlElement('img', $attrs, '', true);
}
- /**
- * @param ConfigurationInterface $configuration
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
diff --git a/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php
index c83125e689..8c2ce27e38 100644
--- a/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php
+++ b/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php
@@ -59,9 +59,6 @@ final class LinkRenderer implements InlineRendererInterface, ConfigurationAwareI
return new HtmlElement('a', $attrs, $htmlRenderer->renderInlines($inline->children()));
}
- /**
- * @param ConfigurationInterface $configuration
- */
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->config = $configuration;
diff --git a/vendor/league/commonmark/src/InlineParserContext.php b/vendor/league/commonmark/src/InlineParserContext.php
index d4e58f9ea9..b38808bbce 100644
--- a/vendor/league/commonmark/src/InlineParserContext.php
+++ b/vendor/league/commonmark/src/InlineParserContext.php
@@ -21,9 +21,13 @@ use League\CommonMark\Reference\ReferenceMapInterface;
class InlineParserContext
{
+ /** @var AbstractStringContainerBlock */
private $container;
+ /** @var ReferenceMapInterface */
private $referenceMap;
+ /** @var Cursor */
private $cursor;
+ /** @var DelimiterStack */
private $delimiterStack;
public function __construct(AbstractStringContainerBlock $container, ReferenceMapInterface $referenceMap)
@@ -34,33 +38,21 @@ class InlineParserContext
$this->delimiterStack = new DelimiterStack();
}
- /**
- * @return AbstractBlock
- */
public function getContainer(): AbstractBlock
{
return $this->container;
}
- /**
- * @return ReferenceMapInterface
- */
public function getReferenceMap(): ReferenceMapInterface
{
return $this->referenceMap;
}
- /**
- * @return Cursor
- */
public function getCursor(): Cursor
{
return $this->cursor;
}
- /**
- * @return DelimiterStack
- */
public function getDelimiterStack(): DelimiterStack
{
return $this->delimiterStack;
diff --git a/vendor/league/commonmark/src/InlineParserEngine.php b/vendor/league/commonmark/src/InlineParserEngine.php
index 46469b3795..3d6a8a9103 100644
--- a/vendor/league/commonmark/src/InlineParserEngine.php
+++ b/vendor/league/commonmark/src/InlineParserEngine.php
@@ -28,6 +28,7 @@ use League\CommonMark\Util\RegexHelper;
*/
final class InlineParserEngine
{
+ /** @var EnvironmentInterface */
protected $environment;
public function __construct(EnvironmentInterface $environment)
@@ -38,6 +39,8 @@ final class InlineParserEngine
/**
* @param AbstractStringContainerBlock $container
* @param ReferenceMapInterface $referenceMap
+ *
+ * @return void
*/
public function parse(AbstractStringContainerBlock $container, ReferenceMapInterface $referenceMap)
{
@@ -119,6 +122,8 @@ final class InlineParserEngine
/**
* @param InlineParserContext $inlineParserContext
+ *
+ * @return void
*/
private function processInlines(InlineParserContext $inlineParserContext)
{
@@ -133,6 +138,8 @@ final class InlineParserEngine
* @param string $character
* @param Node $container
* @param InlineParserContext $inlineParserContext
+ *
+ * @return void
*/
private function addPlainText(string $character, Node $container, InlineParserContext $inlineParserContext)
{
diff --git a/vendor/league/commonmark/src/Input/MarkdownInput.php b/vendor/league/commonmark/src/Input/MarkdownInput.php
new file mode 100644
index 0000000000..30197f8f78
--- /dev/null
+++ b/vendor/league/commonmark/src/Input/MarkdownInput.php
@@ -0,0 +1,82 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Input;
+
+use League\CommonMark\Exception\UnexpectedEncodingException;
+
+final class MarkdownInput implements MarkdownInputInterface
+{
+ /** @var iterable<int, string>|null */
+ private $lines;
+
+ /** @var string */
+ private $content;
+
+ /** @var int|null */
+ private $lineCount;
+
+ public function __construct(string $content)
+ {
+ if (!\mb_check_encoding($content, 'UTF-8')) {
+ throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected');
+ }
+
+ $this->content = $content;
+ }
+
+ public function getContent(): string
+ {
+ return $this->content;
+ }
+
+ /**
+ * @return \Traversable<int, string>
+ */
+ public function getLines(): \Traversable
+ {
+ $this->splitLinesIfNeeded();
+
+ foreach ($this->lines as $lineNumber => $line) {
+ yield $lineNumber => $line;
+ }
+ }
+
+ public function getLineCount(): int
+ {
+ $this->splitLinesIfNeeded();
+
+ return $this->lineCount;
+ }
+
+ private function splitLinesIfNeeded(): void
+ {
+ if ($this->lines !== null) {
+ return;
+ }
+
+ $lines = \preg_split('/\r\n|\n|\r/', $this->content);
+ if ($lines === false) {
+ throw new UnexpectedEncodingException('Failed to split Markdown content by line');
+ }
+
+ $this->lines = $lines;
+
+ // Remove any newline which appears at the very end of the string.
+ // We've already split the document by newlines, so we can simply drop
+ // any empty element which appears on the end.
+ if (\end($this->lines) === '') {
+ \array_pop($this->lines);
+ }
+
+ $this->lineCount = \count($this->lines);
+ }
+}
diff --git a/vendor/league/commonmark/src/Input/MarkdownInputInterface.php b/vendor/league/commonmark/src/Input/MarkdownInputInterface.php
new file mode 100644
index 0000000000..cc15bdb846
--- /dev/null
+++ b/vendor/league/commonmark/src/Input/MarkdownInputInterface.php
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark\Input;
+
+interface MarkdownInputInterface
+{
+ public function getContent(): string;
+
+ /**
+ * @return iterable<int, string>
+ */
+ public function getLines(): iterable;
+
+ public function getLineCount(): int;
+}
diff --git a/vendor/league/commonmark/src/MarkdownConverterInterface.php b/vendor/league/commonmark/src/MarkdownConverterInterface.php
new file mode 100644
index 0000000000..ffe630c8bb
--- /dev/null
+++ b/vendor/league/commonmark/src/MarkdownConverterInterface.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the league/commonmark package.
+ *
+ * (c) Colin O'Dell <colinodell@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace League\CommonMark;
+
+/**
+ * Interface for a service which converts Markdown to HTML.
+ */
+interface MarkdownConverterInterface
+{
+ /**
+ * Converts Markdown to HTML.
+ *
+ * @param string $markdown
+ *
+ * @throws \RuntimeException
+ *
+ * @return string HTML
+ *
+ * @api
+ */
+ public function convertToHtml(string $markdown): string;
+}
diff --git a/vendor/league/commonmark/src/Node/Node.php b/vendor/league/commonmark/src/Node/Node.php
index 46df3a6540..07b0f75018 100644
--- a/vendor/league/commonmark/src/Node/Node.php
+++ b/vendor/league/commonmark/src/Node/Node.php
@@ -46,25 +46,16 @@ abstract class Node
*/
protected $lastChild;
- /**
- * @return Node|null
- */
public function previous(): ?Node
{
return $this->previous;
}
- /**
- * @return Node|null
- */
public function next(): ?Node
{
return $this->next;
}
- /**
- * @return Node|null
- */
public function parent(): ?Node
{
return $this->parent;
@@ -72,6 +63,8 @@ abstract class Node
/**
* @param Node|null $node
+ *
+ * @return void
*/
protected function setParent(Node $node = null)
{
@@ -83,6 +76,8 @@ abstract class Node
* Inserts the $sibling node after $this
*
* @param Node $sibling
+ *
+ * @return void
*/
public function insertAfter(Node $sibling)
{
@@ -106,6 +101,8 @@ abstract class Node
* Inserts the $sibling node before $this
*
* @param Node $sibling
+ *
+ * @return void
*/
public function insertBefore(Node $sibling)
{
@@ -125,6 +122,11 @@ abstract class Node
}
}
+ /**
+ * @param Node $replacement
+ *
+ * @return void
+ */
public function replaceWith(Node $replacement)
{
$replacement->detach();
@@ -132,6 +134,9 @@ abstract class Node
$this->detach();
}
+ /**
+ * @return void
+ */
public function detach()
{
if ($this->previous) {
@@ -152,22 +157,13 @@ abstract class Node
$this->depth = 0;
}
- /**
- * @return bool
- */
abstract public function isContainer(): bool;
- /**
- * @return Node|null
- */
public function firstChild(): ?Node
{
return $this->firstChild;
}
- /**
- * @return Node|null
- */
public function lastChild(): ?Node
{
return $this->lastChild;
@@ -188,6 +184,8 @@ abstract class Node
/**
* @param Node $child
+ *
+ * @return void
*/
public function appendChild(Node $child)
{
@@ -204,6 +202,8 @@ abstract class Node
* Adds $child as the very first child of $this
*
* @param Node $child
+ *
+ * @return void
*/
public function prependChild(Node $child)
{
@@ -218,6 +218,8 @@ abstract class Node
/**
* Detaches all child nodes of given node
+ *
+ * @return void
*/
public function detachChildren()
{
@@ -230,7 +232,7 @@ abstract class Node
/**
* Replace all children of given node with collection of another
*
- * @param iterable $children
+ * @param iterable<Node> $children
*
* @return $this
*/
@@ -244,17 +246,11 @@ abstract class Node
return $this;
}
- /**
- * @return int
- */
public function getDepth(): int
{
return $this->depth;
}
- /**
- * @return NodeWalker
- */
public function walker(): NodeWalker
{
return new NodeWalker($this);
diff --git a/vendor/league/commonmark/src/Node/NodeWalker.php b/vendor/league/commonmark/src/Node/NodeWalker.php
index 6be7193b94..a238f34676 100644
--- a/vendor/league/commonmark/src/Node/NodeWalker.php
+++ b/vendor/league/commonmark/src/Node/NodeWalker.php
@@ -31,9 +31,6 @@ final class NodeWalker
*/
private $entering;
- /**
- * @param Node $root
- */
public function __construct(Node $root)
{
$this->root = $root;
@@ -81,6 +78,8 @@ final class NodeWalker
*
* @param Node $node
* @param bool $entering
+ *
+ * @return void
*/
public function resumeAt(Node $node, bool $entering = true)
{
diff --git a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php b/vendor/league/commonmark/src/Node/NodeWalkerEvent.php
index 541f61ad84..a911b4044a 100644
--- a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php
+++ b/vendor/league/commonmark/src/Node/NodeWalkerEvent.php
@@ -36,17 +36,11 @@ final class NodeWalkerEvent
$this->isEntering = $isEntering;
}
- /**
- * @return Node
- */
public function getNode(): Node
{
return $this->node;
}
- /**
- * @return bool
- */
public function isEntering(): bool
{
return $this->isEntering;
diff --git a/vendor/league/commonmark/src/Reference/Reference.php b/vendor/league/commonmark/src/Reference/Reference.php
index f734ce4854..143f8fb3d8 100644
--- a/vendor/league/commonmark/src/Reference/Reference.php
+++ b/vendor/league/commonmark/src/Reference/Reference.php
@@ -32,7 +32,7 @@ final class Reference implements ReferenceInterface
protected $title;
/**
- * @var array
+ * @var array<int, array<int, string>>
*
* Source: https://github.com/symfony/polyfill-mbstring/blob/master/Mbstring.php
*/
@@ -41,13 +41,6 @@ final class Reference implements ReferenceInterface
['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι', 'ss', 'ss'],
];
- /**
- * Constructor
- *
- * @param string $label
- * @param string $destination
- * @param string $title
- */
public function __construct(string $label, string $destination, string $title)
{
$this->label = self::normalizeReference($label);
@@ -55,25 +48,16 @@ final class Reference implements ReferenceInterface
$this->title = $title;
}
- /**
- * {@inheritdoc}
- */
public function getLabel(): string
{
return $this->label;
}
- /**
- * {@inheritdoc}
- */
public function getDestination(): string
{
return $this->destination;
}
- /**
- * {@inheritdoc}
- */
public function getTitle(): string
{
return $this->title;
diff --git a/vendor/league/commonmark/src/Reference/ReferenceInterface.php b/vendor/league/commonmark/src/Reference/ReferenceInterface.php
index 351c6f6746..9193b2f688 100644
--- a/vendor/league/commonmark/src/Reference/ReferenceInterface.php
+++ b/vendor/league/commonmark/src/Reference/ReferenceInterface.php
@@ -19,18 +19,9 @@ namespace League\CommonMark\Reference;
*/
interface ReferenceInterface
{
- /**
- * @return string
- */
public function getLabel(): string;
- /**
- * @return string
- */
public function getDestination(): string;
- /**
- * @return string
- */
public function getTitle(): string;
}
diff --git a/vendor/league/commonmark/src/Reference/ReferenceMap.php b/vendor/league/commonmark/src/Reference/ReferenceMap.php
index 1af59d74e1..faad074376 100644
--- a/vendor/league/commonmark/src/Reference/ReferenceMap.php
+++ b/vendor/league/commonmark/src/Reference/ReferenceMap.php
@@ -24,18 +24,12 @@ final class ReferenceMap implements ReferenceMapInterface
*/
protected $references = [];
- /**
- * {@inheritdoc}
- */
public function addReference(ReferenceInterface $reference): void
{
$key = Reference::normalizeReference($reference->getLabel());
$this->references[$key] = $reference;
}
- /**
- * {@inheritdoc}
- */
public function contains(string $label): bool
{
$label = Reference::normalizeReference($label);
@@ -43,9 +37,6 @@ final class ReferenceMap implements ReferenceMapInterface
return isset($this->references[$label]);
}
- /**
- * {@inheritdoc}
- */
public function getReference(string $label): ?ReferenceInterface
{
$label = Reference::normalizeReference($label);
@@ -57,9 +48,6 @@ final class ReferenceMap implements ReferenceMapInterface
return $this->references[$label];
}
- /**
- * {@inheritdoc}
- */
public function listReferences(): iterable
{
return \array_values($this->references);
diff --git a/vendor/league/commonmark/src/UnmatchedBlockCloser.php b/vendor/league/commonmark/src/UnmatchedBlockCloser.php
index d495c9bba3..f33e2ae049 100644
--- a/vendor/league/commonmark/src/UnmatchedBlockCloser.php
+++ b/vendor/league/commonmark/src/UnmatchedBlockCloser.php
@@ -48,12 +48,17 @@ class UnmatchedBlockCloser
/**
* @param AbstractBlock $block
+ *
+ * @return void
*/
public function setLastMatchedContainer(AbstractBlock $block)
{
$this->lastMatchedContainer = $block;
}
+ /**
+ * @return void
+ */
public function closeUnmatchedBlocks()
{
$endLine = $this->context->getLineNumber() - 1;
@@ -66,6 +71,9 @@ class UnmatchedBlockCloser
}
}
+ /**
+ * @return void
+ */
public function resetTip()
{
if ($this->context->getTip() === null) {
@@ -75,9 +83,6 @@ class UnmatchedBlockCloser
$this->oldTip = $this->context->getTip();
}
- /**
- * @return bool
- */
public function areAllClosed(): bool
{
return $this->context->getTip() === $this->lastMatchedContainer;
diff --git a/vendor/league/commonmark/src/Util/ArrayCollection.php b/vendor/league/commonmark/src/Util/ArrayCollection.php
index cb71911ff2..89ce23f678 100644
--- a/vendor/league/commonmark/src/Util/ArrayCollection.php
+++ b/vendor/league/commonmark/src/Util/ArrayCollection.php
@@ -17,18 +17,26 @@ namespace League\CommonMark\Util;
* Provides a wrapper around a standard PHP array.
*
* @internal
+ *
+ * @phpstan-template TKey
+ * @phpstan-template TValue
+ * @phpstan-implements \IteratorAggregate<TKey, TValue>
+ * @phpstan-implements \ArrayAccess<TKey, TValue>
*/
class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
{
/**
- * @var array
+ * @var array<int|string, mixed>
+ * @phpstan-var array<TKey, TValue>
*/
private $elements;
/**
* Constructor
*
- * @param array $elements
+ * @param array<int|string, mixed> $elements
+ *
+ * @phpstan-param array<TKey, TValue> $elements
*/
public function __construct(array $elements = [])
{
@@ -36,7 +44,9 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
}
/**
- * @return mixed
+ * @return mixed|false
+ *
+ * @phpstan-return TValue|false
*/
public function first()
{
@@ -44,7 +54,9 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
}
/**
- * @return mixed
+ * @return mixed|false
+ *
+ * @phpstan-return TValue|false
*/
public function last()
{
@@ -54,7 +66,9 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
/**
* Retrieve an external iterator
*
- * @return \ArrayIterator
+ * @return \ArrayIterator<int|string, mixed>
+ *
+ * @phpstan-return \ArrayIterator<TKey, TValue>
*/
public function getIterator()
{
@@ -65,40 +79,71 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
* @param mixed $element
*
* @return bool
+ *
+ * @phpstan-param TValue $element
+ *
+ * @deprecated
*/
public function add($element): bool
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'add()', '$collection[] = $value'), E_USER_DEPRECATED);
+
$this->elements[] = $element;
return true;
}
/**
- * @param mixed $key
- * @param mixed $value
+ * @param int|string $key
+ * @param mixed $value
+ *
+ * @return void
+ *
+ * @phpstan-param TKey $key
+ * @phpstan-param TValue $value
+ *
+ * @deprecated
*/
public function set($key, $value)
{
- $this->elements[$key] = $value;
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'set()', '$collection[$key] = $value'), E_USER_DEPRECATED);
+
+ $this->offsetSet($key, $value);
}
/**
- * @param mixed $key
+ * @param int|string $key
*
* @return mixed
+ *
+ * @phpstan-param TKey $key
+ *
+ * @phpstan-return TValue|null
+ *
+ * @deprecated
*/
public function get($key)
{
- return isset($this->elements[$key]) ? $this->elements[$key] : null;
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'get()', '$collection[$key]'), E_USER_DEPRECATED);
+
+ return $this->offsetGet($key);
}
/**
- * @param mixed $key
+ * @param int|string $key
*
- * @return mixed|null
+ * @return mixed
+ *
+ * @phpstan-param TKey $key
+ *
+ * @phpstan-return TValue|null
+ *
+ * @deprecated
*/
public function remove($key)
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'remove()', 'unset($collection[$key])'), E_USER_DEPRECATED);
+
if (!\array_key_exists($key, $this->elements)) {
return;
}
@@ -111,9 +156,13 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
/**
* @return bool
+ *
+ * @deprecated
*/
public function isEmpty(): bool
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'isEmpty()', 'count($collection) === 0'), E_USER_DEPRECATED);
+
return empty($this->elements);
}
@@ -121,9 +170,15 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
* @param mixed $element
*
* @return bool
+ *
+ * @phpstan-param TValue $element
+ *
+ * @deprecated
*/
public function contains($element): bool
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'contains()', 'in_array($value, $collection->toArray(), true)'), E_USER_DEPRECATED);
+
return \in_array($element, $this->elements, true);
}
@@ -131,19 +186,31 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
* @param mixed $element
*
* @return mixed|false
+ *
+ * @phpstan-param TValue $element
+ *
+ * @deprecated
*/
public function indexOf($element)
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'indexOf()', 'array_search($value, $collection->toArray(), true)'), E_USER_DEPRECATED);
+
return \array_search($element, $this->elements, true);
}
/**
- * @param mixed $key
+ * @param int|string $key
*
* @return bool
+ *
+ * @phpstan-param TKey $key
+ *
+ * @deprecated
*/
public function containsKey($key): bool
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'containsKey()', 'isset($collection[$key])'), E_USER_DEPRECATED);
+
return \array_key_exists($key, $this->elements);
}
@@ -160,54 +227,69 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
/**
* Whether an offset exists
*
- * @param mixed $offset An offset to check for.
+ * @param int|string $offset An offset to check for.
*
* @return bool true on success or false on failure.
+ *
+ * @phpstan-param TKey $offset
*/
public function offsetExists($offset): bool
{
- return $this->containsKey($offset);
+ return \array_key_exists($offset, $this->elements);
}
/**
* Offset to retrieve
*
- * @param mixed $offset The offset to retrieve.
+ * @param int|string $offset
*
- * @return mixed
+ * @return mixed|null
+ *
+ * @phpstan-param TKey $offset
+ *
+ * @phpstan-return TValue|null
*/
public function offsetGet($offset)
{
- return $this->get($offset);
+ return $this->elements[$offset] ?? null;
}
/**
* Offset to set
*
- * @param mixed $offset The offset to assign the value to.
- * @param mixed $value The value to set.
+ * @param int|string|null $offset The offset to assign the value to.
+ * @param mixed $value The value to set.
*
* @return void
+ *
+ * @phpstan-param TKey|null $offset
+ * @phpstan-param TValue $value
*/
public function offsetSet($offset, $value)
{
if ($offset === null) {
- $this->add($value);
+ $this->elements[] = $value;
} else {
- $this->set($offset, $value);
+ $this->elements[$offset] = $value;
}
}
/**
* Offset to unset
*
- * @param mixed $offset The offset to unset.
+ * @param int|string $offset The offset to unset.
*
* @return void
+ *
+ * @phpstan-param TKey $offset
*/
public function offsetUnset($offset)
{
- $this->remove($offset);
+ if (!\array_key_exists($offset, $this->elements)) {
+ return;
+ }
+
+ unset($this->elements[$offset]);
}
/**
@@ -216,7 +298,9 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
* @param int $offset
* @param int|null $length
*
- * @return array
+ * @return array<int|string, mixed>
+ *
+ * @phpstan-return array<TKey, TValue>
*/
public function slice(int $offset, ?int $length = null): array
{
@@ -224,7 +308,9 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
}
/**
- * @return array
+ * @return array<int|string, mixed>
+ *
+ * @phpstan-return array<TKey, TValue>
*/
public function toArray(): array
{
@@ -232,19 +318,32 @@ class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess
}
/**
- * @param array $elements
+ * @param array<int|string, mixed> $elements
*
* @return $this
+ *
+ * @phpstan-param array<TKey, TValue> $elements
+ *
+ * @deprecated
*/
public function replaceWith(array $elements)
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4.', self::class, 'replaceWith()'), E_USER_DEPRECATED);
+
$this->elements = $elements;
return $this;
}
+ /**
+ * @deprecated
+ *
+ * @return void
+ */
public function removeGaps()
{
+ @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4.', self::class, 'removeGaps()'), E_USER_DEPRECATED);
+
$this->elements = \array_filter($this->elements);
}
}
diff --git a/vendor/league/commonmark/src/Util/Configuration.php b/vendor/league/commonmark/src/Util/Configuration.php
index fe247b133b..6d8ffaabfd 100644
--- a/vendor/league/commonmark/src/Util/Configuration.php
+++ b/vendor/league/commonmark/src/Util/Configuration.php
@@ -16,35 +16,27 @@ namespace League\CommonMark\Util;
final class Configuration implements ConfigurationInterface
{
+ /** @var array<string, mixed> */
private $config;
/**
- * @param array $config
+ * @param array<string, mixed> $config
*/
public function __construct(array $config = [])
{
$this->config = $config;
}
- /**
- * {@inheritdoc}
- */
public function merge(array $config = [])
{
$this->config = \array_replace_recursive($this->config, $config);
}
- /**
- * {@inheritdoc}
- */
public function replace(array $config = [])
{
$this->config = $config;
}
- /**
- * {@inheritdoc}
- */
public function get(?string $key = null, $default = null)
{
if ($key === null) {
@@ -63,9 +55,6 @@ final class Configuration implements ConfigurationInterface
return $this->config[$key];
}
- /**
- * {@inheritdoc}
- */
public function set(string $key, $value = null)
{
// accept a/b/c as ['a']['b']['c']
@@ -101,7 +90,7 @@ final class Configuration implements ConfigurationInterface
* @param string $keyPath
* @param string|null $value
*/
- private function setByPath(string $keyPath, $value = null)
+ private function setByPath(string $keyPath, $value = null): void
{
$keyArr = \explode('/', $keyPath);
$pointer = &$this->config;
diff --git a/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php b/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php
index 0f1d444d01..1a66f78ba0 100644
--- a/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php
+++ b/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php
@@ -18,6 +18,8 @@ interface ConfigurationAwareInterface
{
/**
* @param ConfigurationInterface $configuration
+ *
+ * @return void
*/
public function setConfiguration(ConfigurationInterface $configuration);
}
diff --git a/vendor/league/commonmark/src/Util/ConfigurationInterface.php b/vendor/league/commonmark/src/Util/ConfigurationInterface.php
index 8e07a083d5..d5c167ed54 100644
--- a/vendor/league/commonmark/src/Util/ConfigurationInterface.php
+++ b/vendor/league/commonmark/src/Util/ConfigurationInterface.php
@@ -16,14 +16,18 @@ interface ConfigurationInterface
/**
* Merge an existing array into the current configuration
*
- * @param array $config
+ * @param array<string, mixed> $config
+ *
+ * @return void
*/
public function merge(array $config = []);
/**
* Replace the entire array with something else
*
- * @param array $config
+ * @param array<string, mixed> $config
+ *
+ * @return void
*/
public function replace(array $config = []);
@@ -46,6 +50,8 @@ interface ConfigurationInterface
*
* @param string $key
* @param mixed|null $value
+ *
+ * @return void
*/
public function set(string $key, $value = null);
}
diff --git a/vendor/league/commonmark/src/Util/Html5Entities.php b/vendor/league/commonmark/src/Util/Html5Entities.php
index 5817ef1ed2..68dcb35919 100644
--- a/vendor/league/commonmark/src/Util/Html5Entities.php
+++ b/vendor/league/commonmark/src/Util/Html5Entities.php
@@ -23,6 +23,8 @@ final class Html5Entities
{
/**
* @deprecated
+ *
+ * @var array<string, string>
*/
public static $entitiesByName = [
'Aacute' => 'Á',
diff --git a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php
index 4a4f13e483..2f49d95445 100644
--- a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php
+++ b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php
@@ -16,11 +16,6 @@ namespace League\CommonMark\Util;
final class Html5EntityDecoder
{
- /**
- * @param string $entity
- *
- * @return string
- */
public static function decode(string $entity): string
{
if (\substr($entity, -1) !== ';') {
@@ -61,11 +56,6 @@ final class Html5EntityDecoder
return $converted;
}
- /**
- * @param string $hexChars
- *
- * @return string
- */
private static function fromHex(string $hexChars): string
{
return self::fromDecimal(\hexdec($hexChars));
diff --git a/vendor/league/commonmark/src/Util/LinkParserHelper.php b/vendor/league/commonmark/src/Util/LinkParserHelper.php
index 95355a2f00..76baf3adcb 100644
--- a/vendor/league/commonmark/src/Util/LinkParserHelper.php
+++ b/vendor/league/commonmark/src/Util/LinkParserHelper.php
@@ -48,11 +48,6 @@ final class LinkParserHelper
);
}
- /**
- * @param Cursor $cursor
- *
- * @return int
- */
public static function parseLinkLabel(Cursor $cursor): int
{
$match = $cursor->match('/^\[(?:[^\\\\\[\]]|\\\\.){0,1000}\]/');
@@ -86,11 +81,6 @@ final class LinkParserHelper
return null;
}
- /**
- * @param Cursor $cursor
- *
- * @return string|null
- */
private static function manuallyParseLinkDestination(Cursor $cursor): ?string
{
$oldPosition = $cursor->getPosition();
diff --git a/vendor/league/commonmark/src/Util/PrioritizedList.php b/vendor/league/commonmark/src/Util/PrioritizedList.php
index dea69e90c4..d90bcdc942 100644
--- a/vendor/league/commonmark/src/Util/PrioritizedList.php
+++ b/vendor/league/commonmark/src/Util/PrioritizedList.php
@@ -16,25 +16,39 @@ namespace League\CommonMark\Util;
/**
* @internal
+ * @phpstan-template T
+ * @phpstan-implements \IteratorAggregate<T>
*/
final class PrioritizedList implements \IteratorAggregate
{
+ /**
+ * @var array<int, array<mixed>>
+ * @phpstan-var array<int, array<T>>
+ */
private $list = [];
+ /**
+ * @var iterable<mixed>|null
+ * @phpstan-var iterable<T>|null
+ */
private $optimized;
/**
* @param mixed $item
* @param int $priority
+ *
+ * @phpstan-param T $item
*/
- public function add($item, int $priority)
+ public function add($item, int $priority): void
{
$this->list[$priority][] = $item;
$this->optimized = null;
}
/**
- * @return \Traversable
+ * @return iterable<int, mixed>
+ *
+ * @phpstan-return iterable<int, T>
*/
public function getIterator(): iterable
{
diff --git a/vendor/league/commonmark/src/Util/RegexHelper.php b/vendor/league/commonmark/src/Util/RegexHelper.php
index c39d9edcfe..dda31467fb 100644
--- a/vendor/league/commonmark/src/Util/RegexHelper.php
+++ b/vendor/league/commonmark/src/Util/RegexHelper.php
@@ -66,11 +66,6 @@ final class RegexHelper
public const REGEX_THEMATIC_BREAK = '/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/';
public const REGEX_LINK_DESTINATION_BRACES = '/^(?:<(?:[^<>\\n\\\\\\x00]|\\\\.)*>)/';
- /**
- * @param string $character
- *
- * @return bool
- */
public static function isEscapable(string $character): bool
{
return \preg_match('/' . self::PARTIAL_ESCAPABLE . '/', $character) === 1;
@@ -106,7 +101,7 @@ final class RegexHelper
* @param string $subject
* @param int $offset
*
- * @return array|null
+ * @return array<string>|null
*/
public static function matchAll(string $pattern, string $subject, int $offset = 0): ?array
{
@@ -206,11 +201,6 @@ final class RegexHelper
throw new \InvalidArgumentException('Invalid HTML block type');
}
- /**
- * @param string $url
- *
- * @return bool
- */
public static function isLinkPotentiallyUnsafe(string $url): bool
{
return \preg_match(self::REGEX_UNSAFE_PROTOCOL, $url) !== 0 && \preg_match(self::REGEX_SAFE_DATA_PROTOCOL, $url) === 0;
diff --git a/vendor/league/commonmark/src/Util/UrlEncoder.php b/vendor/league/commonmark/src/Util/UrlEncoder.php
index b73aa1c7a6..e8b9131c00 100644
--- a/vendor/league/commonmark/src/Util/UrlEncoder.php
+++ b/vendor/league/commonmark/src/Util/UrlEncoder.php
@@ -16,13 +16,9 @@ namespace League\CommonMark\Util;
final class UrlEncoder
{
+ /** @var string[] */
private static $encodeCache = ['%00', '%01', '%02', '%03', '%04', '%05', '%06', '%07', '%08', '%09', '%0A', '%0B', '%0C', '%0D', '%0E', '%0F', '%10', '%11', '%12', '%13', '%14', '%15', '%16', '%17', '%18', '%19', '%1A', '%1B', '%1C', '%1D', '%1E', '%1F', '%20', '!', '%22', '#', '$', '%25', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '%3C', '=', '%3E', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '%5B', '%5C', '%5D', '%5E', '_', '%60', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '%7B', '%7C', '%7D', '~', '%7F'];
- /**
- * @param string $uri
- *
- * @return string
- */
public static function unescapeAndEncode(string $uri): string
{
// Optimization: if the URL only includes characters we know will be kept as-is, then just return the URL as-is.