Skip to content

Commit

Permalink
Merge pull request #29 from globalis-ms/develop
Browse files Browse the repository at this point in the history
Fix type on time and memory usage functions
  • Loading branch information
pierre-dargham authored Dec 6, 2018
2 parents 051a63f + 504b121 commit 80bb543
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ Collection of wp-cubi functions for WordPress
- `mysql_enable_nocache_mod()`
- `mysql_disable_nocache_mod()`
- `query_set_nocache(string $query) : string`
- `time_start(string $timer = 'default') : int`
- `time_start(string $timer = 'default') : float`
- `time_elapsed(string $timer = 'default', bool $human = true)`
- `memory_get_usage_kb(bool $human = true, bool $real_usage = false)`
- `memory_get_usage_mb(bool $human = true, bool $real_usage = false)`
- `memory_get_peak_usage_kb(bool $human = true, bool $real_usage = false)`
- `memory_get_peak_usage_mb(bool $human = true, bool $real_usage = false)`
- `memory_usage_format(int $usage, string $unit, bool $human)`
- `memory_usage_format(float $usage, string $unit, bool $human)`

### Filters

Expand Down
18 changes: 9 additions & 9 deletions src/functions-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function query_set_nocache(string $query) : string
*
* @param string $timer The name of the timer.
*
* @return int The time.
* @return float The time.
*/
function time_start(string $timer = 'default') : float
{
Expand All @@ -58,7 +58,7 @@ function time_start(string $timer = 'default') : float
* @param string $timer The name of the timer.
* @param bool $human Return in a human readable format.
*
* @return string|int The time.
* @return string|float The time.
*/
function time_elapsed(string $timer = 'default', bool $human = true)
{
Expand All @@ -77,7 +77,7 @@ function time_elapsed(string $timer = 'default', bool $human = true)
* @param bool $human Return in a human readable format.
* @param bool $real_usage Native parameter of memory_get_usage().
*
* @return string|int The memory usage.
* @return string|float The memory usage.
*/
function memory_get_usage_kb(bool $human = true, bool $real_usage = false)
{
Expand All @@ -90,7 +90,7 @@ function memory_get_usage_kb(bool $human = true, bool $real_usage = false)
* @param bool $human Return in a human readable format.
* @param bool $real_usage Native parameter of memory_get_usage().
*
* @return string|int The memory usage.
* @return string|float The memory usage.
*/
function memory_get_usage_mb(bool $human = true, bool $real_usage = false)
{
Expand All @@ -103,7 +103,7 @@ function memory_get_usage_mb(bool $human = true, bool $real_usage = false)
* @param bool $human Return in a human readable format.
* @param bool $real_usage Native parameter of memory_get_peak_usage().
*
* @return string|int The memory usage.
* @return string|float The memory usage.
*/
function memory_get_peak_usage_kb(bool $human = true, bool $real_usage = false)
{
Expand All @@ -116,7 +116,7 @@ function memory_get_peak_usage_kb(bool $human = true, bool $real_usage = false)
* @param bool $human Return in a human readable format.
* @param bool $real_usage Native parameter of memory_get_peak_usage().
*
* @return string|int The memory usage.
* @return string|float The memory usage.
*/
function memory_get_peak_usage_mb(bool $human = true, bool $real_usage = false)
{
Expand All @@ -127,13 +127,13 @@ function memory_get_peak_usage_mb(bool $human = true, bool $real_usage = false)
/**
* Format the memory usage
*
* @param int $usage The memory usage.
* @param float $usage The memory usage.
* @param string $unit The memory unit.
* @param bool $human Return in a human readable format.
*
* @return string|int The formatted memory usage.
* @return string|float The formatted memory usage.
*/
function memory_usage_format(int $usage, string $unit, bool $human)
function memory_usage_format(float $usage, string $unit, bool $human)
{
if ($human) {
return sprintf('%s %s', number_format($usage, 2), $unit);
Expand Down

0 comments on commit 80bb543

Please sign in to comment.