Skip to content

Commit 6ea2ca3

Browse files
committed
fix larastan errors
1 parent 44537ae commit 6ea2ca3

File tree

7 files changed

+18
-23
lines changed

7 files changed

+18
-23
lines changed

phpstan.neon.dist

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ parameters:
55
level: 5
66
paths:
77
- src
8-
- config
9-
- database
108
tmpDir: build/phpstan
119
checkOctaneCompatibility: true
1210
checkModelProperties: true

src/Concerns/InteractsWithHttpRequests.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
use Exception;
88
use Illuminate\Support\Facades\Http;
99

10-
/**
11-
* @method static \Illuminate\Http\Client\Response get(string $path, array $data = [], bool $async = false, array $headers = [])
12-
* @method static \Illuminate\Http\Client\Response post(string $path, array $data = [], bool $async = false, array $headers = [])
13-
* @method static \Illuminate\Http\Client\Response put(string $path, array $data = [], bool $async = false, array $headers = [])
14-
* @method static \Illuminate\Http\Client\Response delete(string $path, array $data = [], bool $async = false, array $headers = [])
15-
* @method static \Illuminate\Http\Client\Response patch(string $path, array $data = [], bool $async = false, array $headers = [])
16-
*/
1710
trait InteractsWithHttpRequests
1811
{
1912
public function __call(string $function, array $args): mixed
@@ -65,7 +58,7 @@ protected function sendRequest(string $type, string $request, array $data = [],
6558
$client = Http::withHeaders(array_merge([
6659
'Content-Type' => 'application/json',
6760
'Accept' => 'application/json',
68-
], $headers ?? []));
61+
], $headers));
6962

7063
return $async
7164
? $client->async()->{$type}($url, $payload)

src/Facades/LaravelSendy.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
* @method static \Coderflex\LaravelSendy\Resources\Lists lists()
1212
* @method static \Coderflex\LaravelSendy\Resources\Brands brands()
1313
* @method static \Coderflex\LaravelSendy\Resources\Campaigns campaigns()
14+
* @method static \Illuminate\Http\Client\Response get(string $path, array $data = [], bool $async = false, array $headers = [])
15+
* @method static \Illuminate\Http\Client\Response post(string $path, array $data = [], bool $async = false, array $headers = [])
16+
* @method static \Illuminate\Http\Client\Response put(string $path, array $data = [], bool $async = false, array $headers = [])
17+
* @method static \Illuminate\Http\Client\Response delete(string $path, array $data = [], bool $async = false, array $headers = [])
18+
* @method static \Illuminate\Http\Client\Response patch(string $path, array $data = [], bool $async = false, array $headers = [])
1419
*/
1520
class LaravelSendy extends Facade
1621
{

src/Resources/Brands.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace Coderflex\LaravelSendy\Resources;
44

55
use Coderflex\LaravelSendy\Facades\LaravelSendy;
6+
use Illuminate\Http\Client\Response;
67

78
class Brands
89
{
9-
public function get()
10+
public function get(): Response
1011
{
1112
return LaravelSendy::post('/api/brands/get-brands.php');
1213
}

src/Resources/Campaigns.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Coderflex\LaravelSendy\DTOs\Campaigns\CampaignDTO;
66
use Coderflex\LaravelSendy\Facades\LaravelSendy;
7+
use Illuminate\Http\Client\Response;
78

89
class Campaigns
910
{
10-
public function create(array $data)
11+
public function create(array $data): Response
1112
{
1213
$data = CampaignDTO::validate($data);
1314

src/Resources/Lists.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44

55
use Coderflex\LaravelSendy\DTOs\Lists\ListsDTO;
66
use Coderflex\LaravelSendy\Facades\LaravelSendy;
7+
use Illuminate\Http\Client\Response;
78

89
class Lists
910
{
10-
/**
11-
* Get all lists for a specific brand.
12-
*
13-
* @return array
14-
*/
15-
public function get(array $data, bool $async = false)
11+
public function get(array $data, bool $async = false): Response
1612
{
1713
$data = ListsDTO::validate($data);
1814

src/Resources/Subscribers.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,39 @@
77
use Coderflex\LaravelSendy\DTOs\Subscribers\SubscriberStatusDTO;
88
use Coderflex\LaravelSendy\DTOs\Subscribers\UnsubscribeDTO;
99
use Coderflex\LaravelSendy\Facades\LaravelSendy;
10+
use Illuminate\Http\Client\Response;
1011

1112
class Subscribers
1213
{
13-
public function subscribe(array $data, bool $async = false)
14+
public function subscribe(array $data, bool $async = false): Response
1415
{
1516
$data = SubscribeDTO::validate($data);
1617

1718
return LaravelSendy::post('subscribe', $data, $async);
1819
}
1920

20-
public function unsubscribe(array $data, bool $async = false)
21+
public function unsubscribe(array $data, bool $async = false): Response
2122
{
2223
$data = UnsubscribeDTO::validate($data);
2324

2425
return LaravelSendy::post('api/subscribers/unsubscribe.php', $data, $async);
2526
}
2627

27-
public function delete(array $data, bool $async = false)
28+
public function delete(array $data, bool $async = false): Response
2829
{
2930
$data = DeleteSubscriberDTO::validate($data);
3031

3132
return LaravelSendy::post('api/subscribers/delete.php', $data, $async);
3233
}
3334

34-
public function status(array $data, bool $async = false)
35+
public function status(array $data, bool $async = false): Response
3536
{
3637
$data = SubscriberStatusDTO::validate($data);
3738

3839
return LaravelSendy::post('api/subscribers/subscription-status.php', $data, $async);
3940
}
4041

41-
public function count(int $listId, bool $async = false)
42+
public function count(int $listId, bool $async = false): Response
4243
{
4344
$data = [
4445
'list_id' => $listId,

0 commit comments

Comments
 (0)