@@ -133,7 +133,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
133133 // If no relation name was given, we will use this debug backtrace to extract
134134 // the calling method's name and use that as the relationship name as most
135135 // of the time this will be what we desire to use for the relationships.
136- if (is_null ( $ relation) ) {
136+ if ($ relation === null ) {
137137 list ($ current , $ caller ) = debug_backtrace (false , 2 );
138138
139139 $ relation = $ caller ['function ' ];
@@ -147,7 +147,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
147147 // If no foreign key was supplied, we can use a backtrace to guess the proper
148148 // foreign key name by using the name of the relationship function, which
149149 // when combined with an "_id" should conventionally match the columns.
150- if (is_null ( $ foreignKey) ) {
150+ if ($ foreignKey === null ) {
151151 $ foreignKey = Str::snake ($ relation ) . '_id ' ;
152152 }
153153
@@ -177,7 +177,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
177177 // If no name is provided, we will use the backtrace to get the function name
178178 // since that is most likely the name of the polymorphic interface. We can
179179 // use that to get both the class and foreign key that will be utilized.
180- if (is_null ( $ name) ) {
180+ if ($ name === null ) {
181181 list ($ current , $ caller ) = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
182182
183183 $ name = Str::snake ($ caller ['function ' ]);
@@ -188,7 +188,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
188188 // If the type value is null it is probably safe to assume we're eager loading
189189 // the relationship. When that is the case we will pass in a dummy query as
190190 // 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 ) {
192192 return new MorphTo (
193193 $ this ->newQuery (), $ this , $ id , null , $ type , $ name
194194 );
@@ -197,15 +197,13 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
197197 // If we are not eager loading the relationship we will essentially treat this
198198 // as a belongs-to style relationship since morph-to extends that class and
199199 // 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 );
202201
203- $ instance = new $ class ;
202+ $ instance = new $ class ;
204203
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+ );
209207 }
210208
211209 /**
@@ -232,7 +230,7 @@ public function belongsToMany(
232230 // If no relationship name was passed, we will pull backtraces to get the
233231 // name of the calling function. We will use that function name as the
234232 // title of this relation since that is a great convention to apply.
235- if (is_null ( $ relation) ) {
233+ if ($ relation === null ) {
236234 $ relation = $ this ->guessBelongsToManyRelation ();
237235 }
238236
@@ -261,7 +259,7 @@ public function belongsToMany(
261259 // If no table name was provided, we can guess it by concatenating the two
262260 // models using underscores in alphabetical order. The two model names
263261 // are transformed to snake case from their default CamelCase also.
264- if (is_null ( $ collection) ) {
262+ if ($ collection === null ) {
265263 $ collection = $ instance ->getTable ();
266264 }
267265
@@ -303,8 +301,8 @@ public function newEloquentBuilder($query)
303301 {
304302 if (is_subclass_of ($ this , \Jenssegers \Mongodb \Eloquent \Model::class)) {
305303 return new Builder ($ query );
306- } else {
307- return new EloquentBuilder ($ query );
308304 }
305+
306+ return new EloquentBuilder ($ query );
309307 }
310308}
0 commit comments