Skip to content

Commit

Permalink
Merge pull request #2 from stof/symfony_4
Browse files Browse the repository at this point in the history
Add support for Symfony 4
  • Loading branch information
stof committed Feb 21, 2018
2 parents 3149cca + 18152b0 commit 82f1ad3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ sudo: false
php:
- 7.0
- 7.1
- 7.2
- nightly

matrix:
fast_finish: true
include:
- php: 7.0
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
# Test LTS versions
- php: 7.1
env: DEPENDENCIES=dev SYMFONY_DEPRECATIONS_HELPER=weak
env: DEPENDENCIES="dunglas/symfony-lock:^3"
# Test unstable versions
- php: 7.2
env: STABILITY="dev"
allow_failures:
- php: nightly

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

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

install: composer update $COMPOSER_FLAGS
install: composer update $COMPOSER_FLAGS --prefer-dist --no-interaction

script: phpunit -v
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
],
"require": {
"php": "^7.0",
"symfony/asset": "^3.2",
"symfony/cache": "^3.2",
"symfony/config": "^3.2",
"symfony/dependency-injection": "^3.2",
"symfony/finder": "^3.2",
"symfony/framework-bundle": "^3.2",
"symfony/http-kernel": "^3.2"
"symfony/asset": "^3.2 || ^4.0",
"symfony/cache": "^3.2 || ^4.0",
"symfony/config": "^3.2 || ^4.0",
"symfony/dependency-injection": "^3.2 || ^4.0",
"symfony/finder": "^3.2 || ^4.0",
"symfony/framework-bundle": "^3.2 || ^4.0",
"symfony/http-kernel": "^3.2 || ^4.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.2"
"symfony/phpunit-bridge": "^4.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 3 additions & 0 deletions src/CacheWarmer/AssetFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;

/**
* @internal
*/
class AssetFinder
{
private $webRoot;
Expand Down
3 changes: 2 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Flex\Recipe;

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

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

Expand Down
1 change: 1 addition & 0 deletions src/Hashing/FileHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function __construct(string $webRoot)
{
$this->webRoot = $webRoot;
}

public function computeHash(string $path): string
{
$fullPath = $this->webRoot.'/'.ltrim($path, '/');
Expand Down

0 comments on commit 82f1ad3

Please sign in to comment.