Skip to content

Commit 00f7f01

Browse files
committed
Merge branch 'feature/36' into develop
Close #36 Close #45
2 parents ba209e6 + c443812 commit 00f7f01

File tree

11 files changed

+2275
-74
lines changed

11 files changed

+2275
-74
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
composer.lock
21
vendor/

.travis.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,60 @@ language: php
55
cache:
66
directories:
77
- $HOME/.composer/cache
8+
- vendor
9+
10+
env:
11+
global:
12+
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
813

914
matrix:
1015
fast_finish: true
1116
include:
12-
- php: 5.5
17+
- php: 5.6
18+
env:
19+
- DEPS=lowest
20+
- php: 5.6
1321
env:
14-
- EXECUTE_CS_CHECK=true
22+
- DEPS=locked
1523
- php: 5.6
1624
env:
17-
- EXECUTE_COVERAGE=true
25+
- DEPS=latest
26+
- php: 7
27+
env:
28+
- DEPS=lowest
29+
- php: 7
30+
env:
31+
- DEPS=locked
32+
- CS_CHECK=true
1833
- php: 7
34+
env:
35+
- DEPS=latest
36+
- php: hhvm
37+
env:
38+
- DEPS=lowest
1939
- php: hhvm
40+
env:
41+
- DEPS=locked
42+
- php: hhvm
43+
env:
44+
- DEPS=latest
2045
allow_failures:
21-
- php: 7
2246
- php: hhvm
2347

2448
notifications:
2549
irc: "irc.freenode.org#apigility-dev"
2650
email: false
2751

2852
before_install:
29-
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
30-
- composer self-update
53+
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
54+
- travis_retry composer self-update
3155

3256
install:
33-
- travis_retry composer install --no-interaction --ignore-platform-reqs --prefer-source
57+
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
58+
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
59+
- travis_retry composer install $COMPOSER_ARGS
60+
- composer show
3461

