Skip to content

Commit 2a192bc

Browse files
authored
Merge branch 'main' into patch-1
2 parents bc058a4 + 870c453 commit 2a192bc

34 files changed

+456
-169
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
22

33
on:
4-
pull_request:
54
push:
5+
branches:
6+
- main
7+
pull_request:
68
schedule:
79
- cron: '3 3 * * 1'
810

@@ -14,11 +16,11 @@ jobs:
1416
runs-on: ubuntu-22.04
1517
strategy:
1618
matrix:
17-
php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
19+
php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
1820

1921
steps:
2022
- name: Checkout
21-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2224

2325
- name: Install PHP
2426
uses: shivammathur/setup-php@v2
@@ -39,29 +41,25 @@ jobs:
3941
strategy:
4042
fail-fast: false
4143
matrix:
42-
php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3' ]
43-
coverage: [ 'none' ]
44-
include:
45-
- php-version: '7.4'
46-
coverage: xdebug
44+
php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
4745

4846
steps:
4947
- name: Checkout
50-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
5149

5250
- name: Install PHP
5351
uses: shivammathur/setup-php@v2
5452
with:
5553
php-version: ${{ matrix.php-version }}
5654
ini-values: error_reporting=E_ALL
5755
tools: composer:v2
58-
coverage: "${{ matrix.coverage }}"
56+
coverage: none
5957

6058
- name: Show the Composer configuration
6159
run: composer config --global --list
6260

6361
- name: Cache dependencies installed with composer
64-
uses: actions/cache@v3
62+
uses: actions/cache@v4
6563
with:
6664
path: ~/.cache/composer
6765
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
@@ -74,14 +72,7 @@ jobs:
7472
composer show;
7573
7674
- name: Run Tests
77-
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
78-
79-
- name: Upload coverage results to Codacy
80-
env:
81-
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
82-
if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}"
83-
run: |
84-
./vendor/bin/codacycoverage clover build/coverage/xml
75+
run: ./vendor/bin/phpunit
8576

8677
static-analysis:
8778
name: Static Analysis
@@ -93,17 +84,15 @@ jobs:
9384
strategy:
9485
fail-fast: false
9586
matrix:
96-
include:
97-
- command: sniffer
98-
php-version: '7.4'
99-
- command: fixer
100-
php-version: '7.4'
101-
- command: stan
102-
php-version: '7.4'
87+
command:
88+
- fixer
89+
- stan
90+
php-version:
91+
- '8.3'
10392

10493
steps:
10594
- name: Checkout
106-
uses: actions/checkout@v3
95+
uses: actions/checkout@v4
10796

10897
- name: Install PHP
10998
uses: shivammathur/setup-php@v2
@@ -116,7 +105,7 @@ jobs:
116105
run: composer config --global --list
117106

118107
- name: Cache dependencies installed with composer
119-
uses: actions/cache@v3
108+
uses: actions/cache@v4
120109
with:
121110
path: ~/.cache/composer
122111
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
@@ -130,7 +119,7 @@ jobs:
130119
131120
- name: Install development tools
132121
run: |
133-
phive --no-progress install --trust-gpg-keys BBAB5DF0A0D6672989CF1869E82B2FB314E9906E,A972B9ABB95D0B760B51442231C7E470E2138192,D32680D5957DC7116BE29C14CF1A108D0E7AE720
122+
phive --no-progress install --trust-gpg-keys BBAB5DF0A0D6672989CF1869E82B2FB314E9906E
134123
135124
- name: Run Command
136125
run: composer ci:php:${{ matrix.command }}

