Skip to content

Commit eb21dc6

Browse files
authored
Merge pull request php-vcr#407 from php-vcr/406-fix-pipeline-phpstan-phpcsfixer
Fix pipeline (phpstan & phpcsfixer)
2 parents dd3a797 + 00d9e45 commit eb21dc6

File tree

14 files changed

+26
-21
lines changed

14 files changed

+26
-21
lines changed

phpstan-baseline.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ parameters:
4545
count: 5
4646
path: tests/Unit/CassetteTest.php
4747

48+
-
49+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertCount\\(\\) with arguments 22, array\\{url\\: string, content_type\\: string\\|null, http_code\\: int, header_size\\: int, request_size\\: int, filetime\\: int, ssl_verify_result\\: int, redirect_count\\: int, \\.\\.\\.\\} and 'curl_getinfo\\(\\)…' will always evaluate to false\\.$#"
50+
count: 1
51+
path: tests/Unit/LibraryHooks/CurlHookTest.php
52+
4853
-
4954
message: "#^Parameter \\#2 \\$requestMatchers of method VCR\\\\Request\\:\\:matches\\(\\) expects array\\<callable\\(\\)\\: mixed\\>, array\\{array\\{'some', 'method'\\}\\} given\\.$#"
5055
count: 1

src/VCR/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Configuration
2323
*
2424
* A value of null means all hooks are enabled.
2525
*
26-
* @see \VCR\LibraryHooks\LibraryHook
26+
* @see LibraryHooks\LibraryHook
2727
*
2828
* @var string[]|null list of enabled LibraryHook names
2929
*/

src/VCR/LibraryHooks/CurlHook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static function __callStatic($method, array $args)
126126
/**
127127
* @see http://www.php.net/manual/en/function.curl-init.php
128128
*/
129-
public static function curlInit(string $url = null): \CurlHandle|false
129+
public static function curlInit(?string $url = null): \CurlHandle|false
130130
{
131131
$curlHandle = curl_init($url);
132132
if (false !== $curlHandle) {

src/VCR/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Response
3232
* @param array<string,string> $headers
3333
* @param array<string,mixed> $curlInfo
3434
*/
35-
final public function __construct($status, array $headers = [], string $body = null, array $curlInfo = [])
35+
final public function __construct($status, array $headers = [], ?string $body = null, array $curlInfo = [])
3636
{
3737
$this->setStatus($status);
3838
$this->headers = $headers;
@@ -110,7 +110,7 @@ public function getBody(): string
110110
/**
111111
* @return array<string,mixed>|mixed|null
112112
*/
113-
public function getCurlInfo(string $option = null): mixed
113+
public function getCurlInfo(?string $option = null): mixed
114114
{
115115
if (empty($option)) {
116116
return $this->curlInfo;

src/VCR/Storage/Yaml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Yaml extends AbstractStorage
1919

2020
protected Dumper $yamlDumper;
2121

22-
public function __construct(string $cassettePath, string $cassetteName, Parser $parser = null, Dumper $dumper = null)
22+
public function __construct(string $cassettePath, string $cassetteName, ?Parser $parser = null, ?Dumper $dumper = null)
2323
{
2424
parent::__construct($cassettePath, $cassetteName, '');
2525

src/VCR/Util/Assertion.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class Assertion extends BaseAssertion
2020
* @param string $message exception message to show if value is not a callable
2121
* @param null $propertyPath
2222
*
23-
* @throws \VCR\VCRException if specified value is not a callable
23+
* @throws VCRException if specified value is not a callable
2424
*/
25-
public static function isCallable($value, $message = null, string $propertyPath = null): bool
25+
public static function isCallable($value, $message = null, ?string $propertyPath = null): bool
2626
{
2727
if (!\is_callable($value)) {
2828
throw new VCRException($message, self::INVALID_CALLABLE, $propertyPath);

src/VCR/Util/CurlHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static function setCurlOptionOnRequest(Request $request, int $option, $va
186186
* Makes sure we've properly handled the POST body, such as ensuring that
187187
* CURLOPT_INFILESIZE is set if CURLOPT_READFUNCTION is set.
188188
*/
189-
public static function validateCurlPOSTBody(Request $request, \CurlHandle $curlHandle = null): void
189+
public static function validateCurlPOSTBody(Request $request, ?\CurlHandle $curlHandle = null): void
190190
{
191191
$readFunction = $request->getCurlOption(\CURLOPT_READFUNCTION);
192192
if (null === $readFunction) {

src/VCR/Util/StreamHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class StreamHelper
1919
*
2020
* @param resource $context stream context resource
2121
*/
22-
public static function createRequestFromStreamContext($context, string $path, Request $existing = null): Request
22+
public static function createRequestFromStreamContext($context, string $path, ?Request $existing = null): Request
2323
{
2424
$http = self::getHttpOptionsFromContext($context);
2525
$request = $existing;

src/VCR/Util/StreamProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class StreamProcessor
5151

5252
protected bool $isIntercepting = false;
5353

54-
public function __construct(Configuration $configuration = null)
54+
public function __construct(?Configuration $configuration = null)
5555
{
5656
if ($configuration) {
5757
static::$configuration = $configuration;

src/VCR/VCRFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class VCRFactory
2121

2222
protected static ?self $instance = null;
2323

24-
protected function __construct(Configuration $config = null)
24+
protected function __construct(?Configuration $config = null)
2525
{
2626
$this->config = $config ?: $this->getOrCreate('VCR\Configuration');
2727
}
@@ -59,21 +59,21 @@ protected function createStorage(string $cassetteName): Storage
5959

6060
protected function createVCRLibraryHooksSoapHook(): SoapHook
6161
{
62-
return new LibraryHooks\SoapHook(
62+
return new SoapHook(
6363
$this->getOrCreate('VCR\CodeTransform\SoapCodeTransform'),
6464
$this->getOrCreate('VCR\Util\StreamProcessor')
6565
);
6666
}
6767

6868
protected function createVCRLibraryHooksCurlHook(): CurlHook
6969
{
70-
return new LibraryHooks\CurlHook(
70+
return new CurlHook(
7171
$this->getOrCreate('VCR\CodeTransform\CurlCodeTransform'),
7272
$this->getOrCreate('VCR\Util\StreamProcessor')
7373
);
7474
}
7575

76-
public static function getInstance(Configuration $config = null): self
76+
public static function getInstance(?Configuration $config = null): self
7777
{
7878
if (!self::$instance) {
7979
self::$instance = new self($config);

0 commit comments

Comments
 (0)