From 2a876bf2cd4771f74f9751383e3b998eaa957654 Mon Sep 17 00:00:00 2001 From: Sander van Thillo Date: Sun, 10 Dec 2017 11:52:28 +0100 Subject: [PATCH] Broadway 2.0, PHP 7 (#12) * require Broadway 2.0 * test against PHP 7 * composer already ipdated by Travis CI * removed obsolete option * install polyfill for ext-mongo * changelog * added return type hints * set branch alias to 1.0 --- .travis.yml | 16 ++++++---------- composer.json | 14 ++++++++++---- src/SagaMetadataEnricher.php | 2 +- src/State.php | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index b0ee945..bd83e9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,29 +2,25 @@ language: php matrix: include: - - php: 5.5 - - php: 5.6 - php: 7.0 - php: 7.1 + - php: 7.2 fast_finish: true before_install: # Disable XDebug speed up test execution. - phpenv config-rm xdebug.ini || return 0 - # Enable correct MongoDB driver for each PHP version - - if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then echo "extension=mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini || return 0; fi - - if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini || return 0; fi + # Enable MongoDB extension + - echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini || return 0 - echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini || return 0 install: - - travis_retry composer self-update - # Install a polyfill for Mongo extension on PHP 7 - - if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then travis_retry composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter; fi - - if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then travis_retry composer update; fi - - composer info -i + - composer install + - composer info script: - vendor/bin/phpunit --exclude-group=none + - git log $(git describe --abbrev=0 --tags)...HEAD --no-merges --pretty=format:"* [%h](http://github.com/${TRAVIS_REPO_SLUG}/commit/%H) %s (%cN)" branches: only: diff --git a/composer.json b/composer.json index 05e64cb..2b65945 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,10 @@ "description": "Proof-of-concept component providing saga functionality to broadway/broadway.", "license": "MIT", "require": { - "php": ">=5.5.9", - "broadway/broadway": "^1.0", - "beberlei/assert": "^2.0" + "php": ">=7.0", + "broadway/broadway": "^2.0", + "beberlei/assert": "^2.0", + "alcaeus/mongo-php-adapter": "^1.1" }, "authors": [ { @@ -54,7 +55,12 @@ }, "extra": { "branch-alias": { - "dev-master": "0.3.x-dev" + "dev-master": "1.0.x-dev" + } + }, + "config": { + "platform": { + "ext-mongo": "1.6.16" } } } diff --git a/src/SagaMetadataEnricher.php b/src/SagaMetadataEnricher.php index c72589f..db0718d 100644 --- a/src/SagaMetadataEnricher.php +++ b/src/SagaMetadataEnricher.php @@ -23,7 +23,7 @@ public function postHandleSaga($type, $id) $this->sagaData = ['type' => $type, 'state_id' => $id]; } - public function enrich(Metadata $metadata) + public function enrich(Metadata $metadata): Metadata { if (count($this->sagaData) === 0) { return $metadata; diff --git a/src/State.php b/src/State.php index 0f41cbc..4224822 100644 --- a/src/State.php +++ b/src/State.php @@ -86,7 +86,7 @@ public function isDone() /** * {@inheritDoc} */ - public function serialize() + public function serialize(): array { return ['id' => $this->getId(), 'values' => $this->values, 'done' => $this->isDone()]; }