Skip to content

Commit ca4cb2e

Browse files
committed
Bump to CommonMark v1.0
1 parent ec005bd commit ca4cb2e

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
"php": "^7.1.3",
1414
"illuminate/contracts": "^5.5|^6.0",
1515
"illuminate/support": "^5.5|^6.0",
16-
"league/commonmark": "^0.18"
16+
"league/commonmark": "^1.0"
1717
},
1818
"require-dev": {
1919
"graham-campbell/analyzer": "^2.1",
20-
"graham-campbell/markdown": "^10.2",
20+
"graham-campbell/markdown": "^11.0",
2121
"graham-campbell/testbench": "^5.1",
2222
"phpunit/phpunit": "^6.5|^7.0|^8.0"
2323
},

src/TwitterExtension.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313

1414
namespace CachetHQ\Twitter;
1515

16-
use League\CommonMark\Extension\Extension;
16+
use League\CommonMark\ConfigurableEnvironmentInterface;
17+
use League\CommonMark\Extension\ExtensionInterface;
1718

1819
/**
1920
* This is the twitter extension class.
2021
*
2122
* @author James Brooks <james@alt-three.com>
2223
*/
23-
class TwitterExtension extends Extension
24+
class TwitterExtension implements ExtensionInterface
2425
{
2526
/**
2627
* The twitter parser.
@@ -42,12 +43,12 @@ public function __construct(TwitterParser $parser)
4243
}
4344

4445
/**
45-
* Returns a list of inline parsers to add to the existing list.
46+
* Register extensions.
4647
*
47-
* @return \League\CommonMark\Inline\Parser\InlineParserInterface[]
48+
* @return void
4849
*/
49-
public function getInlineParsers()
50+
public function register(ConfigurableEnvironmentInterface $environment)
5051
{
51-
return [$this->parser];
52+
$environment->addInlineParser($this->parser);
5253
}
5354
}

src/TwitterParser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313

1414
namespace CachetHQ\Twitter;
1515

16-
use League\CommonMark\Inline\Element\Link;
17-
use League\CommonMark\Inline\Parser\AbstractInlineParser;
1816
use League\CommonMark\InlineParserContext;
17+
use League\CommonMark\Inline\Element\Link;
18+
use League\CommonMark\Inline\Parser\InlineParserInterface;
1919

2020
/**
2121
* This is the twitter parser class.
2222
*
2323
* @author James Brooks <james@alt-three.com>
2424
*/
25-
class TwitterParser extends AbstractInlineParser
25+
class TwitterParser implements InlineParserInterface
2626
{
2727
/**
2828
* Get the characters that must be matched.
2929
*
3030
* @return string[]
3131
*/
32-
public function getCharacters()
32+
public function getCharacters(): array
3333
{
3434
return ['@'];
3535
}
@@ -43,7 +43,7 @@ public function getCharacters()
4343
*
4444
* @return bool
4545
*/
46-
public function parse(InlineParserContext $inlineContext)
46+
public function parse(InlineParserContext $inlineContext): bool
4747
{
4848
$cursor = $inlineContext->getCursor();
4949

tests/ServiceProviderTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,4 @@ public function testTwitterExtensionIsInjectable()
3535
{
3636
$this->assertIsInjectable(TwitterExtension::class);
3737
}
38-
39-
public function testEnvironmentIsSetup()
40-
{
41-
$this->assertTrue(in_array($this->app->make(TwitterParser::class), $this->app->make('markdown.environment')->getInlineParsers(), true));
42-
}
4338
}

0 commit comments

Comments
 (0)