Skip to content

Commit 71c27f6

Browse files
author
roadiz-ci
committed
chore: bumped
1 parent 4ec68fd commit 71c27f6

7 files changed

Lines changed: 32 additions & 72 deletions

File tree

.github/workflows/run-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
php-version: ['8.1', '8.2', '8.3']
22+
php-version: ['8.2', '8.3']
2323
steps:
2424
- uses: shivammathur/setup-php@v2
2525
with:
@@ -35,7 +35,5 @@ jobs:
3535
${{ runner.os }}-php-${{ matrix.php-version }}-
3636
- name: Install Dependencies
3737
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
38-
- name: Run PHP Code Sniffer
39-
run: vendor/bin/phpcs --extensions=php --warning-severity=0 --standard=PSR12 -p ./src
4038
- name: Run PHPStan
4139
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon

Makefile

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"description": "Markdown services and Twig extension for Roadiz",
44
"type": "library",
55
"require": {
6-
"php": ">=8.1",
7-
"league/commonmark": "^2.2.0",
8-
"twig/twig": "^3.1",
6+
"php": ">=8.2",
97
"doctrine/collections": ">=1.6",
10-
"symfony/stopwatch": "6.4.*"
8+
"league/commonmark": "^2.2.0",
9+
"symfony/stopwatch": "6.4.*",
10+
"twig/twig": "^3.16"
1111
},
1212
"require-dev": {
13-
"squizlabs/php_codesniffer": "^3.5",
14-
"phpstan/phpstan": "^1.5.3"
13+
"phpstan/phpstan": "^1.5.3",
14+
"phpstan/phpdoc-parser": "<2"
1515
},
1616
"license": "MIT",
1717
"authors": [
@@ -29,8 +29,8 @@
2929
},
3030
"extra": {
3131
"branch-alias": {
32-
"dev-master": "2.3.x-dev",
33-
"dev-develop": "2.4.x-dev"
32+
"dev-master": "2.5.x-dev",
33+
"dev-develop": "2.6.x-dev"
3434
}
3535
}
3636
}

phpcs.xml.dist

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/CommonMark.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,49 @@
77
use League\CommonMark\MarkdownConverter;
88
use Symfony\Component\Stopwatch\Stopwatch;
99

10-
final class CommonMark implements MarkdownInterface
10+
final readonly class CommonMark implements MarkdownInterface
1111
{
1212
public function __construct(
13-
private readonly MarkdownConverter $textConverter,
14-
private readonly MarkdownConverter $textExtraConverter,
15-
private readonly MarkdownConverter $lineConverter,
16-
private readonly ?Stopwatch $stopwatch = null
13+
private MarkdownConverter $textConverter,
14+
private MarkdownConverter $textExtraConverter,
15+
private MarkdownConverter $lineConverter,
16+
private ?Stopwatch $stopwatch = null,
1717
) {
1818
}
1919

20-
public function text(string $markdown = null): string
20+
public function text(?string $markdown = null): string
2121
{
2222
if (null === $markdown) {
2323
return '';
2424
}
25-
$this->stopwatch?->start(CommonMark::class . '::text');
25+
$this->stopwatch?->start(CommonMark::class.'::text');
2626
$html = $this->textConverter->convert($markdown)->getContent();
27-
$this->stopwatch?->stop(CommonMark::class . '::text');
27+
$this->stopwatch?->stop(CommonMark::class.'::text');
28+
2829
return $html;
2930
}
3031

31-
public function textExtra(string $markdown = null): string
32+
public function textExtra(?string $markdown = null): string
3233
{
3334
if (null === $markdown) {
3435
return '';
3536
}
36-
$this->stopwatch?->start(CommonMark::class . '::textExtra');
37+
$this->stopwatch?->start(CommonMark::class.'::textExtra');
3738
$html = $this->textExtraConverter->convert($markdown)->getContent();
38-
$this->stopwatch?->stop(CommonMark::class . '::textExtra');
39+
$this->stopwatch?->stop(CommonMark::class.'::textExtra');
40+
3941
return $html;
4042
}
4143

42-
public function line(string $markdown = null): string
44+
public function line(?string $markdown = null): string
4345
{
4446
if (null === $markdown) {
4547
return '';
4648
}
47-
$this->stopwatch?->start(CommonMark::class . '::line');
49+
$this->stopwatch?->start(CommonMark::class.'::line');
4850
$html = $this->lineConverter->convert($markdown)->getContent();
49-
$this->stopwatch?->stop(CommonMark::class . '::line');
51+
$this->stopwatch?->stop(CommonMark::class.'::line');
52+
5053
return $html;
5154
}
5255
}

src/MarkdownInterface.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,16 @@ interface MarkdownInterface
88
{
99
/**
1010
* Convert Markdown to HTML using standard Markdown syntax.
11-
*
12-
* @param string|null $markdown
13-
*
14-
* @return string
1511
*/
16-
public function text(string $markdown = null): string;
12+
public function text(?string $markdown = null): string;
1713

1814
/**
1915
* Convert Markdown to HTML using standard Markdown Extra syntax.
20-
*
21-
* @param string|null $markdown
22-
*
23-
* @return string
2416
*/
25-
public function textExtra(string $markdown = null): string;
17+
public function textExtra(?string $markdown = null): string;
2618

2719
/**
2820
* Convert Markdown to HTML using only inline HTML elements.
29-
*
30-
* @param string|null $markdown
31-
*
32-
* @return string
3321
*/
34-
public function line(string $markdown = null): string;
22+
public function line(?string $markdown = null): string;
3523
}

src/Twig/MarkdownExtension.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,30 @@ public function getFilters(): array
2525
];
2626
}
2727

28-
/**
29-
* @param string|null $input
30-
*
31-
* @return string
32-
*/
3328
public function markdown(?string $input): string
3429
{
3530
if (null === $input) {
3631
return '';
3732
}
33+
3834
return $this->markdown->text($input);
3935
}
4036

41-
/**
42-
* @param string|null $input
43-
*
44-
* @return string
45-
*/
4637
public function inlineMarkdown(?string $input): string
4738
{
4839
if (null === $input) {
4940
return '';
5041
}
42+
5143
return $this->markdown->line($input);
5244
}
5345

54-
/**
55-
* @param string|null $input
56-
*
57-
* @return string
58-
*/
5946
public function markdownExtra(?string $input): string
6047
{
6148
if (null === $input) {
6249
return '';
6350
}
51+
6452
return $this->markdown->textExtra($input);
6553
}
6654
}

0 commit comments

Comments
 (0)