Skip to content

Commit 3aced78

Browse files
authored
Fix a Phan issue and improve the uploads example script
1 parent c679cfa commit 3aced78

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.phan/baseline.php

-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
'src/GroupsPoolsApi.php' => ['PhanUnextractableAnnotation'],
1818
'src/InterestingnessApi.php' => ['PhanUnextractableAnnotation'],
1919
'src/MachinetagsApi.php' => ['PhanUnextractableAnnotation'],
20-
'src/Oauth/PhpFlickrService.php' => [
21-
'PhanUndeclaredClass', 'PhanUndeclaredClassMethod', 'PhanUndeclaredExtendedClass',
22-
'PhanUndeclaredMethod', 'PhanUndeclaredProperty', 'PhanUndeclaredTypeParameter',
23-
'PhanUnreferencedUseNormal'
24-
],
2520
'src/PandaApi.php' => ['PhanUnextractableAnnotation'],
2621
'src/PeopleApi.php' => ['PhanUnextractableAnnotation'],
2722
'src/PhotosApi.php' => ['PhanTypeMismatchDefault', 'PhanTypeMismatchForeach', 'PhanUnextractableAnnotation'],

examples/uploads.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,9 @@
3535
true,
3636
true
3737
);
38-
$info = $phpFlickr->photos()->getInfo($result['photoid']);
39-
echo "The new photo is: " . $info['urls']['url'][0]['_content'] . "\n";
38+
if ($result['stat'] === 'fail') {
39+
echo $result['message'] . "\n";
40+
} else {
41+
$info = $phpFlickr->photos()->getInfo($result['photoid']);
42+
echo "The new photo is: " . $info['urls']['url'][0]['_content'] . "\n";
43+
}

src/Oauth/PhpFlickrService.php

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use OAuth\Common\Storage\TokenStorageInterface;
1010
use OAuth\OAuth1\Service\Flickr;
1111
use OAuth\OAuth1\Signature\SignatureInterface;
12+
use OAuth\OAuth1\Token\TokenInterface;
1213

1314
class PhpFlickrService extends Flickr
1415
{
@@ -71,6 +72,7 @@ public function service()
7172
public function getAuthorizationForPostingToAlternateUrl($args, $uri)
7273
{
7374
$token = $this->storage->retrieveAccessToken($this->service());
75+
assert($token instanceof TokenInterface);
7476
$this->signature->setTokenSecret($token->getAccessTokenSecret());
7577
$authParameters = $this->getBasicAuthorizationHeaderInfo();
7678
if (isset($authParameters['oauth_callback'])) {

0 commit comments

Comments
 (0)