psysh.php ➔ psysh()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the PsyshBundle package.
5
 *
6
 * (c) Théo FIDRY <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace
13
{
14
    if (false === function_exists('psysh')) {
15
        function psysh(array $variables = [], $bind = null)
16
        {
17
            @trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
18
                'This method is deprecated since 3.2.0. Use Fidry\PsyshBundle\psysh instead.',
19
                E_USER_DEPRECATED
20
            );
21
            \Fidry\PsyshBundle\PsyshFacade::debug($variables, $bind);
22
        }
23
    }
24
}
25
26
namespace Fidry\PsyshBundle
27
{
28
    function psysh(array $variables = [], $bind = null)
0 ignored issues
show
Best Practice introduced by
The function Fidry\PsyshBundle\psysh() has been defined more than once; this definition is ignored, only the first definition in this file (L15-22) is considered.

This check looks for functions that have already been defined in the same file.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
29
    {
30
        \Fidry\PsyshBundle\PsyshFacade::debug($variables, $bind);
31
    }
32
}
33