Phan\Issue::maybeEmitWithParameters PHP Method

maybeEmitWithParameters() public static method

public static maybeEmitWithParameters ( CodeBase $code_base, Context $context, string $issue_type, integer $lineno, array $parameters ) : void
$code_base CodeBase The code base within which we're operating
$context Phan\Language\Context The context in which the node we're going to be looking at exits.
$issue_type string The type of issue to emit such as Issue::ParentlessClass
$lineno integer The line number where the issue was found
$parameters array
return void
    public static function maybeEmitWithParameters(CodeBase $code_base, Context $context, string $issue_type, int $lineno, array $parameters)
    {
        // If this issue type has been suppressed in
        // the config, ignore it
        if (!Config::get()->disable_suppression && in_array($issue_type, Config::get()->suppress_issue_types ?? [])) {
            return;
        }
        // If a white-list of allowed issue types is defined,
        // only emit issues on the white-list
        if (!Config::get()->disable_suppression && count(Config::get()->whitelist_issue_types) > 0 && !in_array($issue_type, Config::get()->whitelist_issue_types ?? [])) {
            return;
        }
        if (!Config::get()->disable_suppression && $context->hasSuppressIssue($code_base, $issue_type)) {
            return;
        }
        Issue::emitWithParameters($issue_type, $context->getFile(), $lineno, $parameters);
    }

Same methods

Issue::maybeEmitWithParameters ( CodeBase $code_base, Context $context, string $issue_type, integer $lineno, array $parameters ) : void

Usage Example

示例#1
0
 /**
  * @param string $issue_type
  * The type of issue to emit such as Issue::ParentlessClass
  *
  * @param int $lineno
  * The line number where the issue was found
  *
  * @param mixed parameters
  * Template parameters for the issue's error message
  *
  * @return void
  */
 protected function emitIssue(string $issue_type, int $lineno, ...$parameters)
 {
     Issue::maybeEmitWithParameters($this->code_base, $this->context, $issue_type, $lineno, $parameters);
 }