Skip to content

Commit b1bdf1f

Browse files
committed
Added PHPStan
1 parent c191763 commit b1bdf1f

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

phpstan.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
level: max
3+
4+
paths:
5+
- src
6+
- tests
7+
8+
fileExtensions:
9+
- php
10+
- phpt

src/CssMinifier.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ class CssMinifier
1212
/**
1313
* @link https://github.com/nette/build-tools/blob/master/tasks/minifyJs.php#L51-L56
1414
* @author David Grudl, 2011
15-
* @param string
16-
* @return string
1715
*/
18-
public function minify($s)
16+
public function minify(string $s): string
1917
{
20-
$s = preg_replace('#/\*.*?\*/#s', '', $s); // remove comments
21-
$s = preg_replace('#\s+#', ' ', $s); // compress space
22-
$s = preg_replace('# ([^(0-9a-z.\#*-])#i', '$1', $s);
23-
$s = preg_replace('#([^0-9a-z%)]) #i', '$1', $s);
18+
$s = (string) preg_replace('#/\*.*?\*/#s', '', $s); // remove comments
19+
$s = (string) preg_replace('#\s+#', ' ', $s); // compress space
20+
$s = (string) preg_replace('# ([^(0-9a-z.\#*-])#i', '$1', $s);
21+
$s = (string) preg_replace('#([^0-9a-z%)]) #i', '$1', $s);
2422

2523
while (strpos($s, ';}') !== FALSE) {
2624
$s = str_replace(';}', '}', $s); // remove leading semicolon

0 commit comments

Comments
 (0)