@@ -36,9 +36,9 @@ class Thread extends Eloquent
3636 /**
3737 * Internal cache for creator.
3838 *
39- * @var null|Models::user()
39+ * @var null|Models::user()|\Illuminate\Database\Eloquent\Model
4040 */
41- protected $ creatorCache = null ;
41+ protected $ creatorCache ;
4242
4343 /**
4444 * {@inheritDoc}
@@ -99,11 +99,11 @@ public function users()
9999 /**
100100 * Returns the user object that created the thread.
101101 *
102- * @return Models::user()
102+ * @return null| Models::user()|\Illuminate\Database\Eloquent\Model
103103 */
104104 public function creator ()
105105 {
106- if (is_null ( $ this ->creatorCache ) ) {
106+ if ($ this ->creatorCache === null ) {
107107 $ firstMessage = $ this ->messages ()->withTrashed ()->oldest ()->first ();
108108 $ this ->creatorCache = $ firstMessage ? $ firstMessage ->user : Models::user ();
109109 }
@@ -136,12 +136,13 @@ public static function getBySubject($subject)
136136 /**
137137 * Returns an array of user ids that are associated with the thread.
138138 *
139- * @param null $userId
139+ * @param null|int $userId
140140 *
141141 * @return array
142142 */
143143 public function participantsUserIds ($ userId = null )
144144 {
145+ /** @var \Illuminate\Support\Collection $users */
145146 $ users = $ this ->participants ()->withTrashed ()->select ('user_id ' )->get ()->map (function ($ participant ) {
146147 return $ participant ->user_id ;
147148 });
@@ -351,11 +352,8 @@ public function participantsString($userId = null, $columns = ['name'])
351352 public function hasParticipant ($ userId )
352353 {
353354 $ participants = $ this ->participants ()->where ('user_id ' , '= ' , $ userId );
354- if ($ participants ->count () > 0 ) {
355- return true ;
356- }
357355
358- return false ;
356+ return $ participants -> count () > 0 ;
359357 }
360358
361359 /**
0 commit comments