bootRefreshesPermissionCache()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 4
Bugs 3 Features 0
Metric Value
cc 1
eloc 4
c 4
b 3
f 0
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Maklad\Permission\Traits;
4
5
use Maklad\Permission\PermissionRegistrar;
6
7
/**
8
 * Trait RefreshesPermissionCache
9
 * @package Maklad\Permission\Traits
10
 */
11
trait RefreshesPermissionCache
12
{
13
    public static function bootRefreshesPermissionCache()
14
    {
15 123
        static::saved(function () {
16 123
            \app(\config('permission.models.permission'))->forgetCachedPermissions();
0 ignored issues
show
Bug introduced by
The method forgetCachedPermissions() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
            \app(\config('permission.models.permission'))->/** @scrutinizer ignore-call */ forgetCachedPermissions();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
17 123
        });
18
19 123
        static::deleted(function () {
20 2
            \app(\config('permission.models.permission'))->forgetCachedPermissions();
21 123
        });
22 123
    }
23
}
24