File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 77use League \CommonMark \Parser \Inline \InlineParserInterface ;
88use League \CommonMark \Parser \Inline \InlineParserMatch ;
99use League \CommonMark \Parser \InlineParserContext ;
10+ use Tempest \Support \Str ;
1011
1112use function Tempest \Support \str ;
12- use function Tempest \Support \Str \class_basename ;
13- use function Tempest \Support \Str \strip_start ;
1413
1514final readonly class AttributeParser implements InlineParserInterface
1615{
@@ -35,7 +34,7 @@ public function parse(InlineParserContext $inlineContext): bool
3534 [$ flag , $ fqcn ] = $ inlineContext ->getSubMatches ();
3635 $ url = str ($ fqcn )
3736 ->stripStart (['\\Tempest \\' , 'Tempest \\' ])
38- ->replaceRegex ("/^(\w+)/ " , ' src/Tempest/$0/src ' )
37+ ->replaceRegex ("/^(\w+)/ " , fn ( array $ matches ) => sprintf ( " packages/%s/src " , Str \to_kebab_case ( $ matches [ 0 ])) )
3938 ->replace ('\\' , '/ ' )
4039 ->prepend ('https://github.com/tempestphp/tempest-framework/blob/main/ ' )
4140 ->append ('.php ' );
Original file line number Diff line number Diff line change 77use League \CommonMark \Parser \Inline \InlineParserInterface ;
88use League \CommonMark \Parser \Inline \InlineParserMatch ;
99use League \CommonMark \Parser \InlineParserContext ;
10+ use Tempest \Support \Str ;
1011
1112use function Tempest \Support \str ;
12- use function Tempest \Support \Str \class_basename ;
13- use function Tempest \Support \Str \strip_start ;
1413
1514final readonly class FqcnParser implements InlineParserInterface
1615{
@@ -35,13 +34,13 @@ public function parse(InlineParserContext $inlineContext): bool
3534 [$ flag , $ fqcn ] = $ inlineContext ->getSubMatches ();
3635 $ url = str ($ fqcn )
3736 ->stripStart (['\\Tempest \\' , 'Tempest \\' ])
38- ->replaceRegex ("/^(\w+)/ " , ' src/Tempest/$0/src ' )
37+ ->replaceRegex ("/^(\w+)/ " , fn ( array $ matches ) => sprintf ( " packages/%s/src " , Str \to_kebab_case ( $ matches [ 0 ])) )
3938 ->replace ('\\' , '/ ' )
4039 ->prepend ('https://github.com/tempestphp/tempest-framework/blob/main/ ' )
4140 ->append ('.php ' );
4241
4342 $ link = new Link ($ url );
44- $ link ->appendChild (new Code ($ flag === 'b ' ? class_basename ($ fqcn ) : strip_start ($ fqcn , '\\' )));
43+ $ link ->appendChild (new Code ($ flag === 'b ' ? Str \ class_basename ($ fqcn ) : Str \ strip_start ($ fqcn , '\\' )));
4544 $ inlineContext ->getContainer ()->appendChild ($ link );
4645
4746 return true ;
You can’t perform that action at this time.
0 commit comments