@@ -313,22 +313,19 @@ private static function getPivotFieldStructure($field)
313313 /**
314314 * Checks the properties of the provided method to better verify if it could be a relation.
315315 * Case the method is not public, is not a relation.
316- * Case the return type is Attribute, or extends Attribute is not a relation method.
316+ * Case the return type is Attribute, or extends Attribute is not a relation method.
317317 * If the return type extends the Relation class is for sure a relation
318318 * Otherwise we just assume it's a relation.
319- *
319+ *
320320 * DEV NOTE: In future versions we will return `false` when no return type is set and make the return type mandatory for relationships.
321- * This function should be refactored to only check if $returnType is a subclass of Illuminate\Database\Eloquent\Relations\Relation.
322- *
321+ * This function should be refactored to only check if $returnType is a subclass of Illuminate\Database\Eloquent\Relations\Relation.
322+ *
323323 * @param $model
324324 * @param $method
325- *
326325 * @return bool|string
327- *
328326 */
329- private function checkMethodPropertiesForRelationship ($ model , $ method )
327+ private function checkMethodPropertiesForRelationship ($ model , $ method )
330328 {
331-
332329 $ methodReflection = new \ReflectionMethod ($ model , $ method );
333330
334331 // relationship methods function does not have parameters
@@ -337,22 +334,23 @@ private function checkMethodPropertiesForRelationship($model, $method)
337334 }
338335
339336 // relationships are always public methods.
340- if (!$ methodReflection ->isPublic ()) {
337+ if (! $ methodReflection ->isPublic ()) {
341338 return false ;
342339 }
343340
344341 $ returnType = $ methodReflection ->getReturnType ();
345342
346- if ($ returnType ){
343+ if ($ returnType ) {
347344 $ returnType = $ returnType ->getName ();
348- if (is_a ((new $ returnType ), 'Illuminate\Database\Eloquent\Casts\Attribute ' )) {
345+ if (is_a ((new $ returnType ), 'Illuminate\Database\Eloquent\Casts\Attribute ' )) {
349346 return false ;
350347 }
351348
352- if (is_a ((new $ returnType ), 'Illuminate\Database\Eloquent\Relations\Relation ' )) {
349+ if (is_a ((new $ returnType ), 'Illuminate\Database\Eloquent\Relations\Relation ' )) {
353350 return $ method ;
354351 }
355352 }
353+
356354 return $ method ;
357355 }
358356}
0 commit comments