Skip to content

Commit 11c6ff8

Browse files
committed
Cleaned up some warnings from the static analyzer
1 parent 8d38b5f commit 11c6ff8

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

Parse/PFObject.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
491491
492492
@deprecated Please use `-fetch` instead.
493493
*/
494-
- (void)refresh PARSE_DEPRECATED("Please use `-fetch` instead.");
494+
- (instancetype)refresh PARSE_DEPRECATED("Please use `-fetch` instead.");
495495

496496
/*!
497497
@abstract *Synchronously* refreshes the `PFObject` with the current data from the server and sets an error if it occurs.
@@ -500,7 +500,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
500500
501501
@deprecated Please use `-fetch:` instead.
502502
*/
503-
- (void)refresh:(NSError **)error PARSE_DEPRECATED("Please use `-fetch:` instead.");
503+
- (instancetype)refresh:(NSError **)error PARSE_DEPRECATED("Please use `-fetch:` instead.");
504504

505505
/*!
506506
@abstract *Asynchronously* refreshes the `PFObject` and executes the given callback block.
@@ -531,13 +531,13 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
531531
/*!
532532
@abstract *Synchronously* fetches the PFObject with the current data from the server.
533533
*/
534-
- (void)fetch;
534+
- (instancetype)fetch;
535535
/*!
536536
@abstract *Synchronously* fetches the PFObject with the current data from the server and sets an error if it occurs.
537537
538538
@param error Pointer to an `NSError` that will be set if necessary.
539539
*/
540-
- (void)fetch:(NSError **)error;
540+
- (instancetype)fetch:(NSError **)error;
541541

