Skip to content

Commit 7d0de08

Browse files
committed
Ran composer fix
1 parent e35b7af commit 7d0de08

30 files changed

+188
-188
lines changed

src/VCR/CodeTransform/AbstractCodeTransform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function filter($in, $out, &$consumed, $closing)
4343
stream_bucket_append($out, $bucket);
4444
}
4545

46-
return PSFS_PASS_ON;
46+
return \PSFS_PASS_ON;
4747
}
4848

4949
/**

src/VCR/LibraryHooks/CurlHook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public static function curlMultiExec($multiHandle, ?int &$stillRunning): int
281281
}
282282
}
283283

284-
return CURLM_OK;
284+
return \CURLM_OK;
285285
}
286286

287287
/**
@@ -295,9 +295,9 @@ public static function curlMultiInfoRead()
295295
{
296296
if (!empty(self::$multiExecLastChs)) {
297297
$info = [
298-
'msg' => CURLMSG_DONE,
298+
'msg' => \CURLMSG_DONE,
299299
'handle' => array_pop(self::$multiExecLastChs),
300-
'result' => CURLE_OK,
300+
'result' => \CURLE_OK,
301301
];
302302

303303
return $info;

src/VCR/LibraryHooks/StreamWrapperHook.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public function enable(\Closure $requestCallback): void
4545
Assertion::isCallable($requestCallback, 'No valid callback for handling requests defined.');
4646
self::$requestCallback = $requestCallback;
4747
stream_wrapper_unregister('http');
48-
stream_wrapper_register('http', __CLASS__, STREAM_IS_URL);
48+
stream_wrapper_register('http', __CLASS__, \STREAM_IS_URL);
4949

5050
stream_wrapper_unregister('https');
51-
stream_wrapper_register('https', __CLASS__, STREAM_IS_URL);
51+
stream_wrapper_register('https', __CLASS__, \STREAM_IS_URL);
5252

5353
$this->status = self::ENABLED;
5454
}
@@ -197,21 +197,21 @@ public function url_stat(string $path, int $flags): array
197197
public function stream_seek(int $offset, int $whence): bool
198198
{
199199
switch ($whence) {
200-
case SEEK_SET:
200+
case \SEEK_SET:
201201
if ($offset < \strlen($this->response->getBody()) && $offset >= 0) {
202202
$this->position = $offset;
203203

204204
return true;
205205
}
206206
break;
207-
case SEEK_CUR:
207+
case \SEEK_CUR:
208208
if ($offset >= 0) {
209209
$this->position += $offset;
210210

211211
return true;
212212
}
213213
break;
214-
case SEEK_END:
214+
case \SEEK_END:
215215
if (\strlen($this->response->getBody()) + $offset >= 0) {
216216
$this->position = \strlen($this->response->getBody()) + $offset;
217217

src/VCR/Request.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ public function getBody(): ?string
142142

143143
public function getMethod(): string
144144
{
145-
if (null !== $this->getCurlOption(CURLOPT_CUSTOMREQUEST)) {
146-
return $this->getCurlOption(CURLOPT_CUSTOMREQUEST);
145+
if (null !== $this->getCurlOption(\CURLOPT_CUSTOMREQUEST)) {
146+
return $this->getCurlOption(\CURLOPT_CUSTOMREQUEST);
147147
}
148148

149149
return $this->method;
@@ -197,13 +197,13 @@ public function getHost(): string
197197
$url = $this->getUrl();
198198
Assertion::string($url);
199199

200-
$host = parse_url($url, PHP_URL_HOST);
200+
$host = parse_url($url, \PHP_URL_HOST);
201201

202202
if (null === $host || false === $host) {
203203
throw InvalidHostException::create($this->getUrl());
204204
}
205205

206-
if ($port = parse_url($url, PHP_URL_PORT)) {
206+
if ($port = parse_url($url, \PHP_URL_PORT)) {
207207
$host .= ':'.$port;
208208
}
209209

@@ -217,7 +217,7 @@ public function getPath(): ?string
217217
{
218218
$url = $this->getUrl();
219219
Assertion::string($url);
220-
$path = parse_url($url, PHP_URL_PATH);
220+
$path = parse_url($url, \PHP_URL_PATH);
221221
Assertion::notSame($path, false);
222222

223223
return $path;
@@ -227,7 +227,7 @@ public function getQuery(): ?string
227227
{
228228
$url = $this->getUrl();
229229
Assertion::string($url);
230-
$query = parse_url($url, PHP_URL_QUERY);
230+
$query = parse_url($url, \PHP_URL_QUERY);
231231
Assertion::notSame($query, false);
232232

233233
return $query;

src/VCR/Storage/Json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class Json extends AbstractStorage
1515
*/
1616
public function storeRecording(array $recording): void
1717
{
18-
fseek($this->handle, -1, SEEK_END);
18+
fseek($this->handle, -1, \SEEK_END);
1919
if (ftell($this->handle) > 2) {
2020
fwrite($this->handle, ',');
2121
}
2222
if (\defined('JSON_PRETTY_PRINT')) {
23-
$json = json_encode($recording, JSON_PRETTY_PRINT);
23+
$json = json_encode($recording, \JSON_PRETTY_PRINT);
2424
} else {
2525
$json = json_encode($recording);
2626
}

src/VCR/Storage/Yaml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($cassettePath, $cassetteName, Parser $parser = null,
4444
*/
4545
public function storeRecording(array $recording): void
4646
{
47-
fseek($this->handle, -1, SEEK_END);
47+
fseek($this->handle, -1, \SEEK_END);
4848
fwrite($this->handle, "\n".$this->yamlDumper->dump([$recording], 4));
4949
fflush($this->handle);
5050
}
@@ -79,7 +79,7 @@ private function readNextRecord(): string
7979
$isNewArrayStart = 0 === strpos($line, '-');
8080

8181
if ($isInRecord && $isNewArrayStart) {
82-
fseek($this->handle, -\strlen($line), SEEK_CUR);
82+
fseek($this->handle, -\strlen($line), \SEEK_CUR);
8383
break;
8484
}
8585

src/VCR/Util/CurlHelper.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ class CurlHelper
1515
*/
1616
private static $curlInfoList = [
1717
//"certinfo"?
18-
CURLINFO_HTTP_CODE => 'http_code',
19-
CURLINFO_EFFECTIVE_URL => 'url',
20-
CURLINFO_TOTAL_TIME => 'total_time',
21-
CURLINFO_NAMELOOKUP_TIME => 'namelookup_time',
22-
CURLINFO_CONNECT_TIME => 'connect_time',
23-
CURLINFO_PRETRANSFER_TIME => 'pretransfer_time',
24-
CURLINFO_STARTTRANSFER_TIME => 'starttransfer_time',
25-
CURLINFO_REDIRECT_COUNT => 'redirect_count',
26-
CURLINFO_REDIRECT_TIME => 'redirect_time',
27-
CURLINFO_SIZE_UPLOAD => 'size_upload',
28-
CURLINFO_SIZE_DOWNLOAD => 'size_download',
29-
CURLINFO_SPEED_DOWNLOAD => 'speed_download',
30-
CURLINFO_SPEED_UPLOAD => 'speed_upload',
31-
CURLINFO_HEADER_SIZE => 'header_size',
32-
CURLINFO_HEADER_OUT => 'request_header',
33-
CURLINFO_FILETIME => 'filetime',
34-
CURLINFO_REQUEST_SIZE => 'request_size',
35-
CURLINFO_SSL_VERIFYRESULT => 'ssl_verify_result',
36-
CURLINFO_CONTENT_LENGTH_DOWNLOAD => 'download_content_length',
37-
CURLINFO_CONTENT_LENGTH_UPLOAD => 'upload_content_length',
38-
CURLINFO_CONTENT_TYPE => 'content_type',
18+
\CURLINFO_HTTP_CODE => 'http_code',
19+
\CURLINFO_EFFECTIVE_URL => 'url',
20+
\CURLINFO_TOTAL_TIME => 'total_time',
21+
\CURLINFO_NAMELOOKUP_TIME => 'namelookup_time',
22+
\CURLINFO_CONNECT_TIME => 'connect_time',
23+
\CURLINFO_PRETRANSFER_TIME => 'pretransfer_time',
24+
\CURLINFO_STARTTRANSFER_TIME => 'starttransfer_time',
25+
\CURLINFO_REDIRECT_COUNT => 'redirect_count',
26+
\CURLINFO_REDIRECT_TIME => 'redirect_time',
27+
\CURLINFO_SIZE_UPLOAD => 'size_upload',
28+
\CURLINFO_SIZE_DOWNLOAD => 'size_download',
29+
\CURLINFO_SPEED_DOWNLOAD => 'speed_download',
30+
\CURLINFO_SPEED_UPLOAD => 'speed_upload',
31+
\CURLINFO_HEADER_SIZE => 'header_size',
32+
\CURLINFO_HEADER_OUT => 'request_header',
33+
\CURLINFO_FILETIME => 'filetime',
34+
\CURLINFO_REQUEST_SIZE => 'request_size',
35+
\CURLINFO_SSL_VERIFYRESULT => 'ssl_verify_result',
36+
\CURLINFO_CONTENT_LENGTH_DOWNLOAD => 'download_content_length',
37+
\CURLINFO_CONTENT_LENGTH_UPLOAD => 'upload_content_length',
38+
\CURLINFO_CONTENT_TYPE => 'content_type',
3939
];
4040

4141
/**
@@ -53,27 +53,27 @@ class CurlHelper
5353
public static function handleOutput(Response $response, array $curlOptions, $ch): ?string
5454
{
5555
// If there is a header function set, feed the http status and headers to it.
56-
if (isset($curlOptions[CURLOPT_HEADERFUNCTION])) {
56+
if (isset($curlOptions[\CURLOPT_HEADERFUNCTION])) {
5757
$headerList = [HttpUtil::formatAsStatusString($response)];
5858
$headerList = array_merge($headerList, HttpUtil::formatHeadersForCurl($response->getHeaders()));
5959
$headerList[] = '';
6060
foreach ($headerList as $header) {
61-
self::callFunction($curlOptions[CURLOPT_HEADERFUNCTION], $ch, $header);
61+
self::callFunction($curlOptions[\CURLOPT_HEADERFUNCTION], $ch, $header);
6262
}
6363
}
6464

6565
$body = $response->getBody();
6666

67-
if (!empty($curlOptions[CURLOPT_HEADER])) {
67+
if (!empty($curlOptions[\CURLOPT_HEADER])) {
6868
$body = HttpUtil::formatAsStatusWithHeadersString($response).$body;
6969
}
7070

71-
if (isset($curlOptions[CURLOPT_WRITEFUNCTION])) {
72-
self::callFunction($curlOptions[CURLOPT_WRITEFUNCTION], $ch, $body);
73-
} elseif (isset($curlOptions[CURLOPT_RETURNTRANSFER]) && true == $curlOptions[CURLOPT_RETURNTRANSFER]) {
71+
if (isset($curlOptions[\CURLOPT_WRITEFUNCTION])) {
72+
self::callFunction($curlOptions[\CURLOPT_WRITEFUNCTION], $ch, $body);
73+
} elseif (isset($curlOptions[\CURLOPT_RETURNTRANSFER]) && true == $curlOptions[\CURLOPT_RETURNTRANSFER]) {
7474
return $body;
75-
} elseif (isset($curlOptions[CURLOPT_FILE])) {
76-
$fp = $curlOptions[CURLOPT_FILE];
75+
} elseif (isset($curlOptions[\CURLOPT_FILE])) {
76+
$fp = $curlOptions[\CURLOPT_FILE];
7777
fwrite($fp, $body);
7878
fflush($fp);
7979
} else {
@@ -102,13 +102,13 @@ public static function getCurlOptionFromResponse(Response $response, int $option
102102
$info[$key] = $response->getCurlInfo($key);
103103
}
104104
break;
105-
case CURLINFO_HTTP_CODE:
105+
case \CURLINFO_HTTP_CODE:
106106
$info = (int) $response->getStatusCode();
107107
break;
108-
case CURLINFO_SIZE_DOWNLOAD:
108+
case \CURLINFO_SIZE_DOWNLOAD:
109109
$info = $response->getHeader('Content-Length');
110110
break;
111-
case CURLINFO_HEADER_SIZE:
111+
case \CURLINFO_HEADER_SIZE:
112112
$info = mb_strlen(HttpUtil::formatAsStatusWithHeadersString($response), 'ISO-8859-1');
113113
break;
114114
case CURLPROXY_HTTPS:
@@ -139,18 +139,18 @@ public static function getCurlOptionFromResponse(Response $response, int $option
139139
public static function setCurlOptionOnRequest(Request $request, int $option, $value, $curlHandle = null): void
140140
{
141141
switch ($option) {
142-
case CURLOPT_URL:
142+
case \CURLOPT_URL:
143143
$request->setUrl($value);
144144
break;
145-
case CURLOPT_CUSTOMREQUEST:
146-
$request->setCurlOption(CURLOPT_CUSTOMREQUEST, $value);
145+
case \CURLOPT_CUSTOMREQUEST:
146+
$request->setCurlOption(\CURLOPT_CUSTOMREQUEST, $value);
147147
break;
148-
case CURLOPT_POST:
148+
case \CURLOPT_POST:
149149
if (true == $value) {
150150
$request->setMethod('POST');
151151
}
152152
break;
153-
case CURLOPT_POSTFIELDS:
153+
case \CURLOPT_POSTFIELDS:
154154
// todo: check for file @
155155
if (\is_array($value)) {
156156
foreach ($value as $name => $fieldValue) {
@@ -167,7 +167,7 @@ public static function setCurlOptionOnRequest(Request $request, int $option, $va
167167
}
168168
$request->setMethod('POST');
169169
break;
170-
case CURLOPT_HTTPHEADER:
170+
case \CURLOPT_HTTPHEADER:
171171
foreach ($value as $header) {
172172
$headerParts = explode(': ', $header, 2);
173173
if (!isset($headerParts[1])) {
@@ -177,11 +177,11 @@ public static function setCurlOptionOnRequest(Request $request, int $option, $va
177177
$request->setHeader($headerParts[0], $headerParts[1]);
178178
}
179179
break;
180-
case CURLOPT_FILE:
181-
case CURLOPT_HEADER:
182-
case CURLOPT_WRITEFUNCTION:
183-
case CURLOPT_HEADERFUNCTION:
184-
case CURLOPT_UPLOAD:
180+
case \CURLOPT_FILE:
181+
case \CURLOPT_HEADER:
182+
case \CURLOPT_WRITEFUNCTION:
183+
case \CURLOPT_HEADERFUNCTION:
184+
case \CURLOPT_UPLOAD:
185185
// Ignore header, file and writer functions.
186186
// These options are stored and will be handled later in handleOutput().
187187
break;
@@ -200,7 +200,7 @@ public static function setCurlOptionOnRequest(Request $request, int $option, $va
200200
*/
201201
public static function validateCurlPOSTBody(Request $request, $curlHandle = null): void
202202
{
203-
$readFunction = $request->getCurlOption(CURLOPT_READFUNCTION);
203+
$readFunction = $request->getCurlOption(\CURLOPT_READFUNCTION);
204204
if (null === $readFunction) {
205205
return;
206206
}
@@ -211,7 +211,7 @@ public static function validateCurlPOSTBody(Request $request, $curlHandle = null
211211
return;
212212
}
213213

214-
$bodySize = $request->getCurlOption(CURLOPT_INFILESIZE);
214+
$bodySize = $request->getCurlOption(\CURLOPT_INFILESIZE);
215215
Assertion::notEmpty($bodySize, 'To set a CURLOPT_READFUNCTION, CURLOPT_INFILESIZE must be set.');
216216
$body = \call_user_func_array($readFunction, [$curlHandle, fopen('php://memory', 'r'), $bodySize]);
217217
$request->setBody($body);

src/VCR/Util/HttpClient.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ public function send(Request $request): Response
2525

2626
Assertion::isResource($ch, "Could not init curl with URL '{$request->getUrl()}'");
2727

28-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getMethod());
29-
curl_setopt($ch, CURLOPT_HTTPHEADER, HttpUtil::formatHeadersForCurl($request->getHeaders()));
28+
curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, $request->getMethod());
29+
curl_setopt($ch, \CURLOPT_HTTPHEADER, HttpUtil::formatHeadersForCurl($request->getHeaders()));
3030
if (null !== $request->getBody()) {
31-
curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getBody());
31+
curl_setopt($ch, \CURLOPT_POSTFIELDS, $request->getBody());
3232
}
3333

