Skip to content
This repository was archived by the owner on Feb 7, 2022. It is now read-only.

Commit dc113af

Browse files
authored
Merge pull request #115 from bocharsky-bw/symfony6-continue
Symfony 6 continue
2 parents 843b3d0 + 9e2d994 commit dc113af

26 files changed

+163
-44
lines changed

.github/workflows/phpunit.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: PHPUnit
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
phpunit:
8+
name: "PHPUnit - PHP ${{ matrix.php-version }}"
9+
runs-on: ubuntu-20.04
10+
continue-on-error: false
11+
env:
12+
SYMFONY_REQUIRE: ${{matrix.symfony-require}}
13+
SYMFONY_DEPRECATIONS_HELPER: ${{matrix.symfony-deprecations-helper}}
14+
15+
strategy:
16+
matrix:
17+
php-version:
18+
- "7.4"
19+
- "8.0"
20+
- "8.1"
21+
deps:
22+
- "stable"
23+
symfony-require:
24+
- "5.4.*"
25+
symfony-deprecations-helper:
26+
- "5"
27+
include:
28+
- symfony-require: "4.4.*"
29+
php-version: "7.4"
30+
deps: "low"
31+
symfony-deprecations-helper: ""
32+
33+
- symfony-require: "4.4.*"
34+
php-version: "7.4"
35+
deps: "stable"
36+
symfony-deprecations-helper: "5"
37+
38+
- symfony-require: "6.0.*"
39+
php-version: "8.0"
40+
deps: "stable"
41+
symfony-deprecations-helper: "5"
42+
43+
- symfony-require: "6.0.*"
44+
php-version: "8.1"
45+
deps: "stable"
46+
symfony-deprecations-helper: "5"
47+
48+
fail-fast: true
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v2
53+
54+
- name: Install PHP with extensions
55+
uses: shivammathur/setup-php@v2
56+
with:
57+
coverage: none
58+
php-version: ${{ matrix.php-version }}
59+
extensions: mbstring, intl, pdo, pdo_sqlite, sqlite3
60+
ini-values: date.timezone=UTC
61+
62+
- name: Validate composer.json and composer.lock
63+
run: composer validate --strict
64+
65+
- name: Install dependencies with Composer
66+
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
67+
68+
- name: Cache dependencies installed with Composer
69+
uses: actions/cache@v2
70+
with:
71+
path: ~/.composer/cache
72+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
73+
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
74+
75+
- name: Install stable dependencies with Composer
76+
run: composer update --no-interaction --prefer-dist --prefer-stable
77+
if: "${{ matrix.deps == 'stable' }}"
78+
79+
- name: Install dev dependencies with Composer
80+
run: composer update --no-interaction --prefer-dist
81+
if: "${{ matrix.deps == 'dev' }}"
82+
83+
- name: Install lowest possible dependencies with Composer
84+
run: composer update --no-interaction --prefer-dist --prefer-stable --prefer-lowest
85+
if: "${{ matrix.deps == 'low' }}"
86+
87+
- name: Install PHPUnit
88+
run: composer run-script test install
89+
90+
- name: Run tests
91+
run: composer run-script test -v

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
.phpunit.result.cache
12
phpunit.xml
3+
var/
24
vendor/*
35
composer.lock
46
Tests/fixtures/app/cache

DependencyInjection/Configuration.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ class Configuration implements ConfigurationInterface
1212
*
1313
* @return TreeBuilder
1414
*/
15-
public function getConfigTreeBuilder()
15+
public function getConfigTreeBuilder(): TreeBuilder
1616
{
1717
$treeBuilder = new TreeBuilder('knp_markdown');
18-
// BC layer for symfony/config < 4.2
19-
$rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('knp_markdown');
18+
$rootNode = $treeBuilder->getRootNode();
2019

2120
$rootNode
2221
->addDefaultsIfNotSet()

Helper/MarkdownHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function setCharset($charset)
5050
*
5151
* @return string The default charset
5252
*/
53-
public function getCharset()
53+
public function getCharset(): string
5454
{
5555
return $this->charset;
5656
}

Parser/MarkdownParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function transformMarkdown($text)
124124
/**
125125
* Simplify detab
126126
*/
127-
public function detab($text)
127+
public function detab($text): string
128128
{
129129
return str_replace("\t", str_repeat(' ', $this->tab_width), $text);
130130
}

Parser/Preset/Min.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(array $features = array())
1515
$this->features[$name] = false;
1616
}
1717