.github/workflows/codecoverage.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
name: Code coverage
10+
11+
jobs:
12+
code-coverage:
13+
name: Code coverage
14+
15+
runs-on: ubuntu-22.04
16+
17+
strategy:
18+
matrix:
19+
php-version: [ '7.4' ]
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php-version }}
29+
ini-values: error_reporting=E_ALL
30+
tools: composer:v2
31+
coverage: xdebug
32+
33+
- name: Show the Composer configuration
34+
run: composer config --global --list
35+
36+
- name: Cache dependencies installed with composer
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.cache/composer
40+
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
41+
restore-keys: |
42+
php${{ matrix.php-version }}-composer-
43+
44+
- name: Install Composer dependencies
45+
run: |
46+
composer update --with-dependencies --no-progress;
47+
composer show;
48+
49+
- name: Run Tests
50+
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
51+
52+
- name: Upload coverage results to Codacy
53+
env:
54+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
55+
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
56+
run: |
57+
./vendor/bin/codacycoverage clover build/coverage/xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.phive/*
22
/.php-cs-fixer.cache
33
/.php_cs.cache
4+
/.phpunit.result.cache
45
/composer.lock
56
/phpstan.neon
67
/vendor/

.phive/phars.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.13.2" installed="3.13.2" location="./.phive/php-cs-fixer.phar" copy="false"/>
4-
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./.phive/phpcbf.phar" copy="false"/>
5-
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./.phive/phpcs.phar" copy="false"/>
6-
<phar name="phpstan" version="^1.9.14" installed="1.9.14" location="./.phive/phpstan.phar" copy="false"/>
3+
<phar name="php-cs-fixer" version="^3.49.0" installed="3.49.0" location="./.phive/php-cs-fixer.phar" copy="false"/>
74
</phive>

CHANGELOG.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
1-
# Revision History
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
This project adheres to [Semantic Versioning](https://semver.org/).
5+
6+
## x.y.z
7+
8+
### Added
9+
10+
- Add more tests (#449)
11+
12+
### Changed
13+
14+
- Add visibility to all class/interface constants (#469)
15+
16+
### Deprecated
17+
18+
### Removed
19+
20+
- Drop support for PHP < 7.2 (#420)
21+
22+
### Fixed
23+
24+
- Fix (regression) failure to parse at-rules with strict parsing (#456)
25+
26+
## 8.5.0
27+
28+
### Added
29+
30+
- Add a method to get an import's media queries (#384)
31+
- Add more unit tests (#381, #382)
32+
33+
### Fixed
34+
35+
- Retain CSSList and Rule comments when rendering CSS (#351)
36+
- Replace invalid `turns` unit with `turn` (#350)
37+
- Also allow string values for rules (#348)
38+
- Fix invalid calc parsing (#169)
39+
- Handle scientific notation when parsing sizes (#179)
40+
- Fix PHP 8.1 compatibility in `ParserState::strsplit()` (#344)
241

342
## 8.4.0
443

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHP CSS Parser
22

3-
[![Build Status](https://github.com/sabberworm/PHP-CSS-Parser/workflows/CI/badge.svg?branch=master)](https://github.com/sabberworm/PHP-CSS-Parser/actions/)
3+
[![Build Status](https://github.com/MyIntervals/PHP-CSS-Parser/workflows/CI/badge.svg?branch=main)](https://github.com/MyIntervals/PHP-CSS-Parser/actions/)
44

55
A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS.
66

composer.json

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,26 @@
1212
"authors": [
1313
{
1414
"name": "Raphael Schweikert"
15+
},
16+
{
17+
"name": "Oliver Klee",
18+
"email": "[email protected]"
19+
},
20+
{
21+
"name": "Jake Hotson",
22+
"email": "[email protected]"
1523
}
1624
],
1725
"require": {
18-
"php": ">=5.6.20",
26+
"php": ">=7.2.0",
1927
"ext-iconv": "*"
2028
},
2129
"require-dev": {
22-
"phpunit/phpunit": "^5.7.27",
23-
"codacy/coverage": "^1.4.3"
30+
"codacy/coverage": "^1.4.3",
31+
"phpstan/extension-installer": "^1.3.1",
32+
"phpstan/phpstan": "^1.10.58",
33+
"phpstan/phpstan-phpunit": "^1.3.15",
34+
"phpunit/phpunit": "^8.5.36"
2435
},
2536
"suggest": {
2637
"ext-mbstring": "for parsing UTF-8 CSS"
@@ -35,35 +46,43 @@
3546
"Sabberworm\\CSS\\Tests\\": "tests/"
3647
}
3748
},
49+
"config": {
50+
"allow-plugins": {
51+
"phpstan/extension-installer": true
52+
},
53+
"preferred-install": {
54+
"*": "dist"
55+
},
56+
"sort-packages": true
57+
},
58+
"extra": {
59+
"branch-alias": {
60+
"dev-main": "9.0.x-dev"
61+
}
62+
},
3863
"scripts": {
3964
"ci": [
4065
"@ci:static"
4166
],
4267
"ci:php:fixer": "@php ./.phive/php-cs-fixer.phar --config=config/php-cs-fixer.php fix --dry-run -v --show-progress=dots bin src tests",
43-
"ci:php:sniffer": "@php ./.phive/phpcs.phar --standard=config/phpcs.xml bin src tests",
44-
"ci:php:stan": "@php ./.phive/phpstan.phar --configuration=config/phpstan.neon",
68+
"ci:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
4569
"ci:static": [
4670
"@ci:php:fixer",
47-
"@ci:php:sniffer",
4871
"@ci:php:stan"
4972
],
5073
"fix:php": [
51-
"@fix:php:fixer",
52-
"@fix:php:sniffer"
74+
"@fix:php:fixer"
5375
],
5476
"fix:php:fixer": "@php ./.phive/php-cs-fixer.phar --config=config/php-cs-fixer.php fix bin src tests",
55-
"fix:php:sniffer": "@php ./.phive/phpcbf.phar --standard=config/phpcs.xml bin src tests",
56-
"phpstan:baseline": "@php ./.phive/phpstan.phar --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon"
77+
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon"
5778
},
5879
"scripts-descriptions": {
5980
"ci": "Runs all dynamic and static code checks (i.e. currently, only the static checks).",
6081
"ci:php:fixer": "Checks the code style with PHP CS Fixer.",
61-
"ci:php:sniffer": "Checks the code style with PHP_CodeSniffer.",
6282
"ci:php:stan": "Checks the types with PHPStan.",
6383
"ci:static": "Runs all static code analysis checks for the code.",
6484
"fix:php": "Autofixes all autofixable issues in the PHP code.",
6585
"fix:php:fixer": "Fixes autofixable issues found by PHP CS Fixer.",
66-
"fix:php:sniffer": "Fixes autofixable issues found by PHP_CodeSniffer.",
6786
"phpstand:baseline": "Updates the PHPStan baseline file to match the code."
6887
}
6988
}

config/php-cs-fixer.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,27 @@
88
->setRiskyAllowed(true)
99
->setRules(
1010
[
11-
'@PSR12' => true,
12-
// Disable constant visibility from the PSR12 rule set as this would break compatibility with PHP < 7.1.
13-
'visibility_required' => ['elements' => ['property', 'method']],
11+
'@PER-CS2.0' => true,
12+
'@PER-CS2.0:risky' => true,
1413

1514
'@PHPUnit50Migration:risky' => true,
1615
'@PHPUnit52Migration:risky' => true,
1716
'@PHPUnit54Migration:risky' => true,
1817
'@PHPUnit55Migration:risky' => true,
1918
'@PHPUnit56Migration:risky' => true,
2019
'@PHPUnit57Migration:risky' => true,
20+
'@PHPUnit60Migration:risky' => true,
21+
'@PHPUnit75Migration:risky' => true,
22+
'@PHPUnit84Migration:risky' => true,
2123

2224
'php_unit_construct' => true,
23-
'php_unit_dedicate_assert' => ['target' => '5.6'],
24-
'php_unit_expectation' => ['target' => '5.6'],
25+
'php_unit_dedicate_assert' => ['target' => 'newest'],
26+
'php_unit_expectation' => ['target' => 'newest'],
2527
'php_unit_fqcn_annotation' => true,
2628
'php_unit_method_casing' => true,
27-
'php_unit_mock' => ['target' => '5.5'],
29+
'php_unit_mock' => ['target' => 'newest'],
2830
'php_unit_mock_short_will_return' => true,
29-
'php_unit_namespaced' => ['target' => '5.7'],
31+
'php_unit_namespaced' => ['target' => 'newest'],
3032
'php_unit_set_up_tear_down_visibility' => true,
3133
'php_unit_test_annotation' => ['style' => 'annotation'],
3234
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],

config/phpcs.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ parameters:
1010
count: 2
1111
path: ../src/RuleSet/DeclarationBlock.php
1212

13-
-
14-
message: "#^Variable \\$oRule might not be defined\\.$#"
15-
count: 2
16-
path: ../src/RuleSet/DeclarationBlock.php
17-
1813
-
1914
message: "#^Variable \\$oVal might not be defined\\.$#"
2015
count: 1

0 commit comments

Comments
 (0)