Skip to content

Commit 365d331

Browse files
committed
Revert bool strictness for graph objects
1 parent 9ab83ba commit 365d331

File tree

11 files changed

+50
-51
lines changed

11 files changed

+50
-51
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
- `GraphList`
3636
- `GraphObject`
3737
- `GraphObjectFactory`
38-
- Methods that return `bool|null` now always return `bool` and default to `false` instead.
3938
- `AccessTokenMetaData`:
4039
- Removed deprecated `getProperty()` function. Use `getField()`.
4140
- `getExpiresAt()` and `getIssuedAt()` now return `null` if the underlying data cannot be converted to a timestamp.

src/Facebook/Authentication/AccessTokenMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ public function getExpiresAt(): ?DateTime
187187
/**
188188
* Whether the access token is still valid or not.
189189
*/
190-
public function getIsValid(): bool
190+
public function getIsValid(): ?bool
191191
{
192-
return $this->getField('is_valid') ?? false;
192+
return $this->getField('is_valid');
193193
}
194194

195195
/**

src/Facebook/GraphNodes/GraphAlbum.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function getBackdatedTime(): ?DateTime
5252
return $this->getField('backdated_time');
5353
}
5454

55-
public function getCanUpload(): bool
55+
public function getCanUpload(): ?bool
5656
{
57-
return (bool)$this->getField('can_upload');
57+
return $this->getField('can_upload');
5858
}
5959

6060
public function getCount(): ?int

src/Facebook/GraphNodes/GraphApplication.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function getAppEventsConfig(): ?GraphApplicationEventsConfig
7272
return $this->getField('app_events_config');
7373
}
7474

75-
public function isAppInstallTracked(): bool
75+
public function isAppInstallTracked(): ?bool
7676
{
77-
return (bool)$this->getField('app_install_tracked');
77+
return $this->getField('app_install_tracked');
7878
}
7979

8080
public function getAppName(): ?string
@@ -107,9 +107,9 @@ public function getAuthReferralDefaultActivityPrivacy(): ?string
107107
return $this->getField('auth_referral_default_activity_privacy');
108108
}
109109

110-
public function isAuthReferralEnabled(): bool
110+
public function isAuthReferralEnabled(): ?bool
111111
{
112-
return (bool)$this->getField('auth_referral_enabled');
112+
return $this->getField('auth_referral_enabled');
113113
}
114114

115115
/**
@@ -141,9 +141,9 @@ public function getAuthReferralUserPermissions(): ?array
141141
return $this->getField('auth_referral_user_perms');
142142
}
143143

144-
public function isCanvasFluidHeight(): bool
144+
public function isCanvasFluidHeight(): ?bool
145145
{
146-
return (bool)$this->getField('canvas_fluid_height');
146+
return $this->getField('canvas_fluid_height');
147147
}
148148

149149
public function getCanvasFluidWidth(): ?int
@@ -171,9 +171,9 @@ public function getCompany(): ?string
171171
return $this->getField('company');
172172
}
173173

174-
public function isConfigurediOSSSO(): bool
174+
public function isConfigurediOSSSO(): ?bool
175175
{
176-
return (bool)$this->getField('configured_ios_sso');
176+
return $this->getField('configured_ios_sso');
177177
}
178178

179179
public function getContactEmail(): ?string
@@ -239,14 +239,14 @@ public function getiOSBundleIds(): ?array
239239
return $this->getField('ios_bundle_id');
240240
}
241241

242-
public function iOSSupportsNativeProxyAuthFlow(): bool
242+
public function iOSSupportsNativeProxyAuthFlow(): ?bool
243243
{
244-
return (bool)$this->getField('ios_supports_native_proxy_auth_flow');
244+
return $this->getField('ios_supports_native_proxy_auth_flow');
245245
}
246246

247-
public function iOSSupportsSystemAuth(): bool
247+
public function iOSSupportsSystemAuth(): ?bool
248248
{
249-
return (bool)$this->getField('ios_supports_system_auth');
249+
return $this->getField('ios_supports_system_auth');
250250
}
251251

252252
public function getiPadAppStoreId(): ?string
@@ -375,9 +375,9 @@ public function getServerIPWhitelist(): ?string
375375
return $this->getField('server_ip_whitelist');
376376
}
377377

378-
public function isSocialDiscovery(): bool
378+
public function isSocialDiscovery(): ?bool
379379
{
380-
return (bool)$this->getField('social_discovery');
380+
return $this->getField('social_discovery');
381381
}
382382

383383
public function getSubcategory(): ?string

src/Facebook/GraphNodes/GraphApplicationEventsConfig.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ public function getDefaultAteStatus(): ?int
1010
return $this->getField('default_ate_status');
1111
}
1212

13-
public function isAdvertiserIdCollectionEnabled(): bool
13+
public function isAdvertiserIdCollectionEnabled(): ?bool
1414
{
15-
return (bool)$this->getField('advertiser_id_collection_enabled');
15+
return $this->getField('advertiser_id_collection_enabled');
1616
}
1717

18-
public function isEventCollectionEnabled(): bool
18+
public function isEventCollectionEnabled(): ?bool
1919
{
20-
return (bool)$this->getField('event_collection_enabled');
20+
return $this->getField('event_collection_enabled');
2121
}
2222
}

src/Facebook/GraphNodes/GraphEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public function getEndTime(): ?DateTime
7878
/**
7979
* Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present.
8080
*/
81-
public function getIsDateOnly(): bool
81+
public function getIsDateOnly(): ?bool
8282
{
83-
return $this->getField('is_date_only') ?? false;
83+
return $this->getField('is_date_only');
8484
}
8585

