Skip to content

Commit

Permalink
OPENEUROPA-1739: Ensure Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE exists b…
Browse files Browse the repository at this point in the history
…y requiring simfony/yaml >=3.1.
  • Loading branch information
D Vargas committed Sep 4, 2019
1 parent 770c802 commit 365c822
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
"consolidation/robo": "^1.4",
"gitonomy/gitlib": "^1.0",
"nuvoleweb/robo-config": "^0.2.1",
"jakeasmith/http_build_url": "^1.0.1"
"jakeasmith/http_build_url": "^1.0.1",
"symfony/yaml": ">=3.1"
},
"require-dev": {
"openeuropa/code-review": "~1.0.0-beta3",
"phpunit/phpunit": "~5.5||~6.0"
},
"_readme": [
"We need require a version of 'symfony/yaml' equal or higher then '3.1' since versions before don't have dumper 'DUMP' constants available."
],
"autoload": {
"psr-4": {
"OpenEuropa\\TaskRunner\\": "./src/"
Expand Down
9 changes: 1 addition & 8 deletions src/Commands/AbstractDrupalCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,7 @@ public function servicesSetup(array $options = [
// Read given parameters.
$service_parameters['parameters'] = $this->getConfig()->get('drupal.service_parameters');
$dumper = new Dumper(2);
// Set flag to be compatible with symfony/yaml versions 2.x.x. (see https://github.com/symfony/yaml/blob/2.8/Dumper.php#L53)
if (property_exists(Yaml::class, 'DUMP_EXCEPTION_ON_INVALID_TYPE')) {
$flag = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
} else {
$flag = true;
}

$yaml = $dumper->dump($service_parameters, PHP_INT_MAX, 0, $flag);
$yaml = $dumper->dump($service_parameters, PHP_INT_MAX, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);

// Set the destination file.
$services_destination_file = $options['root'] . '/sites/' . $options['sites-subdir'] . '/services.yml';
Expand Down

0 comments on commit 365c822

Please sign in to comment.