getText(), $docblock->getStartFilePos(), ); foreach ($parsed_docblock->tags as $special_key => $_) { if (strpos($special_key, 'psalm-') === 0) { $special_key = substr($special_key, 6); if (!in_array( $special_key, self::PSALM_ANNOTATIONS, true, )) { throw new DocblockParseException('Unrecognised annotation @psalm-' . $special_key); } } } return $parsed_docblock; } /** * @psalm-pure * @return array */ public static function parseSuppressList(string $suppress_entry): array { preg_match( '/ (?(DEFINE) # either a single issue or comma separated list of issues (? (?&issue) \s* , \s* (?&issue_list) | (?&issue) ) # definition of a single issue (? [A-Za-z0-9_-]+ ) ) ^ (?P (?&issue_list) ) (?P .* ) $ /xm', $suppress_entry, $matches, ); if (!isset($matches['issues'])) { return []; } $issue_offset = 0; $ret = []; foreach (explode(',', $matches['issues']) as $suppressed_issue) { $issue_offset += strspn($suppressed_issue, "\t\n\f\r "); $ret[$issue_offset] = trim($suppressed_issue); $issue_offset += strlen($suppressed_issue) + 1; } return $ret; } }