@@ -42,7 +42,7 @@ discard block  | 
                                                    ||
| 42 | 42 | $fileName = $method->getFileName();  | 
                                                        
| 43 | 43 | |
| 44 | 44 | $file = new \SplFileObject($fileName);  | 
                                                        
| 45 | - $file->seek($method->getStartLine() - 1);  | 
                                                        |
| 45 | + $file->seek($method->getStartLine()-1);  | 
                                                        |
| 46 | 46 | $code = '';  | 
                                                        
| 47 | 47 |          while ($file->key() < $method->getEndLine()) { | 
                                                        
| 48 | 48 | $code .= $file->current();  | 
                                                        
@@ -55,8 +55,8 @@ discard block  | 
                                                    ||
| 55 | 55 | throw new InvalidOperationException($msg);  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 |          $begin = strpos($code, 'function('); | 
                                                        
| 58 | - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1);  | 
                                                        |
| 59 | - $lastCode = $code[strlen($code) - 1];  | 
                                                        |
| 58 | + $code = substr($code, $begin, strrpos($code, '}')-$begin+1);  | 
                                                        |
| 59 | + $lastCode = $code[strlen($code)-1];  | 
                                                        |
| 60 | 60 |          if ('}' != $lastCode) { | 
                                                        
| 61 | 61 | $msg = 'Final character of function definition must be closing brace';  | 
                                                        
| 62 | 62 | throw new InvalidOperationException($msg);  | 
                                                        
@@ -108,7 +108,7 @@ discard block  | 
                                                    ||
| 108 | 108 |                  ) { | 
                                                        
| 109 | 109 | continue;  | 
                                                        
| 110 | 110 | }  | 
                                                        
| 111 | - $relationships[]= $method;  | 
                                                        |
| 111 | + $relationships[] = $method;  | 
                                                        |
| 112 | 112 | }  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | return $relationships;  | 
                                                        
@@ -240,7 +240,7 @@ discard block  | 
                                                    ||
| 240 | 240 | private static function getKeyChain(Relation $relation, string $cacheKey) : array  | 
                                                        
| 241 | 241 |      { | 
                                                        
| 242 | 242 | $fields = self::$fieldOrderCache[$cacheKey];  | 
                                                        
| 243 | -        $getter =  function () use ($fields) { | 
                                                        |
| 243 | +        $getter = function () use ($fields) { | 
                                                        |
| 244 | 244 | $carry = [];  | 
                                                        
| 245 | 245 |              foreach ($fields as $item) { | 
                                                        
| 246 | 246 |                  $v = $this->{$item}; | 
                                                        
@@ -258,12 +258,12 @@ discard block  | 
                                                    ||
| 258 | 258 | |
| 259 | 259 | private static $fieldOrderCache = [  | 
                                                        
| 260 | 260 | 'BelongsTo' => ['foreignKey', 'ownerKey'],  | 
                                                        
| 261 | - 'BelongsToMany' => ['parentKey','foreignPivotKey','relatedPivotKey','relatedKey'],  | 
                                                        |
| 262 | - 'HasOneOrMany' => ['localKey', 'foreignKey' ],  | 
                                                        |
| 261 | + 'BelongsToMany' => ['parentKey', 'foreignPivotKey', 'relatedPivotKey', 'relatedKey'],  | 
                                                        |
| 262 | + 'HasOneOrMany' => ['localKey', 'foreignKey'],  | 
                                                        |
| 263 | 263 | 'HasManyThrough' => ['localKey', 'firstKey', 'secondLocalKey', 'secondKey'],  | 
                                                        
| 264 | - 'MorphToMany' => ['parentKey','foreignPivotKey','morphType', 'relatedPivotKey','relatedKey'],  | 
                                                        |
| 264 | + 'MorphToMany' => ['parentKey', 'foreignPivotKey', 'morphType', 'relatedPivotKey', 'relatedKey'],  | 
                                                        |
| 265 | 265 | 'MorphTo' => ['foreignKey', 'morphType', 'ownerKey'],  | 
                                                        
| 266 | - 'MorphOneOrMany' => ['foreignKey', 'morphType', 'localKey' ],  | 
                                                        |
| 266 | + 'MorphOneOrMany' => ['foreignKey', 'morphType', 'localKey'],  | 
                                                        |
| 267 | 267 | |
| 268 | 268 | ];  | 
                                                        
| 269 | 269 | }  | 
                                                        
@@ -22,13 +22,13 @@  | 
                                                    ||
| 22 | 22 | }  | 
                                                        
| 23 | 23 | $thisChain = $this->getThroughFieldChain();  | 
                                                        
| 24 | 24 | $otherChain = $otherStub->getThroughFieldChain();  | 
                                                        
| 25 | - $thisThroughCount = count($thisChain) - 1;  | 
                                                        |
| 26 | - $otherThroughCount = count($otherChain) - 1;  | 
                                                        |
| 25 | + $thisThroughCount = count($thisChain)-1;  | 
                                                        |
| 26 | + $otherThroughCount = count($otherChain)-1;  | 
                                                        |
| 27 | 27 |          if ($thisThroughCount !== $otherThroughCount) { | 
                                                        
| 28 | 28 | return false;  | 
                                                        
| 29 | 29 | }  | 
                                                        
| 30 | -        for($i=0; $i <= $thisThroughCount;++$i ){ | 
                                                        |
| 31 | -            if($thisChain[$i] !== $otherChain[$otherThroughCount -$i]){ | 
                                                        |
| 30 | +        for ($i = 0; $i <= $thisThroughCount; ++$i) { | 
                                                        |
| 31 | +            if ($thisChain[$i] !== $otherChain[$otherThroughCount-$i]) { | 
                                                        |
| 32 | 32 | return false;  | 
                                                        
| 33 | 33 | }  | 
                                                        
| 34 | 34 | }  | 
                                                        
@@ -27,8 +27,8 @@  | 
                                                    ||
| 27 | 27 |          if ($thisThroughCount !== $otherThroughCount) { | 
                                                        
| 28 | 28 | return false;  | 
                                                        
| 29 | 29 | }  | 
                                                        
| 30 | -        for($i=0; $i <= $thisThroughCount;++$i ){ | 
                                                        |
| 31 | -            if($thisChain[$i] !== $otherChain[$otherThroughCount -$i]){ | 
                                                        |
| 30 | +        for($i=0; $i <= $thisThroughCount;++$i ) { | 
                                                        |
| 31 | +            if($thisChain[$i] !== $otherChain[$otherThroughCount -$i]) { | 
                                                        |
| 32 | 32 | return false;  | 
                                                        
| 33 | 33 | }  | 
                                                        
| 34 | 34 | }  |