Skip to content

Commit cb682bc

Browse files
committed
Merge pull request #122 from gonzalonunez/analyzer
Cleaned up some warnings from the static analyzer
2 parents ff2db4c + 1076658 commit cb682bc

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

Parse/Internal/Object/PFObjectPrivate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
#if PARSE_OSX_ONLY
8787
// Not available publicly, but available for testing
8888

89-
- (void)refresh;
90-
- (void)refresh:(NSError **)error;
89+
- (instancetype)refresh;
90+
- (instancetype)refresh:(NSError **)error;
9191
- (void)refreshInBackgroundWithBlock:(PFObjectResultBlock)block;
9292
- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector;
9393

Parse/PFObject.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
504504
505505
@deprecated Please use `-fetch` instead.
506506
*/
507-
- (void)refresh PARSE_DEPRECATED("Please use `-fetch` instead.");
507+
- (instancetype)refresh PARSE_DEPRECATED("Please use `-fetch` instead.");
508508

509509
/*!
510510
@abstract *Synchronously* refreshes the `PFObject` with the current data from the server and sets an error if it occurs.
@@ -513,7 +513,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
513513
514514
@deprecated Please use `-fetch:` instead.
515515
*/
516-
- (void)refresh:(NSError **)error PARSE_DEPRECATED("Please use `-fetch:` instead.");
516+
- (instancetype)refresh:(NSError **)error PARSE_DEPRECATED("Please use `-fetch:` instead.");
517517

518518
/*!
519519
@abstract *Asynchronously* refreshes the `PFObject` and executes the given callback block.
@@ -544,13 +544,13 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
544544
/*!
545545
@abstract *Synchronously* fetches the PFObject with the current data from the server.
546546
*/
547-
- (void)fetch;
547+
- (instancetype)fetch;
548548
/*!
549549
@abstract *Synchronously* fetches the PFObject with the current data from the server and sets an error if it occurs.
550550
551551
@param error Pointer to an `NSError` that will be set if necessary.
552552
*/
553-
- (void)fetch:(NSError **)error;
553+
- (instancetype)fetch:(NSError **)error;
554554

