Created
October 16, 2015 10:45
-
-
Save 4lun/b402a85ba2f84ce8c966 to your computer and use it in GitHub Desktop.
Laravel helper log_deprecated_method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Writes to the log that a deprecated method was called, and where it was called from. | |
*/ | |
function log_deprecated_method() | |
{ | |
list($x, $current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); | |
$currentMethod = (isset($current['class']) ? $current['class'].'::' : '').$current['function'].'()'; | |
$callerMethod = (isset($caller['class']) ? $caller['class'].'::' : '').$caller['function'].'()'; | |
\Log::notice('Use of deprecated method: '.$currentMethod.', called via: '.$callerMethod); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment