Skip to content

Commit

Permalink
Add separator type in getOrdArrWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Mar 21, 2024
1 parent 9cd9925 commit af272b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.1
2.2.0
10 changes: 6 additions & 4 deletions src/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,19 @@
* @phpstan-type TTextSplit array{
* 'pos': int,
* 'ord': int,
* 'wordwidth': float,
* 'spaces': int,
* 'septype': string,
* 'wordwidth': float,
* 'totwidth': float,
* 'totspacewidth': float,
* }
*
* @phpstan-type TTextDims array{
* 'chars': int,
* 'spaces': int,
* 'words': int,
* 'totwidth': float,
* 'totspacewidth': float,
* 'words': int,
* 'split': array<int, TTextSplit>,
* }
*
Expand Down Expand Up @@ -368,8 +369,9 @@ public function getOrdArrDims(array $uniarr): array
$split[$words] = [
'pos' => $idx,
'ord' => $ord,
'wordwidth' => 0,
'spaces' => $spaces,
'septype' => $unitype,
'wordwidth' => 0,
'totwidth' => ($totwidth + ($fact * ($idx - 1))),
'totspacewidth' => ($totspacewidth + ($fact * ($spaces - 1))),
];
Expand All @@ -389,9 +391,9 @@ public function getOrdArrDims(array $uniarr): array
return [
'chars' => $chars,
'spaces' => $spaces,
'words' => $words,
'totwidth' => $totwidth,
'totspacewidth' => $totspacewidth,
'words' => $words,
'split' => $split,
];
}
Expand Down
1 change: 1 addition & 0 deletions test/StackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function testStack(): void

$this->assertEquals(11, $widths['split'][5]['pos']);
$this->assertEquals(8203, $widths['split'][5]['ord']);
$this->assertEquals('BN', $widths['split'][5]['septype']);
$this->bcAssertEqualsWithDelta(4.92, $widths['split'][5]['wordwidth'], 0.0001);
$this->assertEquals(2, $widths['split'][5]['spaces']);
$this->bcAssertEqualsWithDelta(60.9384, $widths['split'][5]['totwidth'], 0.0001);
Expand Down

0 comments on commit af272b8

Please sign in to comment.