Skip to content

Test against symfony versions #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ cache:
directories:
- $HOME/.composer/cache/files

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

env:
global:
- TEST_COMMAND="composer test"
Expand All @@ -27,18 +19,44 @@ branches:
matrix:
fast_finish: true
include:
- php: 7.1
env: DEPENDENCIES="minimum"

# Test the latest stable release
- php: 5.5
- php: 7.0
- php: 7.1
- php: 7.2
env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^1.0"

# Test LTS versions
- php: 5.4
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
env: DEPENDENCIES="symfony/lts:^2"
- php: 5.5
env: DEPENDENCIES="symfony/lts:^3"

# Latest dev release
- php: 7.1
env: DEPENDENCIES="dev"

allow_failures:
# Latest beta is allowed to fail.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong comment

- php: 7.1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to specify the PHP version here. It will avoid having to keep it in sync when changing the version used by DEPENDENCIES="dev"

env: DEPENDENCIES="dev"

before_install:
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would instead just set $COMPOSER_FLAGS above

- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename the var to $STABILITY (or something like that) here

- if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then just test for $DEPENDENCIES not being empty here


install:
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction

script:
- composer validate --strict --no-check-lock
- $TEST_COMMAND

after_success:
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
}
],
"require": {
"php": ">=5.4",
"php": "^5.4 || ^7.0",
"php-http/httplug": "^1.1",
"php-http/message-factory": "^1.0",
"php-http/message": "^1.6",
"symfony/options-resolver": "^2.6 || ^3.0 || ^4.0"
},
"require-dev": {
"phpspec/phpspec": "^2.4",
"henrikbjorn/phpspec-code-coverage" : "^1.0",
"phpspec/phpspec": "^2.4 || ^3.0 || ^4.0",
"guzzlehttp/psr7": "^1.4"
},
"suggest": {
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/AddHostPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class AddHostPlugin implements Plugin
*/
public function __construct(UriInterface $host, array $config = [])
{
if ($host->getHost() === '') {
if ('' === $host->getHost()) {
throw new \LogicException('Host can not be empty');
}

Expand All @@ -51,7 +51,7 @@ public function __construct(UriInterface $host, array $config = [])
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
{
if ($this->replace || $request->getUri()->getHost() === '') {
if ($this->replace || '' === $request->getUri()->getHost()) {
$uri = $request->getUri()
->withHost($this->host->getHost())
->withScheme($this->host->getScheme())
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/AddPathPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ final class AddPathPlugin implements Plugin
*/
public function __construct(UriInterface $uri)
{
if ($uri->getPath() === '') {
if ('' === $uri->getPath()) {
throw new \LogicException('URI path cannot be empty');
}

if (substr($uri->getPath(), -1) === '/') {
if ('/' === substr($uri->getPath(), -1)) {
throw new \LogicException('URI path cannot end with a slash.');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ContentTypePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function isJson($stream)

json_decode($stream->getContents());

return json_last_error() == JSON_ERROR_NONE;
return JSON_ERROR_NONE == json_last_error();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strict comparison ?

}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/CookiePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
continue;
}

if ($cookie->isSecure() && ($request->getUri()->getScheme() !== 'https')) {
if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) {
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Plugin/DecoderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ private function decodeOnEncodingHeader($headerName, ResponseInterface $response
*/
private function decorateStream($encoding, StreamInterface $stream)
{
if (strtolower($encoding) == 'chunked') {
if ('chunked' == strtolower($encoding)) {
return new Encoding\DechunkStream($stream);
}

if (strtolower($encoding) == 'deflate') {
if ('deflate' == strtolower($encoding)) {
return new Encoding\DecompressStream($stream);
}

if (strtolower($encoding) == 'gzip') {
if ('gzip' == strtolower($encoding)) {
return new Encoding\GzipDecodeStream($stream);
}

Expand Down