Issues (2551)

src/Impl/AdhocQueryValidator.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Jabe\Impl;
4
5
use Jabe\BadUserRequestException;
6
use Jabe\Impl\Context\Context;
7
8
class AdhocQueryValidator implements ValidatorInterface
9
{
10
11
    private static $INSTANCE;
12
13
    public static function instance(): ValidatorInterface
14
    {
15
        if (self::$INSTANCE === null) {
16
            self::$INSTANCE = new AdhocQueryValidator();
17
        }
18
        return self::$INSTANCE;
19
    }
20
21
    public function validate($query)
22
    {
23
        if (
24
            !Context::getProcessEngineConfiguration()->isEnableExpressionsInAdhocQueries() &&
0 ignored issues
show
The method isEnableExpressionsInAdhocQueries() does not exist on Jabe\Impl\Cfg\ProcessEngineConfigurationImpl. ( Ignorable by Annotation )

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

24
            !Context::getProcessEngineConfiguration()->/** @scrutinizer ignore-call */ isEnableExpressionsInAdhocQueries() &&

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
            !empty($query->getExpressions())
26
        ) {
27
                throw new BadUserRequestException(
28
                    "Expressions are forbidden in adhoc queries. This behavior can be toggled"
29
                    . " in the process engine configuration"
30
                );
31
        }
32
    }
33
34
    public static function get(): ValidatorInterface
35
    {
36
        return self::instance();
37
    }
38
}
39