Skip to content

Commit

Permalink
Kicks PHP minimum up to 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Mar 15, 2022
1 parent 3b2a3eb commit 31a8283
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -5,7 +5,7 @@
"keywords": ["debugging", "drop"],
"license": "MIT",
"require": {
"php": ">=5.3.0"
"php": ">=7.1"
},
"authors": [
{
Expand Down
17 changes: 6 additions & 11 deletions drop.php
Expand Up @@ -10,34 +10,29 @@
* This is particularly helpful for looking into arrays and objects to see what information lies
* within. This function will also kill the script after echoing the information. This function
* takes any number of any typed arguments and displays them all.
*
* @return void
*/
function drop() {

function drop(...$args) : void {
if( __is_cli() === true ) {
echo "\033[2J\n";
}

call_user_func_array('see', func_get_args());
see(...$args);
die();
}

/**
* A handy function to expose any number of any typed arguments while NOT killing the script
* after output.
*
* @return void
*/
function see() {
echo call_user_func_array('output_format_args', func_get_args());
function see(...$args) : void {
echo output_format_args(...$args);
}

/**
* A handy function to expose any number of any typed arguments while NOT killing the script
* after output. Unlike drop(), this function must be "echoed".
*/
function output_format_args() {
function output_format_args() : string {
$final = "";
$arguments = func_get_args();
if( !empty($arguments) ) {
Expand All @@ -56,7 +51,7 @@ function output_format_args() {
return "";
}

function __is_cli() {
function __is_cli() : bool {
if( defined('IS_CLI') ) {
return IS_CLI;
}
Expand Down

0 comments on commit 31a8283

Please sign in to comment.