@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | private static function getKeyChain(Relation $relation, string $cacheKey) : array |
229 | 229 | { |
230 | 230 | $fields = self::$fieldOrderCache[$cacheKey]; |
231 | - $getter = function () use ($fields) { |
|
231 | + $getter = function () use ($fields) { |
|
232 | 232 | $carry = []; |
233 | 233 | foreach ($fields as $item) { |
234 | 234 | $v = $this->{$item}; |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | |
247 | 247 | private static $fieldOrderCache = [ |
248 | 248 | 'BelongsTo' => ['ownerKey', 'foreignKey'], |
249 | - 'BelongsToMany' => ['parentKey','foreignPivotKey','relatedPivotKey','relatedKey'], |
|
250 | - 'HasOneOrMany' => ['localKey', 'foreignKey' ], |
|
249 | + 'BelongsToMany' => ['parentKey', 'foreignPivotKey', 'relatedPivotKey', 'relatedKey'], |
|
250 | + 'HasOneOrMany' => ['localKey', 'foreignKey'], |
|
251 | 251 | 'HasManyThrough' => ['localKey', 'firstKey', 'secondLocalKey', 'secondKey'], |
252 | 252 | |
253 | 253 | ]; |
@@ -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; |