Issues (45)

src/Core/Situations.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Imanghafoori\HeyMan\Core;
4
5
final class Situations
6
{
7
    private static $aliases = [];
8
9
    private static $methods = [];
10
11 121
    public static function add($listenerClass, $situation, $methods)
12
    {
13 121
        foreach ($methods as $method) {
14 121
            self::$methods[$method] = [$listenerClass, $situation];
15
        }
16 121
    }
17
18 117
    public static function call($method, $args)
19
    {
20 117
        $method = self::$aliases[$method] ?? $method;
21 117
        $args = is_array($args[0] ?? null) ? $args[0] : $args;
22 117
        [$listenerClass, $situation] = self::$methods[$method];
23
24 117
        resolve('heyman.chains')->init(
0 ignored issues
show
The method init() does not exist on Illuminate\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

24
        resolve('heyman.chains')->/** @scrutinizer ignore-call */ init(

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...
25 117
            $listenerClass, ...resolve($situation)->normalize($method, $args)
0 ignored issues
show
The method normalize() does not exist on Illuminate\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

25
            $listenerClass, ...resolve($situation)->/** @scrutinizer ignore-call */ normalize($method, $args)

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...
26
        );
27
28 116
        return resolve(Condition::class);
29
    }
30
31 121
    public static function aliasMethod($currentName, $newName)
32
    {
33 121
        self::$aliases[$newName] = $currentName;
34 121
    }
35
}
36