Skip to content

Commit

Permalink
Fix long 'throw' lines
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Dec 21, 2024
1 parent 0992202 commit 67e03a1
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/Behat/Gherkin/Node/TableNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ public function __construct(array $table)

foreach ($this->getRows() as $ridx => $row) {
if (!is_array($row)) {
throw new NodeException(sprintf("Table row '%s' is expected to be array, got %s", $ridx, gettype($row)));
throw new NodeException(sprintf(
"Table row '%s' is expected to be array, got %s",
$ridx,
gettype($row)
));
}

if ($columnCount === null) {
$columnCount = count($row);
}

if (count($row) !== $columnCount) {
throw new NodeException(sprintf("Table row '%s' is expected to have %s columns, got %s", $ridx, $columnCount, count($row)));
throw new NodeException(sprintf(
"Table row '%s' is expected to have %s columns, got %s",
$ridx,
$columnCount,
count($row))
);
}

foreach ($row as $column => $string) {
Expand All @@ -63,7 +72,12 @@ public function __construct(array $table)
}

if (!is_scalar($string)) {
throw new NodeException(sprintf("Table cell at row '%s', col '%s' is expected to be scalar, got %s", $ridx, $column, gettype($string)));
throw new NodeException(sprintf(
"Table cell at row '%s', col '%s' is expected to be scalar, got %s",
$ridx,
$column,
gettype($string)
));
}

$this->maxLineLength[$column] = max($this->maxLineLength[$column], mb_strlen($string, 'utf8'));
Expand Down

0 comments on commit 67e03a1

Please sign in to comment.