Skip to content

Commit e35a734

Browse files
author
Tigran Makaryan
committed
In RouteNotFoundStrategy.php changed code when in getConsoleUsage methid local variable $table default value is false, changed to an array as after that in code it is used as an array, but for php8.1 it is not acceptable.
As this module is marked as an archive we are temporary fixing this part until in code we will use laminas-cli intead of this, so this changes are temporary solution which will allow us to use php8.1 until global changes will applied ad this module usage will be removed
1 parent 39398be commit e35a734

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030
},
3131
"require": {
32-
"php": "^7.3 || ~8.0.0",
32+
"php": "^7.3 || ~8.0.0 || ~8.1.0",
3333
"container-interop/container-interop": "^1.1",
3434
"laminas/laminas-console": "^2.6",
3535
"laminas/laminas-eventmanager": "^3.3",

src/View/RouteNotFoundStrategy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ protected function getConsoleUsage(
275275
* Transform arrays in usage info into columns, otherwise join everything together
276276
*/
277277
$result = '';
278-
$table = false;
278+
$table = [];
279279
$tableCols = 0;
280280
$tableType = 0;
281281
foreach ($usageInfo as $moduleName => $usage) {
@@ -298,10 +298,10 @@ protected function getConsoleUsage(
298298
* 'invocation method' => 'explanation'
299299
*/
300300
if (is_string($a) && is_string($b)) {
301-
if (($tableCols !== 2 || $tableType !== 1) && $table !== false) {
301+
if (($tableCols !== 2 || $tableType !== 1) && !empty($table)) {
302302
// render last table
303303
$result .= $this->renderTable($table, $tableCols, $console->getWidth());
304-
$table = false;
304+
$table = [];
305305

306306
// add extra newline for clarity
307307
$result .= "\n";
@@ -321,10 +321,10 @@ protected function getConsoleUsage(
321321
*/
322322
if (is_array($b)) {
323323
$count = count($b);
324-
if (($count !== $tableCols || $tableType !== 2) && $table !== false) {
324+
if (($count !== $tableCols || $tableType !== 2) && !empty($table)) {
325325
// render last table
326326
$result .= $this->renderTable($table, $tableCols, $console->getWidth());
327-
$table = false;
327+
$table = [];
328328

329329
// add extra newline for clarity
330330
$result .= "\n";
@@ -339,10 +339,10 @@ protected function getConsoleUsage(
339339
/*
340340
* 'A single line of text'
341341
*/
342-
if ($table !== false) {
342+
if (!empty($table)) {
343343
// render last table
344344
$result .= $this->renderTable($table, $tableCols, $console->getWidth());
345-
$table = false;
345+
$table = [];
346346

347347
// add extra newline for clarity
348348
$result .= "\n";
@@ -354,7 +354,7 @@ protected function getConsoleUsage(
354354
}
355355

356356
// Finish last table
357-
if ($table !== false) {
357+
if (!empty($table)) {
358358
$result .= $this->renderTable($table, $tableCols, $console->getWidth());
359359
}
360360

0 commit comments

Comments
 (0)