555555
/*!
556556
@abstract *Synchronously* fetches the `PFObject` data from the server if <isDataAvailable> is `NO`.
@@ -627,7 +627,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
627627
628628
@param objects The list of objects to fetch.
629629
*/
630-
+ (void)fetchAll:(PF_NULLABLE NSArray *)objects;
630+
+ (NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects;
631631

632632
/*!
633633
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -636,13 +636,13 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
636636
@param objects The list of objects to fetch.
637637
@param error Pointer to an `NSError` that will be set if necessary.
638638
*/
639-
+ (void)fetchAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
639+
+ (NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
640640

641641
/*!
642642
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server.
643643
@param objects The list of objects to fetch.
644644
*/
645-
+ (void)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects;
645+
+ (NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects;
646646

647647
/*!
648648
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -651,7 +651,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
651651
@param objects The list of objects to fetch.
652652
@param error Pointer to an `NSError` that will be set if necessary.
653653
*/
654-
+ (void)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
654+
+ (NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
655655

656656
/*!
657657
@abstract Fetches all of the `PFObject` objects with the current data from the server *asynchronously*.
@@ -731,7 +731,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
731731
@abstract *Synchronously* loads data from the local datastore into this object,
732732
if it has not been fetched from the server already.
733733
*/
734-
- (void)fetchFromLocalDatastore;
734+
- (instancetype)fetchFromLocalDatastore;
735735

736736
/*!
737737
@abstract *Synchronously* loads data from the local datastore into this object, if it has not been fetched
@@ -742,7 +742,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
742742
743743
@param error Pointer to an `NSError` that will be set if necessary.
744744
*/
745-
- (void)fetchFromLocalDatastore:(NSError **)error;
745+
- (instancetype)fetchFromLocalDatastore:(NSError **)error;
746746

747747
/*!
748748
@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
@@ -1110,6 +1110,7 @@ - (void)mergeFromRESTDictionary:(NSDictionary *)object withDecoder:(PFDecoder *)
11101110
[localOperationSet.updatedAt compare:remoteOperationSet.updatedAt] != NSOrderedAscending) {
11111111
[localOperationSet mergeOperationSet:remoteOperationSet];
11121112
} else {
1113+
PFConsistencyAssert(remoteOperationSet, @"'remoteOperationSet' should not be nil.");
11131114
NSUInteger index = [operationSetQueue indexOfObject:localOperationSet];
11141115
[remoteOperationSet mergeOperationSet:localOperationSet];
11151116
[operationSetQueue replaceObjectAtIndex:index withObject:remoteOperationSet];
@@ -2097,12 +2098,12 @@ - (BOOL)isDataAvailable {
20972098
return self._state.complete;
20982099
}
20992100

2100-
- (void)refresh {
2101-
[self fetch];
2101+
- (instancetype)refresh {
2102+
return [self fetch];
21022103
}
21032104

2104-
- (void)refresh:(NSError **)error {
2105-
[self fetch:error];
2105+
- (instancetype)refresh:(NSError **)error {
2106+
return [self fetch:error];
21062107
}
21072108

21082109
- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector {
@@ -2113,12 +2114,12 @@ - (void)refreshInBackgroundWithBlock:(PFObjectResultBlock)block {
21132114
[self fetchInBackgroundWithBlock:block];
21142115
}
21152116

2116-
- (void)fetch {
2117-
[self fetch:nil];
2117+
- (instancetype)fetch {
2118+
return [self fetch:nil];
21182119
}
21192120

2120-
- (void)fetch:(NSError **)error {
2121-
[[self fetchInBackground] waitForResult:error];
2121+
- (instancetype)fetch:(NSError **)error {
2122+
return [[self fetchInBackground] waitForResult:error];
21222123
}
21232124

21242125
- (BFTask *)fetchInBackground {
@@ -2171,20 +2172,20 @@ - (void)fetchIfNeededInBackgroundWithTarget:(id)target selector:(SEL)selector {
21712172
#pragma mark - Fetching Many Objects
21722173
///--------------------------------------
21732174

2174-
+ (void)fetchAll:(NSArray *)objects {
2175-
[PFObject fetchAll:objects error:nil];
2175+
+ (NSArray *)fetchAll:(NSArray *)objects {
2176+
return [PFObject fetchAll:objects error:nil];
21762177
}
21772178

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

2182-
+ (void)fetchAll:(NSArray *)objects error:(NSError **)error {
2183-
[[self fetchAllInBackground:objects] waitForResult:error];
2183+
+ (NSArray *)fetchAll:(NSArray *)objects error:(NSError **)error {
2184+
return [[self fetchAllInBackground:objects] waitForResult:error];
21842185
}
21852186

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

21902191
+ (BFTask *)fetchAllInBackground:(NSArray *)objects {
@@ -2245,12 +2246,12 @@ + (void)fetchAllIfNeededInBackground:(NSArray *)objects block:(PFArrayResultBloc
22452246
#pragma mark - Fetch From Local Datastore
22462247
///--------------------------------------
22472248

2248-
- (void)fetchFromLocalDatastore {
2249-
[self fetchFromLocalDatastore:nil];
2249+
- (instancetype)fetchFromLocalDatastore {
2250+
return [self fetchFromLocalDatastore:nil];
22502251
}
22512252

2252-
- (void)fetchFromLocalDatastore:(NSError **)error {
2253-
[[self fetchFromLocalDatastoreInBackground] waitForResult:error];
2253+
- (instancetype)fetchFromLocalDatastore:(NSError **)error {
2254+
return [[self fetchFromLocalDatastoreInBackground] waitForResult:error];
22542255
}
22552256

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

Parse/PFUser.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,11 @@ - (BFTask *)fetchAsync:(BFTask *)toAwait {
10981098
}];
10991099
}
11001100

1101-
- (void)fetch:(NSError **)error {
1101+
- (instancetype)fetch:(NSError **)error {
11021102
if (self.isLazy) {
1103-
return;
1103+
return self;
11041104
}
1105-
[super fetch:error];
1105+
return [super fetch:error];
11061106
}
11071107

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

0 commit comments

Comments
 (0)