Skip to content

Commit 146b576

Browse files
committed
Update PHPStan stubs
1 parent 59e7d72 commit 146b576

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

tests/phpstan/scan-files.php

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,119 @@
44
class Xdebug {
55
}
66
}
7+
8+
namespace {
9+
class Requests_Exception extends WpOrg\Requests\Exception {
10+
}
11+
12+
class Requests_Response extends WpOrg\Requests\Response {
13+
}
14+
}
15+
16+
namespace WpOrg\Requests {
17+
class Exception extends \Exception {
18+
/**
19+
* Type of exception
20+
*
21+
* @var string
22+
*/
23+
protected $type;
24+
25+
/**
26+
* Data associated with the exception
27+
*
28+
* @var mixed
29+
*/
30+
protected $data;
31+
32+
/**
33+
* Like {@see \Exception::getCode()}, but a string code.
34+
*
35+
* @return string
36+
*/
37+
public function getType() {
38+
return $this->type;
39+
}
40+
41+
/**
42+
* Gives any relevant data
43+
*
44+
* @return mixed
45+
*/
46+
public function getData() {
47+
return $this->data;
48+
}
49+
}
50+
51+
class Response {
52+
/**
53+
* Response body
54+
*
55+
* @var string
56+
*/
57+
public $body = '';
58+
59+
/**
60+
* Raw HTTP data from the transport
61+
*
62+
* @var string
63+
*/
64+
public $raw = '';
65+
66+
/**
67+
* Headers, as an associative array
68+
*
69+
* @var \WpOrg\Requests\Response\Headers Array-like object representing headers
70+
*/
71+
public $headers;
72+
73+
/**
74+
* Status code, false if non-blocking
75+
*
76+
* @var integer|boolean
77+
*/
78+
public $status_code = false;
79+
80+
/**
81+
* Protocol version, false if non-blocking
82+
*
83+
* @var float|boolean
84+
*/
85+
public $protocol_version = false;
86+
87+
/**
88+
* Whether the request succeeded or not
89+
*
90+
* @var boolean
91+
*/
92+
public $success = false;
93+
94+
/**
95+
* Number of redirects the request used
96+
*
97+
* @var integer
98+
*/
99+
public $redirects = 0;
100+
101+
/**
102+
* URL requested
103+
*
104+
* @var string
105+
*/
106+
public $url = '';
107+
108+
/**
109+
* Previous requests (from redirects)
110+
*
111+
* @var array<\WpOrg\Requests\Response> Array of \WpOrg\Requests\Response objects
112+
*/
113+
public $history = [];
114+
115+
/**
116+
* Cookies from the request
117+
*
118+
* @var array<string, mixed> Array-like object representing a cookie jar
119+
*/
120+
public $cookies = [];
121+
}
122+
}

0 commit comments

Comments
 (0)