Skip to content

Commit 262b341

Browse files
drbyteerikn69
andcommitted
phpstan fixes
Cherry-picked 0c5789d Co-authored-by: erikn69 <[email protected]>
1 parent 9d9be0a commit 262b341

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

src/PermissionServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ protected function registerBladeExtensions(BladeCompiler $bladeCompiler): void
144144

145145
protected function registerMacroHelpers(): void
146146
{
147-
// @phpstan-ignore-next-line
148-
if (! method_exists(Route::class, 'macro')) { // Lumen
147+
if (! method_exists(Route::class, 'macro')) { // @phpstan-ignore-line Lumen
149148
return;
150149
}
151150

src/Traits/HasPermissions.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ public function getAllPermissions(): Collection
348348
/** @var Collection $permissions */
349349
$permissions = $this->permissions;
350350

351-
// @phpstan-ignore-next-line
352-
if (method_exists($this, 'roles')) {
351+
if (!is_a($this, Permission::class)) {
353352
$permissions = $permissions->merge($this->getPermissionsViaRoles());
354353
}
355354

src/Traits/HasRoles.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ private function collectRoles(...$roles): array
127127
}
128128

129129
$role = $this->getStoredRole($role);
130-
// @phpstan-ignore-next-line
131-
if (! $role instanceof Role) {
132-
return $array;
133-
}
134130

135131
if (! in_array($role->getKey(), $array)) {
136132
$this->ensureModelSharesGuard($role);

tests/CommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function it_can_respond_to_about_command_with_default()
200200
app(\Spatie\Permission\PermissionRegistrar::class)->initializeCache();
201201

202202
Artisan::call('about');
203-
$output = Artisan::output();
203+
$output = str_replace("\r\n", "\n", Artisan::output());
204204

205205
$pattern = '/Spatie Permissions[ .\n]*Features Enabled[ .]*Default[ .\n]*Version/';
206206
if (method_exists($this, 'assertMatchesRegularExpression')) {
@@ -225,7 +225,7 @@ public function it_can_respond_to_about_command_with_teams()
225225
config()->set('permission.teams', true);
226226

227227
Artisan::call('about');
228-
$output = Artisan::output();
228+
$output = str_replace("\r\n", "\n", Artisan::output());
229229

230230
$pattern = '/Spatie Permissions[ .\n]*Features Enabled[ .]*Teams[ .\n]*Version/';
231231
if (method_exists($this, 'assertMatchesRegularExpression')) {

0 commit comments

Comments
 (0)