@@ -133,7 +133,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
133
133
// If no relation name was given, we will use this debug backtrace to extract
134
134
// the calling method's name and use that as the relationship name as most
135
135
// of the time this will be what we desire to use for the relationships.
136
- if (is_null ( $ relation) ) {
136
+ if ($ relation === null ) {
137
137
list ($ current , $ caller ) = debug_backtrace (false , 2 );
138
138
139
139
$ relation = $ caller ['function ' ];
@@ -147,7 +147,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
147
147
// If no foreign key was supplied, we can use a backtrace to guess the proper
148
148
// foreign key name by using the name of the relationship function, which
149
149
// when combined with an "_id" should conventionally match the columns.
150
- if (is_null ( $ foreignKey) ) {
150
+ if ($ foreignKey === null ) {
151
151
$ foreignKey = Str::snake ($ relation ) . '_id ' ;
152
152
}
153
153
@@ -177,7 +177,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
177
177
// If no name is provided, we will use the backtrace to get the function name
178
178
// since that is most likely the name of the polymorphic interface. We can
179
179
// use that to get both the class and foreign key that will be utilized.
180
- if (is_null ( $ name) ) {
180
+ if ($ name === null ) {
181
181
list ($ current , $ caller ) = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
182
182
183
183
$ name = Str::snake ($ caller ['function ' ]);
@@ -188,7 +188,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
188
188
// If the type value is null it is probably safe to assume we're eager loading
189
189
// the relationship. When that is the case we will pass in a dummy query as
190
190
// there are multiple types in the morph and we can't use single queries.
191
- if (is_null ($ class = $ this ->$ type )) {
191
+ if (($ class = $ this ->$ type ) === null ) {
192
192
return new MorphTo (
193
193
$ this ->newQuery (), $ this , $ id , null , $ type , $ name
194
194
);
@@ -197,15 +197,13 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
197
197
// If we are not eager loading the relationship we will essentially treat this
198
198
// as a belongs-to style relationship since morph-to extends that class and
199
199
// we will pass in the appropriate values so that it behaves as expected.
200
- else {
201
- $ class = $ this ->getActualClassNameForMorph ($ class );
200
+ $ class = $ this ->getActualClassNameForMorph ($ class );
202
201
203
- $ instance = new $ class ;
202
+ $ instance = new $ class ;
204
203
205
- return new MorphTo (
206
- $ instance ->newQuery (), $ this , $ id , $ instance ->getKeyName (), $ type , $ name
207
- );
208
- }
204
+ return new MorphTo (
205
+ $ instance ->newQuery (), $ this , $ id , $ instance ->getKeyName (), $ type , $ name
206
+ );
209
207
}
210
208
211
209
/**
@@ -232,7 +230,7 @@ public function belongsToMany(
232
230
// If no relationship name was passed, we will pull backtraces to get the
233
231
// name of the calling function. We will use that function name as the
234
232
// title of this relation since that is a great convention to apply.
235
- if (is_null ( $ relation) ) {
233
+ if ($ relation === null ) {
236
234
$ relation = $ this ->guessBelongsToManyRelation ();
237
235
}
238
236
@@ -261,7 +259,7 @@ public function belongsToMany(
261
259
// If no table name was provided, we can guess it by concatenating the two
262
260
// models using underscores in alphabetical order. The two model names
263
261
// are transformed to snake case from their default CamelCase also.
264
- if (is_null ( $ collection) ) {
262
+ if ($ collection === null ) {
265
263
$ collection = $ instance ->getTable ();
266
264
}
267
265
@@ -303,8 +301,8 @@ public function newEloquentBuilder($query)
303
301
{
304
302
if (is_subclass_of ($ this , \Jenssegers \Mongodb \Eloquent \Model::class)) {
305
303
return new Builder ($ query );
306
- } else {
307
- return new EloquentBuilder ($ query );
308
304
}
305
+
306
+ return new EloquentBuilder ($ query );
309
307
}
310
308
}
0 commit comments