18-
return parent::__construct($features);
18+
parent::__construct($features);
1919
}
2020
}
2121

README.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Provide markdown conversion (based on [Michel Fortin work](https://github.com/mi
22

33
[![Build Status](https://secure.travis-ci.org/KnpLabs/KnpMarkdownBundle.svg)](http://travis-ci.org/KnpLabs/KnpMarkdownBundle)
44

5+
![ci.yml](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/ci.yml/badge.svg)
6+
![php.yml](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/php.yml/badge.svg)
7+
58
## INSTALLATION
69

710
Add KnpMarkdownBundle to your project via [Composer](https://getcomposer.org/):

Twig/Extension/MarkdownTwigExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ public function __construct(ParserManager $parserManager)
1515
$this->parserManager = $parserManager;
1616
}
1717

18-
public function getFilters()
18+
public function getFilters(): array
1919
{
2020
return array(
2121
new TwigFilter('markdown', array($this, 'markdown'), array('is_safe' => array('html'))),
2222
);
2323
}
2424

25-
public function markdown($text, $parser = null)
25+
public function markdown($text, $parser = null): string
2626
{
2727
return $this->parserManager->transform($text, $parser);
2828
}
2929

30-
public function getName()
30+
public function getName(): string
3131
{
3232
return 'markdown';
3333
}

composer.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
],
1919

2020
"require": {
21-
"php": "^7.1.3|^8.0",
22-
"symfony/framework-bundle": "~3.4|^4.0|^5.0",
23-
"symfony/dependency-injection": "~3.4|^4.0|^5.0",
24-
"michelf/php-markdown": "~1.4"
21+
"php": "^7.4|^8.0",
22+
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
23+
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
24+
"michelf/php-markdown": "^1.9"
2525
},
2626
"require-dev": {
27-
"symfony/phpunit-bridge": "^4.4.0 || ^5.0",
28-
"symfony/templating": "~3.4|^4.0|^5.0"
27+
"symfony/phpunit-bridge": "^4.4.11|^5.0|^6.0",
28+
"symfony/templating": "^4.4|^5.0|^6.0",
29+
"phpstan/phpstan": "^1.2",
30+
"phpstan/phpstan-symfony": "^1.0"
2931
},
3032
"suggest": {
3133
"symfony/twig-bundle": "to use the Twig markdown filter",
@@ -38,6 +40,18 @@
3840
}
3941
},
4042

43+
"scripts": {
44+
"test": [
45+
"php ./vendor/bin/simple-phpunit"
46+
]
47+
},
48+
49+
"autoload-dev": {
50+
"psr-4": {
51+
"Knp\\Bundle\\MarkdownBundle\\Tests\\": "tests/"
52+
}
53+
},
54+
4155
"autoload": {
4256
"psr-4": {
4357
"Knp\\Bundle\\MarkdownBundle\\": ""

phpunit.xml.dist

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22

33
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
66
backupGlobals="false"
77
bootstrap="vendor/autoload.php"
88
colors="true"
99
failOnRisky="true"
1010
failOnWarning="true"
11+
failOnIncomplete="false"
1112
>
1213
<php>
13-
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
14+
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
1415
</php>
1516

17+
<coverage processUncoveredFiles="true">
18+
<include>
19+
<directory>.</directory>
20+
</include>
21+
<exclude>
22+
<directory>tests</directory>
23+
<directory>vendor</directory>
24+
</exclude>
25+
</coverage>
1626
<testsuites>
1727
<testsuite name="Markdown Test Suite">
1828
<directory>tests</directory>
1929
</testsuite>
2030
</testsuites>
21-
22-
<filter>
23-
<whitelist processUncoveredFilesFromWhitelist="true">
24-
<directory>.</directory>
25-
<exclude>
26-
<directory>tests</directory>
27-
<directory>vendor</directory>
28-
</exclude>
29-
</whitelist>
30-
</filter>
31-
</phpunit>
31+
</phpunit>

0 commit comments

Comments
 (0)