Fix various phpstan issues.

This commit is contained in:
James Cole
2023-12-02 07:05:34 +01:00
parent d2f0eab4c4
commit 8e0f0b03d8
11 changed files with 53 additions and 162 deletions

View File

@@ -131,8 +131,7 @@ class UserEventHandler
$group = null;
// create a new group.
while (true === $groupExists) {
/** @phpstan-ignore-line */
while (true === $groupExists) { // @phpstan-ignore-line
$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;
if (false === $groupExists) {
$group = UserGroup::create(['title' => $groupTitle]);
@@ -206,8 +205,7 @@ class UserEventHandler
if (false === $entry['notified']) {
try {
Notification::send($user, new UserLogin($ipAddress));
} catch (Exception $e) {
/** @phpstan-ignore-line */
} catch (Exception $e) {// @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -241,8 +239,7 @@ class UserEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new AdminRegistrationNotification($event->user));
} catch (Exception $e) {
/** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -319,8 +316,7 @@ class UserEventHandler
{
try {
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
} catch (Exception $e) {
/** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -368,8 +364,7 @@ class UserEventHandler
if ($sendMail) {
try {
Notification::send($event->user, new UserRegistrationNotification());
} catch (Exception $e) {
/** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');