Skip to content

Commit 413d5ea

Browse files
authored
Merge pull request #12 from stof/better_version
Make the configuration of the version more user-friendly
2 parents 1f2dcbb + ac48fa1 commit 413d5ea

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public function getConfigTreeBuilder()
1414
$rootNode
1515
->children()
1616
->scalarNode('version')
17+
->beforeNormalization()
18+
// force the version to be a string, even if the Yaml config files parsed it as float
19+
->ifTrue(function ($v) { return !is_string($v) && is_numeric($v); })
20+
->then(function ($v) { return number_format($v, 1); })
21+
->end()
1722
->defaultValue('3.0')
1823
->info('The Keen IO API Version')
1924
->example('3.0')

tests/DependencyInjection/KeenIOExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ public function testConfiguration()
3737
$this->container->compile();
3838

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

0 commit comments

Comments
 (0)