Skip to content

Commit

Permalink
Add better type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Oct 16, 2022
1 parent b29299f commit 595830f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ExtractOffset.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
class ExtractOffset
{
/**
* @return array<string>
* @return array{string,int,int}
*/
public static function fromSource(string $source, string $marker = '<>'): array
{
list($source, $offsetStart) = self::extractOffset($source, $marker);
list($source, $offsetEnd) = self::extractOffset($source, $marker);

return [$source, $offsetStart, $offsetEnd];
return [$source, (int)$offsetStart, (int)$offsetEnd];
}

/**
* Extract the byte offset from the given marked source
* and remove the <> mark.
*
* @return array<mixed>
* @return array{string,int}
*/
private static function extractOffset(string $source, string $marker): array
{
Expand Down

0 comments on commit 595830f

Please sign in to comment.