3562
script:
36-
- ./vendor/bin/phpunit
37-
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi
63+
- composer test
64+
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file, in reverse chronological order by release.
4+
5+
## 1.2.0 - TBD
6+
7+
### Added
8+
9+
- [#45](https://github.com/zfcampus/zf-api-problem/pull/45) adds support for PHP 7.
10+
- [#45](https://github.com/zfcampus/zf-api-problem/pull/45) adds support for
11+
version 3 components of Zend Framework.
12+
13+
### Deprecated
14+
15+
- Nothing.
16+
17+
### Removed
18+
19+
- [#45](https://github.com/zfcampus/zf-api-problem/pull/45) removes support for
20+
PHP 5.6.
21+
- [#45](https://github.com/zfcampus/zf-api-problem/pull/45) removes the
22+
`Module::getAutoloaderConfig()` implementation, as it was redundant in
23+
composer-based applications.
24+
25+
### Fixed
26+
27+
- [#45](https://github.com/zfcampus/zf-api-problem/pull/45) ensures that
28+
definition and attachment of the listener aggregates defined in the module
29+
will work with both v2 and v3 versions of zend-eventmanager.

Module.php

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,13 @@
88

99
use Zend\Mvc\ResponseSender\SendResponseEvent;
1010
use Zend\Mvc\MvcEvent;
11+
use ZF\ApiProblem\Listener\SendApiProblemResponseListener;
1112

1213
/**
1314
* ZF2 module
1415
*/
1516
class Module
1617
{
17-
/**
18-
* Retrieve autoloader configuration
19-
*
20-
* @return array
21-
*/
22-
public function getAutoloaderConfig()
23-
{
24-
return array(
25-
'Zend\Loader\StandardAutoloader' => array('namespaces' => array(
26-
__NAMESPACE__ => __DIR__ . '/src/',
27-
))
28-
);
29-
}
30-
3118
/**
3219
* Retrieve module configuration
3320
*
@@ -43,21 +30,21 @@ public function getConfig()
4330
*
4431
* Attaches a render event.
4532
*
46-
* @param \Zend\Mvc\MvcEvent $e
33+
* @param MvcEvent $e
4734
*/
48-
public function onBootstrap($e)
35+
public function onBootstrap(MvcEvent $e)
4936
{
5037
$app = $e->getTarget();
5138
$serviceManager = $app->getServiceManager();
5239
$eventManager = $app->getEventManager();
5340

54-
$eventManager->attach($serviceManager->get('ZF\ApiProblem\ApiProblemListener'));
55-
$eventManager->attach(MvcEvent::EVENT_RENDER, array($this, 'onRender'), 100);
41+
$serviceManager->get('ZF\ApiProblem\ApiProblemListener')->attach($eventmanager);
42+
$eventManager->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender'], 100);
5643

5744
$sendResponseListener = $serviceManager->get('SendResponseListener');
5845
$sendResponseListener->getEventManager()->attach(
5946
SendResponseEvent::EVENT_SEND_RESPONSE,
60-
$serviceManager->get('ZF\ApiProblem\Listener\SendApiProblemResponseListener'),
47+
$serviceManager->get(SendApiProblemResponseListener::class),
6148
-500
6249
);
6350
}
@@ -67,9 +54,9 @@ public function onBootstrap($e)
6754
*
6855
* Attaches a rendering/response strategy to the View.
6956
*
70-
* @param \Zend\Mvc\MvcEvent $e
57+
* @param MvcEvent $e
7158
*/
72-
public function onRender($e)
59+
public function onRender(MvcEvent $e)
7360
{
7461
$app = $e->getTarget();
7562
$services = $app->getServiceManager();
@@ -80,7 +67,7 @@ public function onRender($e)
8067

8168
// register at high priority, to "beat" normal json strategy registered
8269
// via view manager, as well as HAL strategy.
83-
$events->attach($services->get('ZF\ApiProblem\ApiProblemStrategy'), 400);
70+
$services->get('ZF\ApiProblem\ApiProblemStrategy')->attach($events, 400);
8471
}
8572
}
8673
}

composer.json

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,25 @@
1717
"source": "https://github.com/zfcampus/zf-api-problem",
1818
"issues": "https://github.com/zfcampus/zf-api-problem/issues"
1919
},
20-
"repositories": [
21-
{ "type": "composer", "url": "https://packages.zendframework.com" }
22-
],
2320
"extra": {
2421
"branch-alias": {
2522
"dev-master": "1.1-dev",
2623
"dev-develop": "1.2-dev"
24+
},
25+
"zf": {
26+
"module": "ZF\\ApiProblem"
2727
}
2828
},
2929
"require": {
30-
"php": ">=5.5",
31-
"zendframework/zend-eventmanager": "~2.3",
32-
"zendframework/zend-http": "~2.3",
33-
"zendframework/zend-json": "~2.3",
34-
"zendframework/zend-mvc": "~2.3",
35-
"zendframework/zend-view": "~2.3"
30+
"php": "^5.6 || ^7.0",
31+
"zendframework/zend-eventmanager": "^2.6.3 || ^3.0.1",
32+
"zendframework/zend-http": "^2.5.4",
33+
"zendframework/zend-json": "^2.6.1 || ^3.0",
34+
"zendframework/zend-mvc": "^2.7.9 || ^3.0.2",
35+
"zendframework/zend-view": "^2.8.1"
3636
},
3737
"require-dev": {
38-
"phpunit/phpunit": "~4.7",
39-
"zendframework/zend-console": "~2.3",
40-
"zendframework/zend-loader": "~2.3",
38+
"phpunit/phpunit": "^4.8",
4139
"squizlabs/php_codesniffer": "^2.3.1"
4240
},
4341
"autoload": {
@@ -52,5 +50,14 @@
5250
"psr-4": {
5351
"ZFTest\\ApiProblem\\": "test/"
5452
}
53+
},
54+
"scripts": {
55+
"check": [
56+
"@cs-check",
57+
"@test"
58+
],
59+
"cs-check": "phpcs",
60+
"cs-fix": "phpcbf",
61+
"test": "phpunit"
5562
}
5663
}

0 commit comments

Comments
 (0)