Skip to content

Commit 18152b0

Browse files
committed
Add support for Symfony 4
1 parent 3149cca commit 18152b0

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

.travis.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@ sudo: false
55
php:
66
- 7.0
77
- 7.1
8+
- 7.2
89
- nightly
910

1011
matrix:
1112
fast_finish: true
1213
include:
1314
- php: 7.0
1415
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
16+
# Test LTS versions
1517
- php: 7.1
16-
env: DEPENDENCIES=dev SYMFONY_DEPRECATIONS_HELPER=weak
18+
env: DEPENDENCIES="dunglas/symfony-lock:^3"
19+
# Test unstable versions
20+
- php: 7.2
21+
env: STABILITY="dev"
1722
allow_failures:
1823
- php: nightly
1924

@@ -22,8 +27,9 @@ cache:
2227
- $HOME/.composer/cache/files
2328

2429
before_install:
25-
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
30+
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
31+
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
2632

27-
install: composer update $COMPOSER_FLAGS
33+
install: composer update $COMPOSER_FLAGS --prefer-dist --no-interaction
2834

2935
script: phpunit -v

composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
],
1212
"require": {
1313
"php": "^7.0",
14-
"symfony/asset": "^3.2",
15-
"symfony/cache": "^3.2",
16-
"symfony/config": "^3.2",
17-
"symfony/dependency-injection": "^3.2",
18-
"symfony/finder": "^3.2",
19-
"symfony/framework-bundle": "^3.2",
20-
"symfony/http-kernel": "^3.2"
14+
"symfony/asset": "^3.2 || ^4.0",
15+
"symfony/cache": "^3.2 || ^4.0",
16+
"symfony/config": "^3.2 || ^4.0",
17+
"symfony/dependency-injection": "^3.2 || ^4.0",
18+
"symfony/finder": "^3.2 || ^4.0",
19+
"symfony/framework-bundle": "^3.2 || ^4.0",
20+
"symfony/http-kernel": "^3.2 || ^4.0"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "^3.2"
23+
"symfony/phpunit-bridge": "^4.0"
2424
},
2525
"autoload": {
2626
"psr-4": {

src/CacheWarmer/AssetFinder.php

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use Symfony\Component\Finder\Finder;
66
use Symfony\Component\Finder\SplFileInfo;
77

8+
/**
9+
* @internal
10+
*/
811
class AssetFinder
912
{
1013
private $webRoot;

src/DependencyInjection/Configuration.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
66
use Symfony\Component\Config\Definition\ConfigurationInterface;
7+
use Symfony\Flex\Recipe;
78

89
class Configuration implements ConfigurationInterface
910
{
@@ -16,7 +17,7 @@ public function getConfigTreeBuilder()
1617
$rootNode = $treeBuilder->root('incenteev_hashed_asset');
1718

1819
$rootNode->children()
19-
->scalarNode('web_root')->defaultValue('%kernel.root_dir%/../web')->end()
20+
->scalarNode('web_root')->defaultValue(\class_exists(Recipe::class) ? '%kernel.project_dir%/public' : '%kernel.root_dir%/../web')->end()
2021
->scalarNode('version_format')->defaultValue('%%s?%%s')->end()
2122
;
2223

src/Hashing/FileHasher.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public function __construct(string $webRoot)
1010
{
1111
$this->webRoot = $webRoot;
1212
}
13+
1314
public function computeHash(string $path): string
1415
{
1516
$fullPath = $this->webRoot.'/'.ltrim($path, '/');

0 commit comments

Comments
 (0)