@@ -13,9 +13,10 @@ class KeywordEnhancer {
1313 '/\b(?<!`)[A-Z][A-Za-z]+::[a-z][A-Za-z_\d]+\b(?![`\/(])/ ' , // Class::constants
1414 '/\b(?<!`-)[a-z]+_[a-z]+(?:_[a-z_]+)?\(\)(?![`\/])/ ' , // Functions with underscores and ()
1515 '/\b(?<![`>])[a-z_][a-z][a-z\d_]+\(\)(?![`.>\/-])/ ' , // Functions with underscores and ()
16- '/\b(?<!`)(?:ldap|ftp|array|mb|stream|open|hash|xml)_[a-z_]+\d?\b(?![`\/])/ ' , // Functions with underscores and no ()
16+ '/\b(?<!`)(?:ldap|ftp|array|mb|stream|open|hash|xml|proc )_[a-z_]+\d?\b(?![`\/])/ ' , // Functions with underscores and no ()
1717 '/\b(?<!`)(xleak|xfail|skipif)\b(?![`\/])/i ' , // xleak
1818 '/(?<![`>()-])--[a-z][a-z-]+(?![`])/i ' , // --flags, --flags-and-more
19+ '/(?<![`>()-])\bext\/[a-z_\d\/-]+\.phpt\b(?![`])/i ' , // ext/test/test/test.phpt
1920 ];
2021
2122 public static function enhance (string $ inputText ): string {
@@ -44,14 +45,18 @@ private static function linkToBug(string $subject): string {
4445 }
4546
4647 private static function linkToGitHub (string $ subject , ?string $ shortHash = null ): string {
47- $ subject = preg_replace ('/\bGH-(\d{3,6})\b/ ' , "[GH-$1](https://github.com/php/php-src/issues/$1) " , $ subject );
48+ $ subject = preg_replace ('/\b(?<!\[)GH-(\d{3,6})\b/ ' , "[GH-$1](https://github.com/php/php-src/issues/$1) " , $ subject );
49+
50+ $ subject = preg_replace ('/\b(?<!\[)GH-(\d{3,6})\b/ ' , "[GH-$1](https://github.com/php/php-src/issues/$1) " , $ subject );
51+ $ subject = preg_replace ('/(?<![`>()\b\d\S\[-])#([1-3]\d\d\d\d)\b(?![`-])/ ' , "[GH-$1](https://github.com/php/php-src/issues/$1) " , $ subject );
52+
4853 $ subject = preg_replace (
49- '/\b(([a-fA-F\d]){8})([a-fA-F\d]){4,32}\b/ ' ,
54+ '/\b(?<!\[)( ([a-fA-F\d]){8})([a-fA-F\d]){4,32}\b/ ' ,
5055 "[$1](https://github.com/php/php-src/commit/$0) " ,
5156 $ subject
5257 );
5358
54- if (preg_match ('/\(#(\d{3,6})\)$/ ' , $ subject )) {
59+ if (preg_match ('/(?<!\[) \(#(\d{3,6})\)$/ ' , $ subject )) {
5560 return preg_replace ('/\(#(\d{3,6})\)$/ ' , "in [GH-$1](https://github.com/php/php-src/pull/$1) " , $ subject );
5661 }
5762
0 commit comments