Skip to content

Commit

Permalink
Merge pull request #12 from stof/better_version
Browse files Browse the repository at this point in the history
Make the configuration of the version more user-friendly
  • Loading branch information
k-k authored Apr 12, 2017
2 parents 1f2dcbb + ac48fa1 commit 413d5ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public function getConfigTreeBuilder()
$rootNode
->children()
->scalarNode('version')
->beforeNormalization()
// force the version to be a string, even if the Yaml config files parsed it as float
->ifTrue(function ($v) { return !is_string($v) && is_numeric($v); })
->then(function ($v) { return number_format($v, 1); })
->end()
->defaultValue('3.0')
->info('The Keen IO API Version')
->example('3.0')
Expand Down
1 change: 1 addition & 0 deletions tests/DependencyInjection/KeenIOExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ public function testConfiguration()
$this->container->compile();

$this->assertTrue($this->container->has('keen_io'));
$this->assertInstanceOf('KeenIO\Client\KeenIOClient', $this->container->get('keen_io'));
}
}

0 comments on commit 413d5ea

Please sign in to comment.