8686
/**

src/Facebook/GraphNodes/GraphPhoto.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ public function getBackDatedTime(): ?DateTime
4343
return $this->getField('backdated_time');
4444
}
4545

46-
public function canBackDate(): bool
46+
public function canBackDate(): ?bool
4747
{
48-
return (bool)$this->getField('can_backdate');
48+
return $this->getField('can_backdate');
4949
}
5050

51-
public function canDelete(): bool
51+
public function canDelete(): ?bool
5252
{
53-
return (bool)$this->getField('can_delete');
53+
return $this->getField('can_delete');
5454
}
5555

56-
public function canTag(): bool
56+
public function canTag(): ?bool
5757
{
58-
return (bool)$this->getField('can_tag');
58+
return $this->getField('can_tag');
5959
}
6060

6161
public function getCreatedTime(): ?DateTime

src/Facebook/GraphNodes/GraphPicture.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class GraphPicture extends GraphNode
3333
/**
3434
* Returns true if user picture is silhouette.
3535
*/
36-
public function isSilhouette(): bool
36+
public function isSilhouette(): ?bool
3737
{
38-
return $this->getField('is_silhouette') ?? false;
38+
return $this->getField('is_silhouette');
3939
}
4040

4141
/**

src/Facebook/GraphNodes/GraphSessionInfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public function getExpiresAt(): ?DateTime
5959
/**
6060
* Returns whether the token is valid.
6161
*/
62-
public function getIsValid(): bool
62+
public function getIsValid(): ?bool
6363
{
64-
return $this->getField('is_valid') ?? false;
64+
return $this->getField('is_valid');
6565
}
6666

6767
/**

src/Facebook/GraphNodes/GraphUser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ public function getPicture(): ?GraphPicture
191191
return $this->getField('picture');
192192
}
193193

194-
public function supportsDonateButtonInLiveVideos(): bool
194+
public function supportsDonateButtonInLiveVideos(): ?bool
195195
{
196-
return (bool)$this->getField('supports_donate_button_in_live_video');
196+
return $this->getField('supports_donate_button_in_live_video');
197197
}
198198

199199
public function getAgeRange(): ?GraphAgeRange
200200
{
201201
return $this->getField('age_range');
202202
}
203203

204-
public function isInstalled(): bool
204+
public function isInstalled(): ?bool
205205
{
206-
return (bool)$this->getField('installed');
206+
return $this->getField('installed');
207207
}
208208

209209
/**

0 commit comments

Comments
 (0)