Skip to content

Commit a5e7f02

Browse files
committed
Merge remote-tracking branch 'origin/4.x'
2 parents 25acef4 + dbe96ee commit a5e7f02

29 files changed

+285
-465
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = false
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
charset = "utf-8"
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/tags
33
/vendor
44
/composer.lock
5+
/.idea
6+
.phpunit.result.cache

.travis.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,40 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
6-
- 7.1
74
- 7.2
85
- 7.3
96

107
env:
118
global:
129
- DEFAULT=1
13-
- COVERAGE=0
14-
- PHPCS=0
15-
10+
1611
matrix:
1712
fast_finish: true
1813

1914
include:
2015
- php: 7.3
21-
env: PHPCS=1
16+
env: PHPCS=1 DEFAULT=0
2217

2318
- php: 7.3
24-
env: COVERAGE=1
19+
env: COVERAGE=1 DEFAULT=0
2520

2621
before_script:
2722
- phpenv rehash
2823

2924
install:
3025
- composer self-update
3126
- composer install --prefer-dist --no-interaction --dev
27+
- if [[ $PHPSTAN = 1 ]]; then composer stan-setup; fi
3228

3329
script:
34-
- if [[ $DEFAULT == 1 ]]; then vendor/bin/phpunit; fi
35-
36-
- if [[ $PHPCS == 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
37-
38-
- if [[ $COVERAGE == 1 ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml || true; fi
39-
- if [[ $COVERAGE == 1 ]]; then wget -O codecov.sh https://codecov.io/bash; fi
40-
- if [[ $COVERAGE == 1 ]]; then bash codecov.sh; fi
30+
- if [[ $DEFAULT = 1 ]]; then composer test; fi
31+
- if [[ $COVERAGE = 1 ]]; then composer coverage-test; fi
32+
- if [[ $PHPCS = 1 ]]; then composer cs-check; fi
33+
- if [[ $PHPSTAN = 1 ]]; then composer stan; fi
4134

4235
after_success:
43-
- if [[ $COVERAGE == 1 ]]; then bash <(curl -s https://codecov.io/bash); fi
36+
- if [[ $COVERAGE = 1 ]]; then bash <(curl -s https://codecov.io/bash); fi
4437

38+
4539
notifications:
4640
email: false

composer.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
"source": "https://github.com/markstory/asset_compress"
1818
},
1919
"require": {
20-
"cakephp/cakephp": ">=3.7.0 <4.0.0",
20+
"php": ">=7.2.0",
21+
"cakephp/cakephp": "^4.0",
2122
"markstory/mini-asset": ">=1.4.0 <2.0.0"
2223
},
2324
"require-dev": {
24-
"phpunit/phpunit": "^5.7.14|^6.0",
25-
"cakephp/cakephp-codesniffer": "~2.1"
25+
"phpunit/phpunit": "~8.5.0",
26+
"cakephp/cakephp-codesniffer": "^4.0"
2627
},
2728
"autoload": {
2829
"psr-4": {
@@ -41,5 +42,20 @@
4142
"patchwork/jshrink": "For using the JShrink filter.",
4243
"scssphp/scssphp": "For using the ScssPHP filter.",
4344
"leafo/lessphp": "For using the LessPHP filter."
44-
}
45+
},
46+
"scripts": {
47+
"check": [
48+
"@cs-check",
49+
"@test",
50+
"@stan"
51+
],
52+
"cs-check": "phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/TestCase/",
53+
"cs-fix": "phpcbf --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/TestCase/",
54+
"test": "phpunit --stderr",
55+
"stan": "phpstan analyse src/ && psalm --show-info=false",
56+
"stan-test": "phpstan analyse tests/",
57+
"psalm": "psalm",
58+
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.11 vimeo/psalm:^3.0 && mv composer.backup composer.json",
59+
"coverage-test": "phpunit --stderr --coverage-clover=clover.xml"
60+
}
4561
}

config/bootstrap.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
<?php
2-
use AssetCompress\Middleware\AssetCompressMiddleware;
3-
use Cake\Core\Configure;
4-
use Cake\Event\EventManager;
5-
use Cake\Routing\DispatcherFactory;
6-
7-
$appClass = Configure::read('App.namespace') . '\Application';
8-
if (!class_exists($appClass)) {
9-
deprecationWarning('You need to upgrade to the new Http Libraries to use AssetCompress.');
10-
}

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 6
3+
autoload_files:
4+
- tests/bootstrap.php
5+
ignoreErrors:

src/AssetScanner.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace AssetCompress;
35

4-
use Cake\Core\App;
56
use Cake\Core\Plugin as CorePlugin;
6-
use Cake\Utility\Inflector;
77
use MiniAsset\AssetScanner as BaseScanner;
88
use RuntimeException;
99

@@ -18,8 +18,8 @@ class AssetScanner extends BaseScanner
1818
/**
1919
* @const Pattern for various prefixes.
2020
*/
21-
const THEME_PATTERN = '/^(?:t|theme)\:/';
22-
const PLUGIN_PATTERN = '/^(?:p|plugin)\:(.*)\:(.*)$/';
21+
public const THEME_PATTERN = '/^(?:t|theme)\:/';
22+
public const PLUGIN_PATTERN = '/^(?:p|plugin)\:(.*)\:(.*)$/';
2323

2424
/**
2525
* The current theme if there is one.
@@ -76,7 +76,7 @@ protected function _expandTheme($file)
7676
* Resolve a plugin file to its full path.
7777
*
7878
* @param string $file The theme file to find.
79-
* @throws RuntimeException when plugins are missing.
79+
* @throws \RuntimeException when plugins are missing.
8080
* @return string The expanded path
8181
*/
8282
protected function _expandPlugin($file)

src/Config/ConfigFinder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
class ConfigFinder
1717
{
18-
1918
/**
2019
* Load all configuration files in the application.
2120
*

src/Factory.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace AssetCompress;
35

4-
use AssetCompress\AssetScanner;
5-
use AssetCompress\Filter\FilterRegistry;
66
use Cake\Core\App;
77
use Cake\Core\Configure;
8-
use MiniAsset\AssetCollection;
9-
use MiniAsset\AssetConfig;
10-
use MiniAsset\AssetTarget;
118
use MiniAsset\Factory as BaseFactory;
12-
use MiniAsset\File\Local;
13-
use MiniAsset\File\Remote;
14-
use MiniAsset\Output\AssetCacher;
15-
use MiniAsset\Output\AssetWriter;
169
use MiniAsset\Output\Compiler;
17-
use RuntimeException;
1810

1911
/**
2012
* A factory for various object using a config file.
@@ -86,7 +78,7 @@ public function scanner($paths)
8678
protected function buildFilter($name, $config)
8779
{
8880
$className = App::className($name, 'Filter');
89-
if (!class_exists($className)) {
81+
if (!class_exists((string)$className)) {
9082
$className = App::className('AssetCompress.' . $name, 'Filter');
9183
}
9284
$className = $className ?: $name;

src/Filter/ImportInline.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace AssetCompress\Filter;
35

46
use AssetCompress\AssetScanner;
@@ -23,7 +25,7 @@ protected function scanner()
2325
}
2426
$this->scanner = new AssetScanner(
2527
$this->_settings['paths'],
26-
isset($this->_settings['theme']) ? $this->_settings['theme'] : null
28+
$this->_settings['theme'] ?? null
2729
);
2830

2931
return $this->scanner;

0 commit comments

Comments
 (0)