Skip to content

Commit

Permalink
Merge pull request #41 from adespresso/restore-bc
Browse files Browse the repository at this point in the history
Restore some Breaking Changes
  • Loading branch information
EmanueleMinotto authored May 4, 2018
2 parents 2e35941 + 09904c6 commit a83f63e
Show file tree
Hide file tree
Showing 9 changed files with 4,213 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
composer.lock
phpunit.xml
vendor/
3 changes: 2 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ checks:
php: true
filter:
excluded_paths:
- 'composer.lock'
- 'vendor/*'
- 'Tests/*'
build:
environment:
php: '5.5.25'
php: '7.0.8'
tests:
override:
-
Expand Down
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@ cache:
- $HOME/.composer/cache/files

php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
- nightly

matrix:
allow_failures:
- php: 7.1
- php: nightly
fast_finish: true

install:
Expand All @@ -31,7 +24,7 @@ script:
- SYMFONY_DEPRECATIONS_HELPER=weak vendor/bin/phpunit -v

after_success:
- 'if [[ $TRAVIS_PULL_REQUEST == "false" && $TRAVIS_BRANCH == "master" && $TRAVIS_PHP_VERSION == "5.6" ]]; then sh generate-api.sh; fi;'
- 'if [[ $TRAVIS_PULL_REQUEST == "false" && $TRAVIS_BRANCH == "master" && $TRAVIS_PHP_VERSION == "7.0" ]]; then sh generate-api.sh; fi;'

notifications:
email: false
17 changes: 12 additions & 5 deletions Command/LoadFeatureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ public function execute(InputInterface $input, OutputInterface $output)

$found = [];
foreach ($files as $file) {
$tree = $twig->parse($twig->tokenize(new Twig_Source(
file_get_contents($file->getPathname()),
$file->getFilename(),
$file->getPathname()
)));
if (class_exists(Twig_Source::class)) {
$tree = $twig->parse($twig->tokenize(new Twig_Source(
file_get_contents($file->getPathname()),
$file->getFilename(),
$file->getPathname()
)));
} else {
$tree = $twig->parse(
$twig->tokenize(file_get_contents($file->getPathname()))
);
}

$tags = $this->findFeatureNodes($tree);

if (empty($tags)) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Command/LoadFeatureCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testExecuteWithTemplates()
->disableOriginalConstructor()
->getMock();

$twig = new Twig_Environment(new Twig_Loader_Array());
$twig = new Twig_Environment(new Twig_Loader_Array([]));
$twig->addExtension(new FeatureExtension($service));

$this->container
Expand Down
2 changes: 1 addition & 1 deletion Tests/Twig/Node/FeatureNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getTests()
new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1),
], [], 1);

$extension = Twig_Environment::VERSION_ID >= 12600
$extension = version_compare(Twig_Environment::VERSION, '1.26.0', '>=')
? FeatureExtension::class
: 'feature';

Expand Down
2 changes: 1 addition & 1 deletion Twig/Node/FeatureNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function createExpression($name, $parent, $lineno)
{
return new Twig_Node_Expression_MethodCall(
new Twig_Node_Expression_ExtensionReference(
Twig_Environment::VERSION_ID >= 12600
version_compare(Twig_Environment::VERSION, '1.26.0', '>=')
? FeatureExtension::class
: 'feature',
$lineno
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"license": "Apache-2.0",
"name": "adespresso/feature-bundle",
"require": {
"php": "^5.5 || ^7.0",
"php": "^7.0",
"doctrine/orm": "^2.2.3",
"sonata-project/admin-bundle": "^2.3.4",
"sonata-project/doctrine-orm-admin-bundle": "^2.3.1",
Expand Down
Loading

0 comments on commit a83f63e

Please sign in to comment.