Merge pull request #360 from tacman/lib

add Github Actions
This commit is contained in:
Michel Fortin 2021-11-08 12:43:23 -05:00 committed by GitHub
commit a56f6869f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 5 deletions

25
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: CI
on:
pull_request: null
push:
branches:
- lib
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.4', '8.0']
name: Linting - PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: intl
- run: composer install --no-progress
# - run: composer codestyle
- run: composer phpstan
- run: composer tests

View file

@ -708,7 +708,7 @@ class Markdown implements MarkdownInterface {
/**
* Callback method to parse referenced anchors
* @param string $matches
* @param array $matches
* @return string
*/
protected function _doAnchors_reference_callback($matches) {
@ -747,7 +747,7 @@ class Markdown implements MarkdownInterface {
/**
* Callback method to parse inline anchors
* @param string $matches
* @param array $matches
* @return string
*/
protected function _doAnchors_inline_callback($matches) {
@ -765,7 +765,7 @@ class Markdown implements MarkdownInterface {
$url = $this->encodeURLAttribute($url);
$result = "<a href=\"$url\"";
if (isset($title)) {
if ($title) {
$title = $this->encodeAttribute($title);
$result .= " title=\"$title\"";
}
@ -1808,7 +1808,7 @@ class Markdown implements MarkdownInterface {
/**
* String length function for detab. `_initDetab` will create a function to
* handle UTF-8 if the default function does not exist.
* @var string
* can be a string or function
*/
protected $utf8_strlen = 'mb_strlen';

View file

@ -1222,6 +1222,7 @@ class MarkdownExtra extends \Michelf\Markdown {
$head = $matches[1];
$underline = $matches[2];
$content = $matches[3];
$attr = [];
// Remove any tailing pipes for each line.
$head = preg_replace('/[|] *$/m', '', $head);

View file

@ -1,6 +1,8 @@
PHP Markdown
============
![ci.yml](https://github.com/tacman/php-markdown/actions/workflows/ci.yml/badge.svg)
PHP Markdown Lib 1.9.0 - 1 Dec 2019
by Michel Fortin

View file

@ -24,6 +24,21 @@
"psr-4": { "Michelf\\": "Michelf/" }
},
"require-dev": {
"phpunit/phpunit": ">= 9.5"
"phpspec/prophecy": "^1.6",
"friendsofphp/php-cs-fixer": "^3.0",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
},
"scripts": {
"tests": "vendor/bin/phpunit test/",
"phpstan": [
"vendor/bin/phpstan analyse Michelf/ --level=5",
"vendor/bin/phpstan analyse -c test/phpstan.neon test/ --level=5"
],
"codestyle": "vendor/bin/php-cs-fixer fix Michelf --dry-run --verbose --show-progress=none",
"codestyle-fix": "vendor/bin/php-cs-fixer fix Michelf"
}
}

2
test/phpstan.neon Normal file
View file

@ -0,0 +1,2 @@
includes:
- ../vendor/phpstan/phpstan-phpunit/extension.neon