blitz-php /
framework
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * This file is part of Blitz PHP framework. |
||||
| 5 | * |
||||
| 6 | * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]> |
||||
| 7 | * |
||||
| 8 | * For the full copyright and license information, please view |
||||
| 9 | * the LICENSE file that was distributed with this source code. |
||||
| 10 | */ |
||||
| 11 | |||||
| 12 | use Kint\Kint; |
||||
| 13 | |||||
| 14 | // Ce helper est automatiquement chargé par BlitzPHP. |
||||
| 15 | |||||
| 16 | if (! function_exists('dd')) { |
||||
| 17 | /** |
||||
| 18 | * Imprime un rapport de débogage Kint et coupe le script. |
||||
| 19 | * |
||||
| 20 | * @param array ...$vars |
||||
| 21 | * |
||||
| 22 | * @codeCoverageIgnore Ne peut pas etre tester ... presence de "exit" |
||||
| 23 | */ |
||||
| 24 | function dd(...$vars): void |
||||
| 25 | { |
||||
| 26 | if (class_exists(Kint::class)) { |
||||
| 27 | Kint::$aliases[] = 'dd'; |
||||
| 28 | Kint::dump(...$vars); |
||||
| 29 | } |
||||
| 30 | |||||
| 31 | exit; |
||||
|
0 ignored issues
–
show
|
|||||
| 32 | } |
||||
| 33 | } |
||||
| 34 | |||||
| 35 | if (! function_exists('dump')) { |
||||
| 36 | /** |
||||
| 37 | * Imprime un rapport de débogage Kint sans couper le script. |
||||
| 38 | * |
||||
| 39 | * @param array ...$vars |
||||
| 40 | * |
||||
| 41 | * @codeCoverageIgnore Ne peut pas etre tester |
||||
| 42 | */ |
||||
| 43 | function dump(...$vars): void |
||||
| 44 | { |
||||
| 45 | if (class_exists(Kint::class)) { |
||||
| 46 | Kint::$aliases[] = 'dump'; |
||||
| 47 | Kint::dump(...$vars); |
||||
| 48 | } |
||||
| 49 | } |
||||
| 50 | } |
||||
| 51 | |||||
| 52 | if (! function_exists('d') && ! class_exists(Kint::class)) { |
||||
| 53 | // Au cas où Kint n'est pas chargé |
||||
| 54 | /** |
||||
| 55 | * @param array $vars |
||||
| 56 | */ |
||||
| 57 | function d(...$vars): int |
||||
|
0 ignored issues
–
show
The parameter
$vars is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 58 | { |
||||
| 59 | return 0; |
||||
| 60 | } |
||||
| 61 | } |
||||
| 62 | |||||
| 63 | if (! function_exists('trace')) { |
||||
| 64 | /** |
||||
| 65 | * Fournit un backtrace au point d'exécution actuel, à partir de Kint. |
||||
| 66 | * |
||||
| 67 | * @return int|string |
||||
| 68 | * |
||||
| 69 | * @codeCoverageIgnore Ne peut pas etre tester |
||||
| 70 | */ |
||||
| 71 | function trace() |
||||
| 72 | { |
||||
| 73 | if (! class_exists(Kint::class)) { |
||||
| 74 | return 0; |
||||
| 75 | } |
||||
| 76 | |||||
| 77 | Kint::$aliases[] = 'trace'; |
||||
| 78 | |||||
| 79 | return Kint::trace(); |
||||
| 80 | } |
||||
| 81 | } |
||||
| 82 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.