Skip to content

Commit

Permalink
Declare strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
gmponos committed Dec 4, 2018
1 parent 1e1380a commit f52e089
Show file tree
Hide file tree
Showing 45 changed files with 116 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/AppendStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/BufferStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/CachingStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/DroppingStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/FnStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/InflateStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/LazyOpenStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/LimitStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/MessageTrait.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/MultipartStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/NoSeekStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/PumpStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use InvalidArgumentException;
Expand Down
3 changes: 3 additions & 0 deletions src/Response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\ResponseInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Rfc7230.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

final class Rfc7230
Expand Down
2 changes: 2 additions & 0 deletions src/ServerRequest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use InvalidArgumentException;
Expand Down
3 changes: 3 additions & 0 deletions src/Stream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/StreamDecoratorTrait.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
5 changes: 4 additions & 1 deletion src/StreamWrapper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down Expand Up @@ -38,7 +41,7 @@ public static function getResource(StreamInterface $stream)
. 'writable, or both.');
}

return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/UploadedFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use InvalidArgumentException;
Expand Down
7 changes: 5 additions & 2 deletions src/Uri.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\UriInterface;
Expand Down Expand Up @@ -618,7 +621,7 @@ private function filterPort($port)
/**
* @param UriInterface $uri
* @param array $keys
*
*
* @return array
*/
private static function getFilteredQueryString(UriInterface $uri, array $keys)
Expand All @@ -639,7 +642,7 @@ private static function getFilteredQueryString(UriInterface $uri, array $keys)
/**
* @param string $key
* @param string|null $value
*
*
* @return string
*/
private static function generateQueryString($key, $value)
Expand Down
3 changes: 3 additions & 0 deletions src/UriNormalizer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\UriInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/UriResolver.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\UriInterface;
Expand Down
2 changes: 2 additions & 0 deletions tests/AppendStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\AppendStream;
Expand Down
2 changes: 2 additions & 0 deletions tests/BufferStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\BufferStream;
Expand Down
4 changes: 3 additions & 1 deletion tests/CachingStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down Expand Up @@ -141,7 +143,7 @@ public function testSkipsOverwrittenBytes()
{
$decorated = Psr7\stream_for(
implode("\n", array_map(function ($n) {
return str_pad($n, 4, '0', STR_PAD_LEFT);
return str_pad((string)$n, 4, '0', STR_PAD_LEFT);
}, range(0, 25)))
);

Expand Down
2 changes: 2 additions & 0 deletions tests/DroppingStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\BufferStream;
Expand Down
2 changes: 2 additions & 0 deletions tests/FnStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/FunctionsTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/InflateStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/LazyOpenStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\LazyOpenStream;
Expand Down
2 changes: 2 additions & 0 deletions tests/LimitStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/MultipartStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/NoSeekStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/PumpStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\LimitStream;
Expand Down
2 changes: 2 additions & 0 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7;
Expand Down
2 changes: 2 additions & 0 deletions tests/ServerRequestTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\ServerRequest;
Expand Down
2 changes: 2 additions & 0 deletions tests/StreamDecoratorTraitTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use Psr\Http\Message\StreamInterface;
Expand Down
2 changes: 2 additions & 0 deletions tests/StreamTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\NoSeekStream;
Expand Down
2 changes: 2 additions & 0 deletions tests/StreamWrapperTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\StreamWrapper;
Expand Down
4 changes: 2 additions & 2 deletions tests/UploadedFileTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use ReflectionProperty;
Expand Down Expand Up @@ -197,8 +199,6 @@ public function testMoveRaisesExceptionForInvalidPath($path)
$stream = \GuzzleHttp\Psr7\stream_for('Foo bar!');
$upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);

$this->cleanup[] = $path;

$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('path');
$upload->moveTo($path);
Expand Down
4 changes: 3 additions & 1 deletion tests/UriNormalizerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace GuzzleHttp\Tests\Psr7;

use GuzzleHttp\Psr7\Uri;
Expand Down Expand Up @@ -28,7 +30,7 @@ public function testCapitalizePercentEncoding()
/**
* @dataProvider getUnreservedCharacters
*/
public function testDecodeUnreservedCharacters($char)
public function testDecodeUnreservedCharacters(string $char)
{
$percentEncoded = '%'.bin2hex($char);
// Add encoded reserved characters to test that those are not decoded and include the percent-encoded
Expand Down
Loading

0 comments on commit f52e089

Please sign in to comment.