Skip to content

Commit 596e2bc

Browse files
committed
Add phpstan to CI, and fix error
1 parent 995e70c commit 596e2bc

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"require-dev": {
1515
"phan/phan": "^5.4",
1616
"phpunit/phpunit": "^9.5",
17+
"phpstan/phpstan": "^1.8",
1718
"symfony/var-dumper": "^5.4",
1819
"unleashedtech/php-coding-standard": "^3.1"
1920
},
@@ -40,7 +41,8 @@
4041
"@phpcs",
4142
"@phpunit",
4243
"@php examples/basic.php",
43-
"phan"
44+
"phan",
45+
"phpstan analyse --level=8 src/ tests/"
4446
]
4547
}
4648
}

src/Shortcode.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public function getName(): string
3030

3131
public function loadAttrsFromString(string $string): void
3232
{
33-
$parts = \preg_split('/(?<!\\\\)\\|/', $string);
33+
$parts = \preg_split('/(?<!\\\\)\\|/', $string);
34+
if (! $parts) {
35+
return;
36+
}
37+
3438
$unnamedIndex = 1;
3539
foreach ($parts as $part) {
3640
if ($part === '') {

0 commit comments

Comments
 (0)