From 811657b5df3184434660636b681809e3766908f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tihanyi=20P=C3=A9ter?= Date: Thu, 24 Nov 2016 22:12:52 +0100 Subject: [PATCH] composer json update --- .travis.yml | 1 + composer.json | 8 ++++++-- src/FeatureSwitch/Feature/Switcher/AB.php | 6 +++--- tests/Unit/FeatureSwitch/FeatureSwitchArrayTest.php | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77344e6..5552f20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,5 @@ script: matrix: fast_finish: true allow_failures: + - php: nightly - php: hhvm \ No newline at end of file diff --git a/composer.json b/composer.json index 60627f3..ca7a5e1 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,17 @@ "description": "This package provides feature switch functionality. A/B test support and time based switcher.", "minimum-stability": "dev", "license": "MIT", - "keywords": ["feature", "flag", "toggle", "switch", "flipper", "flip", "switcher", "AB test"], + "keywords": ["feature", "toggle", "switch", "flipper", "flip", "switcher", "AB test", "flag", "feature switch"], "authors": [ { "name": "Peter Tihanyi", "email": "tihi@systream.hu" } ], + "support": { + "issues": "https://github.com/systream/feature-switch/issues", + "source": "https://github.com/systream/feature-switch" + }, "autoload": { "psr-4": { "Systream\\": "src/", @@ -17,7 +21,7 @@ } }, "require": { - "php": ">=5.4.0" + "php": ">=5.6.0" }, "require-dev": { "phpunit/phpunit": "~5.3", diff --git a/src/FeatureSwitch/Feature/Switcher/AB.php b/src/FeatureSwitch/Feature/Switcher/AB.php index f57ace9..8eeb514 100644 --- a/src/FeatureSwitch/Feature/Switcher/AB.php +++ b/src/FeatureSwitch/Feature/Switcher/AB.php @@ -37,10 +37,10 @@ public function isEnabled(FeatureInterface $feature) */ protected function getRandomState() { - $state = $this->lastState === null ? $this->getRandomStateByMicroTime() : !$this->lastState; - $this->lastState = $state; + $this->lastState = + ($this->lastState === null ? $this->getRandomStateByMicroTime() : !$this->lastState); - return $state ? 'TRUE' : 'FALSE'; + return $this->lastState ? 'TRUE' : 'FALSE'; } diff --git a/tests/Unit/FeatureSwitch/FeatureSwitchArrayTest.php b/tests/Unit/FeatureSwitch/FeatureSwitchArrayTest.php index 44b822a..05976ce 100644 --- a/tests/Unit/FeatureSwitch/FeatureSwitchArrayTest.php +++ b/tests/Unit/FeatureSwitch/FeatureSwitchArrayTest.php @@ -54,6 +54,7 @@ public function iterator() */ public function iterator_isset() { + /** @var FeatureSwitch\Feature[] $featureSwitch */ $featureSwitch = $this->getClass(); $featureSwitch->addFeature($featureSwitch::buildFeature('foo', true));