Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Style fixes (#133) #152

Merged
merged 2 commits into from
Jul 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Block/Element/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function getLastChild()
return $this->children->last();
}


public function addChild(AbstractBlock $childBlock)
{
$this->children->add($childBlock);
Expand Down Expand Up @@ -301,7 +300,7 @@ public function getStringContent()

/**
* @param Cursor $cursor
* @param int $currentLineNumber
* @param int $currentLineNumber
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Element/BlockQuote.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso

/**
* @param Cursor $cursor
* @param int $currentLineNumber
* @param int $currentLineNumber
*
* @return $this
*/
Expand Down
10 changes: 5 additions & 5 deletions src/Block/Element/FencedCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class FencedCode extends AbstractBlock
protected $offset;

/**
* @param int $length
* @param int $length
* @param string $char
* @param int $offset
* @param int $offset
*/
public function __construct($length, $char, $offset)
{
Expand Down Expand Up @@ -185,7 +185,7 @@ public function finalize(ContextInterface $context)
// first line becomes info string
$this->info = RegexHelper::unescape(trim($this->strings->first()));

if ($this->strings->count() == 1) {
if ($this->strings->count() === 1) {
$this->finalStringContents = '';
} else {
$this->finalStringContents = implode("\n", $this->strings->slice(1)) . "\n";
Expand All @@ -202,7 +202,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso
$container = $context->getContainer();

// check for closing code fence
if ($cursor->getIndent() <= 3 && $cursor->getFirstNonSpaceCharacter() == $container->getChar()) {
if ($cursor->getIndent() <= 3 && $cursor->getFirstNonSpaceCharacter() === $container->getChar()) {
$match = RegexHelper::matchAll('/^(?:`{3,}|~{3,})(?= *$)/', $cursor->getLine(), $cursor->getFirstNonSpacePosition());
if (strlen($match[0]) >= $container->getLength()) {
// don't add closing fence to container; instead, close it:
Expand All @@ -217,7 +217,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso

/**
* @param Cursor $cursor
* @param int $currentLineNumber
* @param int $currentLineNumber
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Element/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Header extends AbstractInlineContainer
protected $level;

/**
* @param int $level
* @param int $level
* @param string $contents
*/
public function __construct($level, $contents)
Expand Down
3 changes: 1 addition & 2 deletions src/Block/Element/IndentedCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

namespace League\CommonMark\Block\Element;

use League\CommonMark\Block\Parser\IndentedCodeParser;
use League\CommonMark\ContextInterface;
use League\CommonMark\Cursor;

Expand Down Expand Up @@ -71,7 +70,7 @@ public function finalize(ContextInterface $context)

$reversed = array_reverse($this->getStrings(), true);
foreach ($reversed as $index => $line) {
if ($line == '' || $line === "\n" || preg_match('/^(\n *)$/', $line)) {
if ($line === '' || $line === "\n" || preg_match('/^(\n *)$/', $line)) {
unset($reversed[$index]);
} else {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Element/ListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso

/**
* @param Cursor $cursor
* @param int $currentLineNumber
* @param int $currentLineNumber
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Element/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function finalize(ContextInterface $context)

/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/ATXHeaderParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ATXHeaderParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/BlockParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getName();

/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/BlockQuoteParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BlockQuoteParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/FencedCodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FencedCodeParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/HorizontalRuleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HorizontalRuleParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/HtmlBlockParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class HtmlBlockParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/IndentedCodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class IndentedCodeParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/LazyParagraphParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LazyParagraphParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Parser/ListParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ListParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down Expand Up @@ -79,7 +79,7 @@ public function parse(ContextInterface $context, Cursor $cursor)

/**
* @param string $marker
* @param int $spacesAfterMarker
* @param int $spacesAfterMarker
* @param string $rest
*
* @return int
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Parser/SetExtHeaderParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SetExtHeaderParser extends AbstractBlockParser
{
/**
* @param ContextInterface $context
* @param Cursor $cursor
* @param Cursor $cursor
*
* @return bool
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/BlockQuoteRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class BlockQuoteRenderer implements BlockRendererInterface
{
/**
* @param BlockQuote $block
* @param BlockQuote $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/BlockRendererInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
interface BlockRendererInterface
{
/**
* @param AbstractBlock $block
* @param AbstractBlock $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement|string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/DocumentRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
class DocumentRenderer implements BlockRendererInterface
{
/**
* @param AbstractBlock|Document $block
* @param AbstractBlock|Document $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/FencedCodeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class FencedCodeRenderer implements BlockRendererInterface
{
/**
* @param FencedCode $block
* @param FencedCode $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/HeaderRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class HeaderRenderer implements BlockRendererInterface
{
/**
* @param Header $block
* @param Header $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/HorizontalRuleRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class HorizontalRuleRenderer implements BlockRendererInterface
{
/**
* @param HorizontalRule $block
* @param HorizontalRule $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/HtmlBlockRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
class HtmlBlockRenderer implements BlockRendererInterface
{
/**
* @param HtmlBlock $block
* @param HtmlBlock $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/IndentedCodeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class IndentedCodeRenderer implements BlockRendererInterface
{
/**
* @param AbstractBlock $block
* @param AbstractBlock $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Block/Renderer/ListBlockRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class ListBlockRenderer implements BlockRendererInterface
{
/**
* @param ListBlock $block
* @param ListBlock $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement
*/
Expand All @@ -36,9 +36,9 @@ public function render(AbstractBlock $block, ElementRendererInterface $htmlRende

$listData = $block->getListData();

$tag = $listData->type == ListBlock::TYPE_UNORDERED ? 'ul' : 'ol';
$tag = $listData->type === ListBlock::TYPE_UNORDERED ? 'ul' : 'ol';
$attr = ($listData->start === null || $listData->start === 1) ?
[] : ['start' => (string)$listData->start];
[] : ['start' => (string) $listData->start];

return new HtmlElement(
$tag,
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/ListItemRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class ListItemRenderer implements BlockRendererInterface
{
/**
* @param ListItem $block
* @param ListItem $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Renderer/ParagraphRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class ParagraphRenderer implements BlockRendererInterface
{
/**
* @param Paragraph $block
* @param Paragraph $block
* @param ElementRendererInterface $htmlRenderer
* @param bool $inTightList
* @param bool $inTightList
*
* @return HtmlElement|string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Converter
/**
* Create a new commonmark converter instance.
*
* @param DocParser $docParser
* @param DocParser $docParser
* @param ElementRendererInterface $htmlRenderer
*/
public function __construct(DocParser $docParser, ElementRendererInterface $htmlRenderer)
Expand Down
Loading