Phan\Language\Context::hasSuppressIssue PHP Method

hasSuppressIssue() public method

public hasSuppressIssue ( CodeBase $code_base, string $issue_name ) : boolean
$code_base Phan\CodeBase The code base from which to retrieve a possible TypedElement that contains an issue suppression list
$issue_name string
return boolean True if issues with the given name are suppressed within this context.
    public function hasSuppressIssue(CodeBase $code_base, string $issue_name) : bool
    {
        if (!$this->isInElementScope()) {
            return false;
        }
        $has_suppress_issue = $this->getElementInScope($code_base)->hasSuppressIssue($issue_name);
        // Increment the suppression use count
        if ($has_suppress_issue) {
            ++$this->getElementInScope($code_base)->getSuppressIssueList()[$issue_name];
        }
        return $has_suppress_issue;
    }

Usage Example

Example #1
0
 /**
  * @param CodeBase $code_base
  * The code base within which we're operating
  *
  * @param Context $context
  * The context in which the node we're going to be looking
  * at exits.
  *
  * @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 array parameters
  * Template parameters for the issue's error message
  *
  * @return void
  */
 public static function maybeEmitWithParameters(CodeBase $code_base, Context $context, string $issue_type, int $lineno, array $parameters)
 {
     if ($context->hasSuppressIssue($code_base, $issue_type)) {
         return;
     }
     Issue::emitWithParameters($issue_type, $context->getFile(), $lineno, $parameters);
 }
All Usage Examples Of Phan\Language\Context::hasSuppressIssue