3434
curl_setopt_array($ch, $request->getCurlOptions());
3535

36-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
37-
curl_setopt($ch, CURLOPT_FAILONERROR, false);
38-
curl_setopt($ch, CURLOPT_HEADER, true);
36+
curl_setopt($ch, \CURLOPT_RETURNTRANSFER, true);
37+
curl_setopt($ch, \CURLOPT_FAILONERROR, false);
38+
curl_setopt($ch, \CURLOPT_HEADER, true);
3939

4040
/** @var string|false $result */
4141
$result = curl_exec($ch);

src/VCR/Util/StreamHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public static function createRequestFromStreamContext($context, string $path, Re
4545
}
4646

4747
if (isset($http['follow_location'])) {
48-
$request->setCurlOption(CURLOPT_FOLLOWLOCATION, (bool) $http['follow_location']);
48+
$request->setCurlOption(\CURLOPT_FOLLOWLOCATION, (bool) $http['follow_location']);
4949
}
5050

5151
if (isset($http['max_redirects'])) {
52-
$request->setCurlOption(CURLOPT_MAXREDIRS, $http['max_redirects']);
52+
$request->setCurlOption(\CURLOPT_MAXREDIRS, $http['max_redirects']);
5353
}
5454

5555
if (isset($http['timeout'])) {
56-
$request->setCurlOption(CURLOPT_TIMEOUT, $http['timeout']);
56+
$request->setCurlOption(\CURLOPT_TIMEOUT, $http['timeout']);
5757
}
5858

5959
// TODO: protocol_version

0 commit comments

Comments
 (0)