Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: CI

on: [push]
on:
push:
pull_request:
workflow_dispatch:

jobs:

Expand All @@ -9,7 +12,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4', '8.2']
php-versions: ['8.1', '8.4']

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
}
],
"require": {
"php": ">=7.1"
"php": ">=8.1"
},
"require-dev": {
"phpunit/phpunit": "8.5.*",
"phpunit/phpunit": "9.6.23",
"psr/log": "1.0.*@dev",
"twig/twig": "3.7.*",
"phpstan/phpstan": "^1.10"
"phpstan/phpstan": "^1.10",
"twig/twig": "3.11.3"
},
"bin": [
"bin/csscrush"
Expand Down
2 changes: 1 addition & 1 deletion lib/CssCrush/Crush.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function loadAssets()
}
}

public static function plugin($name = null, callable|null $callback = null)
public static function plugin($name = null, ?callable $callback = null)
{
static $plugins = [];

Expand Down
2 changes: 1 addition & 1 deletion lib/CssCrush/Fragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct($str, $options = [])
$this->name = $options['name'];
}

public function __invoke(array $args = null, $str = null)
public function __invoke(?array $args = null, $str = null)
{
$str = parent::__invoke($args);

Expand Down
8 changes: 4 additions & 4 deletions lib/CssCrush/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ public function captureRules()

preg_match($rulePatt, $this->string->raw, $ruleMatch, PREG_UNMATCHED_AS_NULL, $traceOffset);

$selector = trim($ruleMatch['selector'] ?? null);
$block = trim($ruleMatch['block_content'] ?? null);
$selector = trim($ruleMatch['selector'] ?? '');
$block = trim($ruleMatch['block_content'] ?? '');
$replace = '';

// If rules are nested inside we set their parent property.
Expand All @@ -688,12 +688,12 @@ public function captureRules()
}
}
else {
$rule = new Rule($selector, $block, $ruleMatch['trace_token'] ?? null);
$rule = new Rule($selector, $block, $ruleMatch['trace_token'] ?? '');
}

$replace = $tokens->add($rule, 'r', $rule->label) . $replace;

$this->string->splice($replace, $traceOffset, strlen($ruleMatch[0]) ?? null);
$this->string->splice($replace, $traceOffset, strlen($ruleMatch[0]) ?? '');
}

// Flip, since we just captured rules in reverse order.
Expand Down
2 changes: 1 addition & 1 deletion lib/CssCrush/StringObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class StringObject
{
public string|null $raw = null;
public ?string $raw = null;

public function __construct($str)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/CssCrush/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct($str)
$this->string = $templateFunctions->apply($str);
}

public function __invoke(array $args = null, $str = null)
public function __invoke(?array $args = null, $str = null)
{
$str = isset($str) ? $str : $this->string;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CssCrush/OptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testSourceMaps()
csscrush_file($this->testFile, ['source_map' => true]);
$source_map_contents = file_get_contents("$this->testFile.crush.css.map");

$this->assertRegExp('~"version": ?3,~', $source_map_contents);
$this->assertMatchesRegularExpression('~"version": ?3,~', $source_map_contents);
}

public function testAdvancedMinify()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CssCrush/TokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function test__construct()
public function testCreateLabel()
{
$type = 's';
$this->assertRegExp("~^\?{$type}[a-z0-9]+\?$~", $this->tokens->createLabel($type));
$this->assertMatchesRegularExpression("~^\?{$type}[a-z0-9]+\?$~", $this->tokens->createLabel($type));
}

public function testAdd()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CssCrush/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testProperties()
public function testGitDescribe()
{
if ($version = Version::gitDescribe()) {
$this->assertRegExp('~^
$this->assertMatchesRegularExpression('~^
v
\d+\.
\d+\.
Expand Down