Skip to content

Commit 3133f41

Browse files
committed
Use PHPStan 2.0
1 parent 627ccd0 commit 3133f41

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"vlucas/phpdotenv": "^5.5",
2424
"phpunit/phpunit": "^5.7 || ^9.0",
2525
"squizlabs/php_codesniffer": "^3.3",
26-
"phpstan/phpstan": "^1.2"
26+
"phpstan/phpstan": "^2.0"
2727
},
2828
"autoload": {
2929
"psr-4": {

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ parameters:
66

77
# Should not need to edit anything below here
88
# Rule Level: https://phpstan.org/user-guide/rule-levels
9-
level: 8
9+
level: 9

src/ConvertKit_API.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function get_oauth_url(string $redirectURI)
177177
* @param string $authCode Authorization Code, returned from get_oauth_url() flow.
178178
* @param string $redirectURI Redirect URI.
179179
*
180-
* @return array<string, int|string> API response
180+
* @return mixed|array<string, int|string> API response
181181
*/
182182
public function get_access_token(string $authCode, string $redirectURI)
183183
{
@@ -215,7 +215,7 @@ public function get_access_token(string $authCode, string $redirectURI)
215215
* @param string $refreshToken Refresh Token.
216216
* @param string $redirectURI Redirect URI.
217217
*
218-
* @return array<string, int|string> API response
218+
* @return mixed|array<string, int|string> API response
219219
*/
220220
public function refresh_token(string $refreshToken, string $redirectURI)
221221
{
@@ -338,7 +338,7 @@ public function get_resource(string $url)
338338
*
339339
* @throws \Exception If JSON encoding arguments failed.
340340
*
341-
* @return false|mixed
341+
* @return mixed|object
342342
*/
343343
public function request(string $endpoint, string $method, array $args = [])
344344
{

src/ConvertKit_API_Traits.php

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function get_growth_stats(\DateTime $starting = null, \DateTime $ending =
161161
*
162162
* @see https://developers.convertkit.com/v4.html#convertkit-api-forms
163163
*
164-
* @return false|array<int,\stdClass>
164+
* @return mixed|array<int,\stdClass>
165165
*/
166166
public function get_forms(
167167
string $status = 'active',
@@ -198,7 +198,7 @@ public function get_forms(
198198
*
199199
* @see https://developers.convertkit.com/v4.html#convertkit-api-forms
200200
*
201-
* @return false|array<int,\stdClass>
201+
* @return mixed|array<int,\stdClass>
202202
*/
203203
public function get_landing_pages(
204204
string $status = 'active',
@@ -456,7 +456,7 @@ public function get_sequence_subscriptions(
456456
*
457457
* @see https://developers.convertkit.com/v4.html#list-tags
458458
*
459-
* @return false|array<int,\stdClass>
459+
* @return mixed|array<int,\stdClass>
460460
*/
461461
public function get_tags(
462462
bool $include_total_count = false,
@@ -863,6 +863,10 @@ public function get_subscriber_id(string $email_address)
863863
['email_address' => $email_address]
864864
);
865865

866+
if (!$subscribers instanceof \stdClass) {
867+
return false;
868+
}
869+
866870
if (!count($subscribers->subscribers)) {
867871
return false;
868872
}
@@ -878,7 +882,7 @@ public function get_subscriber_id(string $email_address)
878882
*
879883
* @see https://developers.convertkit.com/v4.html#get-a-subscriber
880884
*
881-
* @return false|integer
885+
* @return mixed|integer
882886
*/
883887
public function get_subscriber(int $subscriber_id)
884888
{
@@ -895,7 +899,7 @@ public function get_subscriber(int $subscriber_id)
895899
*
896900
* @see https://developers.convertkit.com/v4.html#update-a-subscriber
897901
*
898-
* @return false|mixed
902+
* @return mixed
899903
*/
900904
public function update_subscriber(
901905
int $subscriber_id,
@@ -930,7 +934,7 @@ public function update_subscriber(
930934
*
931935
* @see https://developers.convertkit.com/v4.html#unsubscribe-subscriber
932936
*
933-
* @return false|object
937+
* @return mixed|object
934938
*/
935939
public function unsubscribe_by_email(string $email_address)
936940
{
@@ -949,7 +953,7 @@ public function unsubscribe_by_email(string $email_address)
949953
*
950954
* @see https://developers.convertkit.com/v4.html#unsubscribe-subscriber
951955
*
952-
* @return false|object
956+
* @return mixed|object
953957
*/
954958
public function unsubscribe(int $subscriber_id)
955959
{
@@ -967,7 +971,7 @@ public function unsubscribe(int $subscriber_id)
967971
*
968972
* @see https://developers.convertkit.com/v4.html#list-tags-for-a-subscriber
969973
*
970-
* @return false|array<int,\stdClass>
974+
* @return mixed|array<int,\stdClass>
971975
*/
972976
public function get_subscriber_tags(
973977
int $subscriber_id,
@@ -1044,7 +1048,7 @@ public function get_broadcasts(
10441048
*
10451049
* @see https://developers.convertkit.com/v4.html#create-a-broadcast
10461050
*
1047-
* @return false|object
1051+
* @return mixed|object
10481052
*/
10491053
public function create_broadcast(
10501054
string $subject = '',
@@ -1103,7 +1107,7 @@ public function create_broadcast(
11031107
*
11041108
* @see https://developers.convertkit.com/v4.html#get-a-broadcast
11051109
*
1106-
* @return false|object
1110+
* @return mixed|object
11071111
*/
11081112
public function get_broadcast(int $id)
11091113
{
@@ -1118,7 +1122,7 @@ public function get_broadcast(int $id)
11181122
*
11191123
* @see https://developers.convertkit.com/v4.html#get-stats
11201124
*
1121-
* @return false|object
1125+
* @return mixed|object
11221126
*/
11231127
public function get_broadcast_stats(int $id)
11241128
{
@@ -1151,7 +1155,7 @@ public function get_broadcast_stats(int $id)
11511155
*
11521156
* @see https://developers.convertkit.com/#create-a-broadcast
11531157
*
1154-
* @return false|object
1158+
* @return mixed|object
11551159
*/
11561160
public function update_broadcast(
11571161
int $id,
@@ -1213,7 +1217,7 @@ public function update_broadcast(
12131217
*
12141218
* @see https://developers.convertkit.com/v4.html#delete-a-broadcast
12151219
*
1216-
* @return false|object
1220+
* @return mixed|object
12171221
*/
12181222
public function delete_broadcast(int $id)
12191223
{
@@ -1266,7 +1270,7 @@ public function get_webhooks(
12661270
*
12671271
* @throws \InvalidArgumentException If the event is not supported.
12681272
*
1269-
* @return false|object
1273+
* @return mixed|object
12701274
*/
12711275
public function create_webhook(string $url, string $event, string $parameter = '')
12721276
{
@@ -1340,7 +1344,7 @@ public function create_webhook(string $url, string $event, string $parameter = '
13401344
*
13411345
* @see https://developers.convertkit.com/v4.html#delete-a-webhook
13421346
*
1343-
* @return false|object
1347+
* @return mixed|object
13441348
*/
13451349
public function delete_webhook(int $id)
13461350
{
@@ -1389,7 +1393,7 @@ public function get_custom_fields(
13891393
*
13901394
* @see https://developers.convertkit.com/v4.html#create-a-custom-field
13911395
*
1392-
* @return false|object
1396+
* @return mixed|object
13931397
*/
13941398
public function create_custom_field(string $label)
13951399
{
@@ -1409,7 +1413,7 @@ public function create_custom_field(string $label)
14091413
*
14101414
* @see https://developers.convertkit.com/v4.html#bulk-create-custom-fields
14111415
*
1412-
* @return false|object
1416+
* @return mixed|object
14131417
*/
14141418
public function create_custom_fields(array $labels, string $callback_url = '')
14151419
{
@@ -1444,7 +1448,7 @@ public function create_custom_fields(array $labels, string $callback_url = '')
14441448
*
14451449
* @see https://developers.convertkit.com/v4.html#update-a-custom-field
14461450
*
1447-
* @return false|object
1451+
* @return mixed|object
14481452
*/
14491453
public function update_custom_field(int $id, string $label)
14501454
{
@@ -1463,7 +1467,7 @@ public function update_custom_field(int $id, string $label)
14631467
*
14641468
* @see https://developers.convertkit.com/#destroy-field
14651469
*
1466-
* @return false|object
1470+
* @return mixed|object
14671471
*/
14681472
public function delete_custom_field(int $id)
14691473
{
@@ -1510,7 +1514,7 @@ public function get_purchases(
15101514
*
15111515
* @see https://developers.convertkit.com/v4.html#get-a-purchase
15121516
*
1513-
* @return false|object
1517+
* @return mixed|object
15141518
*/
15151519
public function get_purchase(int $purchase_id)
15161520
{
@@ -1535,7 +1539,7 @@ public function get_purchase(int $purchase_id)
15351539
*
15361540
* @see https://developers.convertkit.com/v4.html#create-a-purchase
15371541
*
1538-
* @return false|object
1542+
* @return mixed|object
15391543
*/
15401544
public function create_purchase(
15411545
string $email_address,

0 commit comments

Comments
 (0)