Skip to content

adjust baseline to reformatted error messages and fix some issues #147

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 1 commit into from
Feb 10, 2022
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
3 changes: 3 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Install legacy zend diactoros as we reference that as well
run: composer require "zendframework/zend-diactoros:2.2.1" --no-interaction --no-update

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"slim/slim": "Used with Slim Framework PSR-7 implementation"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"ergebnis/composer-normalize": true
}
},
"extra": {
"branch-alias": {
Expand Down
67 changes: 18 additions & 49 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Property Http\\\\Message\\\\Authentication\\\\Header\\:\\:\\$value type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Authentication/Header.php

-
message: "#^Method Http\\\\Message\\\\Authentication\\\\Header\\:\\:__construct\\(\\) has parameter \\$value with no typehint specified\\.$#"
count: 1
path: src/Authentication/Header.php

-
message: "#The Http\\\\Message\\\\Authentication\\\\Matching class is deprecated since version 1.2 and will be removed in 2.0.#"
count: 1
path: src/Authentication/Matching.php

-
message: "#^Property Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:\\$params type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -41,7 +26,7 @@ parameters:
path: src/Builder/ResponseBuilder.php

-
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:createWithoutValidation\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:createWithoutValidation\\(\\) has no return type specified\\.$#"
count: 1
path: src/Cookie.php

Expand All @@ -56,17 +41,17 @@ parameters:
path: src/Cookie.php

-
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateName\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateName\\(\\) has no return type specified\\.$#"
count: 1
path: src/Cookie.php

-
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateValue\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateValue\\(\\) has no return type specified\\.$#"
count: 1
path: src/Cookie.php

-
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateMaxAge\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateMaxAge\\(\\) has no return type specified\\.$#"
count: 1
path: src/Cookie.php

Expand All @@ -86,12 +71,12 @@ parameters:
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookie\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookie\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookie\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookie\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

Expand All @@ -101,22 +86,22 @@ parameters:
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:setCookies\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:setCookies\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookies\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookies\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookies\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookies\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeMatchingCookies\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeMatchingCookies\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

Expand All @@ -126,7 +111,7 @@ parameters:
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieJar.php

Expand All @@ -141,37 +126,27 @@ parameters:
path: src/CookieUtil.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\ChunkStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Encoding\\\\ChunkStream\\:\\:fill\\(\\) has no return type specified\\.$#"
count: 1
path: src/Encoding/ChunkStream.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$consumed with no typehint specified\\.$#"
count: 1
path: src/Encoding/Filter/Chunk.php

-
message: "#^Access to an undefined property Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:\\$stream\\.$#"
count: 2
path: src/Encoding/Filter/Chunk.php

-
message: "#^Access to an undefined property object\\:\\:\\$datalen\\.$#"
count: 2
path: src/Encoding/Filter/Chunk.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return type specified\\.$#"
count: 1
path: src/Encoding/FilteredStream.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:rewind\\(\\) has no return type specified\\.$#"
count: 1
path: src/Encoding/FilteredStream.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:seek\\(\\) has no return type specified\\.$#"
count: 1
path: src/Encoding/FilteredStream.php

Expand Down Expand Up @@ -205,11 +180,6 @@ parameters:
count: 1
path: src/MessageFactory/SlimMessageFactory.php

-
message: "#The Http\\\\Message\\\\RequestMatcher\\\\RegexRequestMatcher class is deprecated since version 1.2 and will be removed in 2.0.#"
count: 1
path: src/RequestMatcher/RegexRequestMatcher.php

-
message: "#^Property Http\\\\Message\\\\RequestMatcher\\\\RequestMatcher\\:\\:\\$methods type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -236,7 +206,7 @@ parameters:
path: src/Stream/BufferedStream.php

-
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#"
message: "#^Dead catch \\- Exception is already caught#"
count: 1
path: src/Stream/BufferedStream.php

Expand Down Expand Up @@ -266,12 +236,12 @@ parameters:
path: src/Stream/BufferedStream.php

-
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:seek\\(\\) has no return type specified\\.$#"
count: 1
path: src/Stream/BufferedStream.php

-
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:rewind\\(\\) has no return type specified\\.$#"
count: 1
path: src/Stream/BufferedStream.php

Expand All @@ -294,4 +264,3 @@ parameters:
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/UriFactory/SlimUriFactory.php

5 changes: 4 additions & 1 deletion src/Authentication/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ class Header implements Authentication
private $name;

/**
* @var string|array
* @var string|string[]
*/
private $value;

/**
* @param string|string[] $value
*/
public function __construct(string $name, $value)
{
$this->name = $name;
Expand Down
2 changes: 2 additions & 0 deletions src/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public function clear()
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->cookies->count();
Expand All @@ -203,6 +204,7 @@ public function count()
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return clone $this->cookies;
Expand Down
1 change: 1 addition & 0 deletions src/Encoding/Filter/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Chunk extends \php_user_filter
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
Expand Down
3 changes: 3 additions & 0 deletions src/Stream/BufferedStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ public function read($length)
if (null === $this->resource) {
throw new \RuntimeException('Cannot read on a detached stream');
}
if ($length < 0) {
throw new \InvalidArgumentException('Can not read a negative amount of bytes');
}

$read = '';

Expand Down