Skip to content

Commit 08cc164

Browse files
committed
PhpStan ignore in HasPermissions trait
Discovered some PhpStan findings which appear to be environment-dependent, AND invisible to the current CI runner on GitHub, but reproducible on at least one real local dev setup (Mac + Herd + PHP 8.4.6). Adding isolated inline @PHPStan-Ignore so local and CI static-analysis results stay consistent for all contributors.
1 parent 9acc273 commit 08cc164

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Traits/HasPermissions.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ public function hasDirectPermission($permission): bool
326326
*/
327327
public function getPermissionsViaRoles(): Collection
328328
{
329+
// This trait is shared by both Role and Permission models; Larastan analyses it once per
330+
// consuming class, pinning $this to that one class, so it reports the check for the other
331+
// class as dead code even though both checks are needed at runtime.
332+
// The phpstan finding appears to be environment-dependent, invisible to the current CI runner
333+
// but reproducible on at least one real local dev setup (Mac + Herd + PHP 8.4.6).
334+
// Ignoring here so local and CI static-analysis results stay consistent for all contributors.
335+
// @phpstan-ignore instanceof.alwaysFalse
329336
if ($this instanceof Role || $this instanceof Permission) {
330337
return collect();
331338
}

0 commit comments

Comments
 (0)