@@ -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 | ]; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $fileName = $method->getFileName(); |
72 | 72 | |
73 | 73 | $file = new \SplFileObject($fileName); |
74 | - $file->seek($method->getStartLine() - 1); |
|
74 | + $file->seek($method->getStartLine()-1); |
|
75 | 75 | $code = ''; |
76 | 76 | while ($file->key() < $method->getEndLine()) { |
77 | 77 | $code .= $file->current(); |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | throw new InvalidOperationException($msg); |
85 | 85 | } |
86 | 86 | $begin = strpos($code, 'function('); |
87 | - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1); |
|
88 | - $lastCode = $code[strlen($code) - 1]; |
|
87 | + $code = substr($code, $begin, strrpos($code, '}')-$begin+1); |
|
88 | + $lastCode = $code[strlen($code)-1]; |
|
89 | 89 | if ('}' != $lastCode) { |
90 | 90 | $msg = 'Final character of function definition must be closing brace'; |
91 | 91 | throw new InvalidOperationException($msg); |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | ) { |
138 | 138 | continue; |
139 | 139 | } |
140 | - if (in_array($relation, ['morphedByMany','morphTo'])) { |
|
140 | + if (in_array($relation, ['morphedByMany', 'morphTo'])) { |
|
141 | 141 | $this->hasUnknownPolymorphic = true; |
142 | - } elseif (in_array($relation, ['morphOne','morphMany','morphToMany'])) { |
|
142 | + } elseif (in_array($relation, ['morphOne', 'morphMany', 'morphToMany'])) { |
|
143 | 143 | $this->hasKnownPolymorphic = true; |
144 | 144 | } |
145 | - $relationships[]= $method; |
|
145 | + $relationships[] = $method; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | return $relationships; |