Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added phpstan-baseline.neon
Empty file.
12 changes: 12 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
includes:
- phpstan-baseline.neon

parameters:
level: 4
paths:
- src
- config
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true

3 changes: 2 additions & 1 deletion src/Actions/InstagramHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static function connector(): InstagramConnector
if ($authenticator->hasExpired()) {
$authenticator = $connector->refreshAccessToken($authenticator);

Cache::store(config('instagram.cache_store'))->put('instagram.authenticator', $serialized, now()->addDays(60));
// @phpstan-ignore-next-line
Cache::store(config('instagram.cache_store'))->put('instagram.authenticator', $authenticator->serialize(), now()->addDays(60));
}

$connector->authenticate($authenticator);
Expand Down
2 changes: 1 addition & 1 deletion src/Data/InstagramUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
public string $username,
public string $name,
public string $account_type,
public string $profile_picture_url,
public ?string $profile_picture_url,
public int $followers_count,
public int $follows_count,
public int $media_count,
Expand Down
6 changes: 2 additions & 4 deletions src/Http/Controllers/InstagramController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function callback(Request $request)

$connector = new InstagramConnector;
$shortLivedAuthenticator = $connector->getShortLivedAccessToken(code: $request->get('code'));
$authenticator = $connector->getAccessToken(code: $shortLivedAuthenticator->accessToken);
$serialized = $authenticator->serialize();
$authenticator = $connector->getAccessToken(code: $shortLivedAuthenticator->accessToken); // @phpstan-ignore-line
$serialized = $authenticator->serialize(); // @phpstan-ignore-line

Cache::store(config('instagram.cache_store'))->put('instagram.authenticator', $serialized, now()->addDays(60));

Expand All @@ -50,8 +50,6 @@ public function callback(Request $request)

$json = $response->json();

ray($json);

Cache::store(config('instagram.cache_store'))->put('instagram.authenticated', $json, now()->addDays(60));

return response('Authenticated Instagram account: '.Arr::get($json, 'username'), 200);
Expand Down
4 changes: 1 addition & 3 deletions src/Requests/Authentication/GetAccessTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public function __construct(protected string $code, protected OAuthConfig $oauth
*
* @return array{
* grant_type: string,
* code: string,
* client_id: string,
* access_token: string,
* client_secret: string,
* redirect_uri: string,
* }
*/
public function defaultQuery(): array
Expand Down