542542
/*!
543543
@abstract *Synchronously* fetches the `PFObject` data from the server if <isDataAvailable> is `NO`.
@@ -614,7 +614,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
614614
615615
@param objects The list of objects to fetch.
616616
*/
617-
+ (void)fetchAll:(PF_NULLABLE NSArray *)objects;
617+
+ (NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects;
618618

619619
/*!
620620
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -623,13 +623,13 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
623623
@param objects The list of objects to fetch.
624624
@param error Pointer to an `NSError` that will be set if necessary.
625625
*/
626-
+ (void)fetchAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
626+
+ (NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
627627

628628
/*!
629629
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server.
630630
@param objects The list of objects to fetch.
631631
*/
632-
+ (void)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects;
632+
+ (NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects;
633633

634634
/*!
635635
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -638,7 +638,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
638638
@param objects The list of objects to fetch.
639639
@param error Pointer to an `NSError` that will be set if necessary.
640640
*/
641-
+ (void)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
641+
+ (NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
642642

643643
/*!
644644
@abstract Fetches all of the `PFObject` objects with the current data from the server *asynchronously*.
@@ -718,7 +718,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
718718
@abstract *Synchronously* loads data from the local datastore into this object,
719719
if it has not been fetched from the server already.
720720
*/
721-
- (void)fetchFromLocalDatastore;
721+
- (instancetype)fetchFromLocalDatastore;
722722

723723
/*!
724724
@abstract *Synchronously* loads data from the local datastore into this object, if it has not been fetched
@@ -729,7 +729,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
729729
730730
@param error Pointer to an `NSError` that will be set if necessary.
731731
*/
732-
- (void)fetchFromLocalDatastore:(NSError **)error;
732+
- (instancetype)fetchFromLocalDatastore:(NSError **)error;
733733

734734
/*!
735735
@abstract *Asynchronously* loads data from the local datastore into this object,

Parse/PFObject.m

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,7 @@ - (void)mergeFromRESTDictionary:(NSDictionary *)object withDecoder:(PFDecoder *)
11111111
[localOperationSet.updatedAt compare:remoteOperationSet.updatedAt] != NSOrderedAscending) {
11121112
[localOperationSet mergeOperationSet:remoteOperationSet];
11131113
} else {
1114+
PFConsistencyAssert(remoteOperationSet, @"'remoteOperationSet' should not be nil.");
11141115
NSUInteger index = [operationSetQueue indexOfObject:localOperationSet];
11151116
[remoteOperationSet mergeOperationSet:localOperationSet];
11161117
[operationSetQueue replaceObjectAtIndex:index withObject:remoteOperationSet];
@@ -2102,12 +2103,12 @@ - (BOOL)isDataAvailable {
21022103
return self._state.complete;
21032104
}
21042105

2105-
- (void)refresh {
2106-
[self fetch];
2106+
- (instancetype)refresh {
2107+
return [self fetch];
21072108
}
21082109

2109-
- (void)refresh:(NSError **)error {
2110-
[self fetch:error];
2110+
- (instancetype)refresh:(NSError **)error {
2111+
return [self fetch:error];
21112112
}
21122113

21132114
- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector {
@@ -2118,12 +2119,12 @@ - (void)refreshInBackgroundWithBlock:(PFObjectResultBlock)block {
21182119
[self fetchInBackgroundWithBlock:block];
21192120
}
21202121

2121-
- (void)fetch {
2122-
[self fetch:nil];
2122+
- (instancetype)fetch {
2123+
return [self fetch:nil];
21232124
}
21242125

2125-
- (void)fetch:(NSError **)error {
2126-
[[self fetchInBackground] waitForResult:error];
2126+
- (instancetype)fetch:(NSError **)error {
2127+
return [[self fetchInBackground] waitForResult:error];
21272128
}
21282129

21292130
- (BFTask *)fetchInBackground {
@@ -2175,20 +2176,20 @@ - (void)fetchIfNeededInBackgroundWithTarget:(id)target selector:(SEL)selector {
21752176
#pragma mark - Fetching Many Objects
21762177
///--------------------------------------
21772178

2178-
+ (void)fetchAll:(NSArray *)objects {
2179-
[PFObject fetchAll:objects error:nil];
2179+
+ (NSArray *)fetchAll:(NSArray *)objects {
2180+
return [PFObject fetchAll:objects error:nil];
21802181
}
21812182

2182-
+ (void)fetchAllIfNeeded:(NSArray *)objects {
2183-
[PFObject fetchAllIfNeeded:objects error:nil];
2183+
+ (NSArray *)fetchAllIfNeeded:(NSArray *)objects {
2184+
return [PFObject fetchAllIfNeeded:objects error:nil];
21842185
}
21852186

2186-
+ (void)fetchAll:(NSArray *)objects error:(NSError **)error {
2187-
[[self fetchAllInBackground:objects] waitForResult:error];
2187+
+ (NSArray *)fetchAll:(NSArray *)objects error:(NSError **)error {
2188+
return [[self fetchAllInBackground:objects] waitForResult:error];
21882189
}
21892190

2190-
+ (void)fetchAllIfNeeded:(NSArray *)objects error:(NSError **)error {
2191-
[[self fetchAllIfNeededInBackground:objects] waitForResult:error];
2191+
+ (NSArray *)fetchAllIfNeeded:(NSArray *)objects error:(NSError **)error {
2192+
return [[self fetchAllIfNeededInBackground:objects] waitForResult:error];
21922193
}
21932194

21942195
+ (BFTask *)fetchAllInBackground:(NSArray *)objects {
@@ -2249,12 +2250,12 @@ + (void)fetchAllIfNeededInBackground:(NSArray *)objects block:(PFArrayResultBloc
22492250
#pragma mark - Fetch From Local Datastore
22502251
///--------------------------------------
22512252

2252-
- (void)fetchFromLocalDatastore {
2253-
[self fetchFromLocalDatastore:nil];
2253+
- (instancetype)fetchFromLocalDatastore {
2254+
return [self fetchFromLocalDatastore:nil];
22542255
}
22552256

2256-
- (void)fetchFromLocalDatastore:(NSError **)error {
2257-
[[self fetchFromLocalDatastoreInBackground] waitForResult:error];
2257+
- (instancetype)fetchFromLocalDatastore:(NSError **)error {
2258+
return [[self fetchFromLocalDatastoreInBackground] waitForResult:error];
22582259
}
22592260

22602261
- (void)fetchFromLocalDatastoreInBackgroundWithBlock:(PFObjectResultBlock)block {

Parse/PFUser.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,11 +1113,11 @@ - (BFTask *)fetchAsync:(BFTask *)toAwait {
11131113
}];
11141114
}
11151115

1116-
- (void)fetch:(NSError **)error {
1116+
- (instancetype)fetch:(NSError **)error {
11171117
if (self.isLazy) {
1118-
return;
1118+
return nil;
11191119
}
1120-
[super fetch:error];
1120+
return [super fetch:error];
11211121
}
11221122

11231123
- (void)fetchInBackgroundWithBlock:(PFObjectResultBlock)block {

0 commit comments

Comments
 (0)