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

phpstan fixes #157

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="php-coveralls/php-coveralls"
- PHPSTAN_DEPS="phpstan/phpstan:^0.12"
- TESTS_ZEND_HTTP_CLIENT_ONLINE=true
- TESTS_ZEND_HTTP_CLIENT_BASEURI=http://127.0.0.1
- TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY=127.0.0.1:8081
Expand Down Expand Up @@ -43,6 +44,7 @@ matrix:
- DEPS=locked
- CS_CHECK=true
- TEST_COVERAGE=true
- PHPSTAN_TEST=true
- php: 7.1
env:
- DEPS=latest
Expand Down Expand Up @@ -74,6 +76,7 @@ install:
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
- if [[ $PHPSTAN_TEST == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $PHPSTAN_DEPS ; fi
- stty cols 120 && composer show

before_script:
Expand Down Expand Up @@ -105,6 +108,7 @@ before_script:
script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
- if [[ $PHPSTAN_TEST == 'true' ]]; then ./vendor/bin/phpstan analyse --no-progress . ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ All notable changes to this project will be documented in this file, in reverse

### Changed

- Nothing.
- `Zend\Http\Request`'s URI now always have a default path ´/´ even when a `Zend\Uri\Http`
object is provided with no path.
- Relative URIs are not allowed anymore in `Zend\Http\Client`.
Anyway, usage of relative URIs has no sense and no adapter can handle it.

### Deprecated

Expand All @@ -22,7 +25,9 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- Fixed `Zend\Http\Cookies::getAllCookies(Zend\Http\Cookies::COOKIE_STRING_ARRAY)`.
- Fixed `Zend\Http\Cookies::getAllCookies(Zend\Http\Cookies::COOKIE_STRING_CONCAT)`.
- Fixed use of HTTP URIs with empty path in Request

## 2.11.1 - TBD

Expand Down
46 changes: 46 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
level: max

excludes_analyse:
- %currentWorkingDirectory%/docs/*
- %currentWorkingDirectory%/test/*
- %currentWorkingDirectory%/vendor/*

universalObjectCratesClasses:
- Zend\Http\Header\Accept\FieldValuePart\AbstractFieldValuePart

ignoreErrors:
-
message: '#Else branch is unreachable because ternary operator condition is always true#'
path: %currentWorkingDirectory%/src/Response.php
-
message: '#Result of && is always false#'
path: %currentWorkingDirectory%/src/PhpEnvironment/Request.php
-
message: '#Parameter \#1 $port of method Zend\\Uri\\Uri::setPort\(\) expects int, int|null given#'
path: %currentWorkingDirectory%/src/PhpEnvironment/Request.php
-
message: '#Result of && is always false#'
path: %currentWorkingDirectory%/src/Headers.php
-
message: '#Parameter \#1 \$fragment of method Zend\\Uri\\UriInterface::setFragment\(\) expects string, null given#'
path: %currentWorkingDirectory%/src/Header/Referer.php
-
message: '#Strict comparison using === between DateTime|string and 0 will always evaluate to false#'
path: %currentWorkingDirectory%/src/Header/Expires.php
-
message: '#Return type \(int\) of method Zend\\Http\\Header\\Age::getFieldValue\(\) should be compatible with return type \(string\) of method Zend\\Http\\Header\\HeaderInterface::getFieldValue\(\)#'
path: %currentWorkingDirectory%/src/Header/Age.php
-
message: '#Result of && is always false#'
path: %currentWorkingDirectory%/src/Header/Age.php
-
message: '#Access to an undefined property object::\$params#'
path: %currentWorkingDirectory%/src/Header/AbstractAccept.php
-
message: '#Negated boolean expression is always false#'
path: %currentWorkingDirectory%/src/Client/Adapter/Curl.php
-
message: '#Else branch is unreachable because previous condition is always true#'
path: %currentWorkingDirectory%/src/Client.php
- '#Access to an undefined property object::\$.+#'
2 changes: 1 addition & 1 deletion src/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class AbstractMessage extends Message
protected $version = self::VERSION_11;

/**
* @var Headers|null
* @var Headers|string|null
*/
protected $headers;

Expand Down
Loading