Skip to content
Merged
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ script:
- if [[ "$TRAVIS_PHP_VERSION" == '7.0' ]]; then mkdir -p build/logs && phpunit --coverage-clover build/logs/clover.xml ; fi
- if [[ "$TRAVIS_PHP_VERSION" != '7.0' ]]; then vendor/bin/phpunit ; fi
- if [[ "$TRAVIS_PHP_VERSION" == '7.0' ]]; then vendor/bin/phpcs ; fi
- vendor/bin/phpstan analyse -l 3 src/

after_script:
- if [[ "$TRAVIS_PHP_VERSION" == '7.0' ]]; then php vendor/bin/coveralls -v ; fi
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"require-dev": {
"squizlabs/php_codesniffer": "^2.5",
"phpunit/phpunit": "^6.0|^7.0",
"php-http/psr7-integration-tests": "dev-master"
"php-http/psr7-integration-tests": "dev-master",
"phpstan/phpstan": "^0.9"
},
"provide": {
"psr/http-message-implementation": "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected function toHeader($name, array $properties)
* Parse HTTP request `Cookie:` header and extract
* into a PHP associative array.
*
* @param string $header The raw HTTP request `Cookie:` header
* @param string|string[] $header The raw HTTP request `Cookie:` header
*
* @return array Associative array of cookie names and values
*
Expand Down
10 changes: 5 additions & 5 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class Request extends Message implements ServerRequestInterface
/**
* The request attributes (route segment names and values)
*
* @var \Slim\Collection
* @var Collection
*/
protected $attributes;

/**
* The request body parsed (if possible) into a PHP array or object
*
* @var null|array|object
* @var null|array|object|false
*/
protected $bodyParsed = false;

Expand Down Expand Up @@ -263,13 +263,13 @@ public function withMethod($method)
* Validate the HTTP method
*
* @param null|string $method
* @return null|string
* @return string
* @throws \InvalidArgumentException on invalid HTTP method.
*/
protected function filterMethod($method)
{
if ($method === null) {
return $method;
return '';
}

if (!is_string($method)) {
Expand Down Expand Up @@ -1051,7 +1051,7 @@ public function registerMediaTypeParser($mediaType, callable $callable)
if ($callable instanceof Closure) {
$callable = $callable->bindTo($this);
}
$this->bodyParsers[(string)$mediaType] = $callable;
$this->bodyParsers[$mediaType] = $callable;
}

/*******************************************************************************
Expand Down
12 changes: 6 additions & 6 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,35 @@ class Stream implements StreamInterface
/**
* The underlying stream resource
*
* @var resource
* @var resource|null
*/
protected $stream;

/**
* Stream metadata
*
* @var array
* @var array|null
*/
protected $meta;

/**
* Is this stream readable?
*
* @var bool
* @var bool|null
*/
protected $readable;

/**
* Is this stream writable?
*
* @var bool
* @var bool|null
*/
protected $writable;

/**
* Is this stream seekable?
*
* @var bool
* @var bool|null
*/
protected $seekable;

Expand All @@ -82,7 +82,7 @@ class Stream implements StreamInterface
/**
* Is this stream a pipe?
*
* @var bool
* @var bool|null
*/
protected $isPipe;

Expand Down
6 changes: 3 additions & 3 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected function filterScheme($scheme)
throw new InvalidArgumentException('Uri scheme must be a string');
}

$scheme = str_replace('://', '', strtolower((string)$scheme));
$scheme = str_replace('://', '', strtolower($scheme));
if (!isset($valid[$scheme])) {
throw new InvalidArgumentException('Uri scheme must be one of: "", "https", "http"');
}
Expand Down Expand Up @@ -656,7 +656,7 @@ public function withQuery($query)
if (!is_string($query) && !method_exists($query, '__toString')) {
throw new InvalidArgumentException('Uri query must be a string');
}
$query = ltrim((string)$query, '?');
$query = ltrim($query, '?');
$clone = clone $this;
$clone->query = $this->filterQuery($query);

Expand Down Expand Up @@ -724,7 +724,7 @@ public function withFragment($fragment)
if (!is_string($fragment) && !method_exists($fragment, '__toString')) {
throw new InvalidArgumentException('Uri fragment must be a string');
}
$fragment = ltrim((string)$fragment, '#');
$fragment = ltrim($fragment, '#');
$clone = clone $this;
$clone->fragment = $this->filterQuery($fragment);

Expand Down