Failed Conditions
Pull Request — master (#11)
by Adrien
15:48 queued 12:33
created

src/functions.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
use Doctrine\ORM\EntityManager;
6
use Ecodev\Felix\Debug;
7
use GraphQL\Doctrine\Types;
8
use Laminas\Log\LoggerInterface;
9
10
/**
11
 * Returns the type registry.
12
 */
13
function _types(): Types
14
{
15
    global $container;
16
17
    return $container->get(Types::class);
18
}
19
20
/**
21
 * Returns the Entity Manager.
22
 */
23
function _em(): EntityManager
24
{
25
    global $container;
26
27 7
    return $container->get(EntityManager::class);
28
}
29
30
/**
31
 * Returns logger.
32
 */
33
function _log(): LoggerInterface
34
{
35
    global $container;
36
37
    return $container->get(LoggerInterface::class);
38
}
39
40
/**
41
 * Export variables omitting array keys that are strictly numeric.
42
 *
43
 * By default will output result
44
 *
45
 * @param mixed $data
46
 *
47
 * @return string string representation of variable
48
 */
49
function ve($data, bool $return = false): string
50
{
51
    return Debug::export($data, $return);
52
}
53
54
/**
55
 * Dump all arguments.
56
 */
57
function v(): void
58
{
59
    var_dump(func_get_args());
60
}
61
62
/**
63
 * Dump all arguments and die.
64
 */
65
function w(): never
1 ignored issue
show
The type never was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
66
{
67
    $isHtml = (PHP_SAPI !== 'cli');
68
    echo "\n_________________________________________________________________________________________________________________________" . ($isHtml ? '</br>' : '') . "\n";
69
    var_dump(func_get_args());
70
    echo "\n" . ($isHtml ? '</br>' : '') . '_________________________________________________________________________________________________________________________' . ($isHtml ? '<pre>' : '') . "\n";
71
    debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
72
    echo '' . ($isHtml ? '</pre>' : '') . '_________________________________________________________________________________________________________________________' . ($isHtml ? '</br>' : '') . "\n";
73
    exit("script aborted on purpose.\n");
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return never. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
74
}
75