original_string: public static function detect($callable, $mask = -1)
      {
          $error = null;
          set_error_handler(function ($type, $message, $file, $line) use ($error) {
              $error = new ErrorException($message, 0, $type, $file, $line);
          }, $mask);
          $callable();
          restore_error_handler();
          return $error;
      }
code: public static function detect($callable, $mask = -1)
      {
          $error = null;
          set_error_handler(function ($type, $message, $file, $line) use ($error) {
              $error = new ErrorException($message, 0, $type, $file, $line);
          }, $mask);
          $callable();
          restore_error_handler();
          return $error;
      }
code_tokens: public static function detect ( $ callable , $ mask = - 1 ) { $ error = null ; set_error_handler ( function ( $ type , $ message , $ file , $ line ) use ( $ error ) { $ error = new ErrorException ( $ message , 0 , $ type , $ file , $ line ) ; } , $ mask ) ; $ callable ( ) ; restore_error_handler ( ) ; return $ error ; }
docstring: Detect one or more PHP error messages and return the last one.
  
  @param callable $callable
  Function to catch error in.
  @param int $mask
  Error type mask, e.g. `E_ERROR | E_WARNING` to detect
  errors or warnings. Default is -1 which catches everything.
  @return string|null Last error message or null if no error was triggered.
docstring_tokens: Detect one or more PHP error messages and return the last one .