Skip to content
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

Draft : phpunit/phpunit:^10.5.38, laminas/laminas-coding-standard:^3.0, Apply phpunit attribute migration #87

Closed
wants to merge 2 commits into from
Closed
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: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"require-dev": {
"ext-curl": "*",
"laminas/laminas-coding-standard": "~2.4.0",
"phpunit/phpunit": "^9.6.21"
"laminas/laminas-coding-standard": "^3.0.1",
"phpunit/phpunit": "^10.5.38"
},
"suggest": {
"paragonie/certainty": "For automated management of cacert.pem"
Expand Down
692 changes: 291 additions & 401 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/book/client/adapters.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Client Connection Adapters
# Connection Adapters

`Laminas\Http\Client` is based on a connection adapter design. The connection adapter is the object in
charge of performing the actual connection to the server, as well as writing requests and reading
Expand Down
2 changes: 1 addition & 1 deletion docs/book/client/advanced.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Client Advanced Usage
# Advanced Usage

## HTTP redirections

Expand Down
2 changes: 1 addition & 1 deletion docs/book/client/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Client
# Introduction

`Laminas\Http\Client` provides an interface for performing Hyper-Text Transfer
Protocol (HTTP) requests. `Laminas\Http\Client` supports all basic features
Expand Down
2 changes: 1 addition & 1 deletion docs/book/client/static.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Client - Static Usage
# Static Usage

laminas-http provides another client implementation, `Laminas\Http\ClientStatic`, a
static HTTP client which exposes a simplified API for quickly performing one-off `GET`
Expand Down
2 changes: 1 addition & 1 deletion docs/book/request.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Request Class
# Request

`Laminas\Http\Request` is responsible for providing a fluent API that allows a
developer to interact with all the various parts of an HTTP request.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/response.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Response Class
# Response

`Laminas\Http\Response` is responsible for providing a fluent API that allows a
developer to interact with all the various parts of an HTTP response.
Expand Down
19 changes: 9 additions & 10 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ site_dir: docs/html
nav:
- Home: index.md
- Introduction: intro.md
- Reference:
- Request: request.md
- Response: response.md
- Headers: headers.md
- Client:
- Intro: client/intro.md
- Adapters: client/adapters.md
- "Static Client": client/static.md
- "Cookie Persistence": client/cookies.md
- Advanced: client/advanced.md
- Request: request.md
- Response: response.md
- Headers: headers.md
- "HTTP Client":
- Introduction: client/intro.md
- "Connection Adapters": client/adapters.md
- "Static Usage": client/static.md
- "Client Cookies": client/cookies.md
- "Advanced Usage": client/advanced.md
site_name: laminas-http
site_description: HTTP message and header abstractions, and HTTP client implementation. (Not a PSR-7 implementation; see <a href="//docs.laminas.dev/laminas-diactoros">Diactoros</a> for PSR-7 support.
repo_url: 'https://github.com/laminas/laminas-http'
Expand Down
4 changes: 4 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
<file>src</file>
<file>test</file>
<exclude-pattern>*/_files/*</exclude-pattern>
<exclude-pattern>test/PhpEnvironment/Assets/*</exclude-pattern>

<!-- Include all rules from Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>

<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
<exclude-pattern>src/</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFallbackGlobalName">
<exclude-pattern>src/PhpEnvironment/Response.php</exclude-pattern>
</rule>
</ruleset>
24 changes: 18 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
failOnPhpunitDeprecation="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true">
<testsuites>
<testsuite name="laminas-http Test Suite">
<directory>./test/</directory>
Expand Down Expand Up @@ -39,4 +46,9 @@
<env name="TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY_USER" value=""/>
<env name="TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY_PASS" value=""/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
2 changes: 0 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ public function setRawBody($body)
/**
* Set the POST parameters
*
* @param array $post
* @return $this
*/
public function setParameterPost(array $post)
Expand All @@ -500,7 +499,6 @@ public function setParameterPost(array $post)
/**
* Set the GET parameters
*
* @param array $query
* @return $this
*/
public function setParameterGet(array $query)
Expand Down
1 change: 0 additions & 1 deletion src/Client/Adapter/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
* @param string $host
* @param int $port
* @param string $httpVer
* @param array $headers
* @throws AdapterException\RuntimeException
*/
protected function connectHandshake($host, $port = 443, $httpVer = '1.1', array &$headers = [])
Expand Down
1 change: 0 additions & 1 deletion src/Header/Accept.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function toString()
*
* @param string $type
* @param int|float $priority
* @param array $params
* @return $this
*/
public function addMediaType($type, $priority = 1, array $params = [])
Expand Down
2 changes: 1 addition & 1 deletion src/Header/ContentTransferEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use function strtolower;

/**
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 @todo find section
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 \@todo find section
*
* @throws Exception\InvalidArgumentException
*/
Expand Down
1 change: 0 additions & 1 deletion src/Header/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public function getMediaType()
/**
* Set additional content-type parameters
*
* @param array $parameters
* @return $this
*/
public function setParameters(array $parameters)
Expand Down
1 change: 0 additions & 1 deletion src/Header/SetCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ public function toString()
}

/**
* @param array $headers
* @return string
* @throws Exception\RuntimeException
*/
Expand Down
1 change: 0 additions & 1 deletion src/PhpEnvironment/RemoteAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function getUseProxy()
/**
* Set list of trusted proxy addresses
*
* @param array $trustedProxies
* @return $this
*/
public function setTrustedProxies(array $trustedProxies)
Expand Down
1 change: 0 additions & 1 deletion src/PhpEnvironment/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use function call_user_func;
use function header;
use function headers_sent;

/**
* HTTP Response for current PHP environment
Expand Down
15 changes: 6 additions & 9 deletions test/Client/Adapter/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Laminas\Http\Client\Adapter\Curl;
use Laminas\Uri\Uri;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

use function curl_getinfo;
Expand All @@ -16,8 +17,7 @@

final class CurlTest extends TestCase
{
/** @var Curl */
private $adapter;
private Curl $adapter;

protected function setUp(): void
{
Expand All @@ -28,7 +28,7 @@ protected function setUp(): void
/**
* @return iterable<non-empty-string,array{0:CURL_HTTP_VERSION_*,1:float}>
*/
public function floatHttpVersions(): iterable
public static function floatHttpVersions(): iterable
{
yield 'HTTP 1.0' => [CURL_HTTP_VERSION_1_0, 1.0];
yield 'HTTP 1.1' => [CURL_HTTP_VERSION_1_1, 1.1];
Expand All @@ -37,7 +37,7 @@ public function floatHttpVersions(): iterable
/**
* @return iterable<non-empty-string,array{0:CURL_HTTP_VERSION_*,1:float}>
*/
public function httpVersions(): iterable
public static function httpVersions(): iterable
{
yield 'HTTP 1.0' => [CURL_HTTP_VERSION_1_0, '1.0'];
yield 'HTTP 1.1' => [CURL_HTTP_VERSION_1_1, '1.1'];
Expand All @@ -46,9 +46,8 @@ public function httpVersions(): iterable
/**
* NOTE: This test is only needed for BC compatibility. The {@see \Laminas\Http\Client\Adapter\AdapterInterface}
* has a default for "string" but "float" was used in {@see Curl::write()} due to the lack of strict types.
*
* @dataProvider floatHttpVersions
*/
#[DataProvider('floatHttpVersions')]
public function testWriteCanHandleFloatHttpVersion(int $expectedCurlOption, float $version): void
{
$this->adapter->connect('example.org');
Expand All @@ -58,9 +57,7 @@ public function testWriteCanHandleFloatHttpVersion(int $expectedCurlOption, floa
self::assertEquals($expectedCurlOption, curl_getinfo($handle, CURLINFO_HTTP_VERSION));
}

/**
* @dataProvider httpVersions
*/
#[DataProvider('httpVersions')]
public function testWriteCanHandleStringHttpVersion(int $expectedCurlOption, string $version): void
{
$this->adapter->connect('example.org');
Expand Down
Loading
Loading