Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 2de5462

Browse files
committed
Merge branch 'hotfix/42'
Close #42
2 parents 8d1e507 + da6e1d5 commit 2de5462

File tree

8 files changed

+34
-37
lines changed

8 files changed

+34
-37
lines changed

.travis.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ matrix:
2525
include:
2626
- php: 5.5
2727
env:
28-
- EXECUTE_CS_CHECK=true
28+
- CS_CHECK=true
2929
- EXECUTE_DOC_CHECK=true
3030
- php: 5.6
3131
env:
32-
- EXECUTE_TEST_COVERALLS=true
32+
- TEST_COVERAGE=true
3333
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
3434
- PATH="$HOME/.local/bin:$PATH"
3535
- php: 7
@@ -42,22 +42,21 @@ notifications:
4242
email: false
4343

4444
before_install:
45-
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
45+
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
4646
- composer self-update
47-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
47+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
4848

4949
install:
5050
- travis_retry composer install --no-interaction --ignore-platform-reqs --prefer-source
5151
- composer info -i
5252

5353
script:
54-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
55-
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
56-
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi
54+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
55+
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
5756
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi
5857

5958
after_success:
6059
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi
6160

6261
after_script:
63-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi
62+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,24 @@ To do so:
7777

7878
## Running Coding Standards Checks
7979

80-
This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
80+
This component uses [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for coding
8181
standards checks, and provides configuration for our selected checks.
82-
`php-cs-fixer` is installed by default via Composer.
82+
`phpcs` is installed by default via Composer.
8383

8484
To run checks only:
8585

8686
```console
87-
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
87+
$ composer cs-check
8888
```
8989

90-
To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
91-
flag:
90+
`phpcs` also includes a tool for fixing most CS violations, `phpcbf`:
91+
9292

9393
```console
94-
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
94+
$ composer cs-fix
9595
```
9696

97-
If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
97+
If you allow `phpcbf` to fix CS issues, please re-run the tests to ensure
9898
they pass, and make sure you add and commit the changes after verification.
9999

100100
## Recommended Workflow for Contributions

composer.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,23 @@
3434
"require-dev": {
3535
"phpunit/PHPUnit": "~4.0",
3636
"athletic/athletic": "^0.1",
37-
"squizlabs/php_codesniffer": "^2.0",
3837
"zendframework/zend-stdlib": "^2.7.3 || ^3.0",
39-
"container-interop/container-interop": "^1.1.0"
38+
"container-interop/container-interop": "^1.1.0",
39+
"zendframework/zend-coding-standard": "~1.0.0"
4040
},
4141
"suggest": {
4242
"container-interop/container-interop": "^1.1.0, to use the lazy listeners feature",
4343
"zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature"
44+
},
45+
"scripts": {
46+
"check": [
47+
"@cs-check",
48+
"@test"
49+
],
50+
"cs-check": "phpcs",
51+
"cs-fix": "phpcbf",
52+
"test": "phpunit --colors=always",
53+
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
54+
"upload-coverage": "coveralls -v"
4455
}
4556
}

phpcs.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
<?xml version="1.0"?>
22
<ruleset name="Zend Framework coding standard">
3-
<description>Zend Framework coding standard</description>
4-
5-
<!-- display progress -->
6-
<arg value="p"/>
7-
<arg name="colors"/>
8-
9-
<!-- inherit rules from: -->
10-
<rule ref="PSR2"/>
11-
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
12-
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
13-
<properties>
14-
<property name="ignoreBlankLines" value="false"/>
15-
</properties>
16-
</rule>
3+
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>
174

185
<!-- Paths to check -->
196
<file>src</file>

src/Event.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getTarget()
9595
*/
9696
public function setParams($params)
9797
{
98-
if (!is_array($params) && !is_object($params)) {
98+
if (! is_array($params) && ! is_object($params)) {
9999
throw new Exception\InvalidArgumentException(
100100
sprintf('Event parameters must be an array or object; received "%s"', gettype($params))
101101
);
@@ -127,15 +127,15 @@ public function getParam($name, $default = null)
127127
{
128128
// Check in params that are arrays or implement array access
129129
if (is_array($this->params) || $this->params instanceof ArrayAccess) {
130-
if (!isset($this->params[$name])) {
130+
if (! isset($this->params[$name])) {
131131
return $default;
132132
}
133133

134134
return $this->params[$name];
135135
}
136136

137137
// Check in normal objects
138-
if (!isset($this->params->{$name})) {
138+
if (! isset($this->params->{$name})) {
139139
return $default;
140140
}
141141
return $this->params->{$name};

src/EventManagerAwareTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function setEventManager(EventManagerInterface $events)
6767
*/
6868
public function getEventManager()
6969
{
70-
if (!$this->events instanceof EventManagerInterface) {
70+
if (! $this->events instanceof EventManagerInterface) {
7171
$this->setEventManager(new EventManager());
7272
}
7373
return $this->events;

test/EventManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function handleTestEvent($e)
171171

172172
public function evaluateStringCallback($value)
173173
{
174-
return (!$value);
174+
return (! $value);
175175
}
176176

177177
public function testTriggerUntilShouldMarkResponseCollectionStoppedWhenConditionMet()

test/FilterChainTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testFilterChainShouldReturnLastResponse()
7373
if (isset($params['string'])) {
7474
$params['string'] = trim($params['string']);
7575
}
76-
$return = $chain->next($context, $params, $chain);
76+
$return = $chain->next($context, $params, $chain);
7777
return $return;
7878
});
7979
$this->filterchain->attach(function ($context, array $params) {

0 commit comments

Comments
 (0)