Skip to content

Commit f7b0193

Browse files
committed
fixes errors as reported by phpstan
1 parent ab85b1b commit f7b0193

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+237
-258
lines changed

.configs/debug.var_dumper.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ update_version:
5656
@echo "Current version is " ${VERSION} ;\
5757
echo "Next version is " $(v) ;\
5858
sed -i 's/"version": "$(VERSION)"/"version": "$(v)"/g' composer.json
59-
@${MAKE} composer_update --no-print-directory
59+
composer update --lock
6060

6161

6262
mocktag:

assets/js/footer_scripts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ $.ready
8686
stateObj.redirect_to
8787
);
8888
}
89-
return { jqFn: jQuery.fn, hljsFn: globalThis.hljs };
89+
return { jqFn: jQuery.fn, hljsFn: globalThis.hljs||{highlightBlock:null} };
9090

9191
})
9292
.then(({ jqFn, hljsFn }) => {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"vimeo/psalm": "^4.6"
4545
},
4646
"extra": {
47-
"version": "6.1.3"
47+
"version": "6.1.4"
4848
},
4949
"autoload": {
5050
"psr-4": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mk_linters.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ lint:
164164
$(executable) --ignore-fails --exclude vendor src
165165

166166

167-
fixers: lint csfixer dependency_analysis phpcs psalm phpstan
167+
fixers: lint csfixer phpcs psalm phpstan
168168

169169

170170

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ parameters:
2727
- vendor/*
2828
- src/classes/ADO*
2929
- src/router.php
30+
reportUnmatchedIgnoredErrors: false
3031

3132
treatPhpDocTypesAsCertain: false
3233

src/classes/ADORecordSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function RecordCount(): int
3939
*
4040
* @param int $fieldoffset
4141
*
42-
* @return \the the field
42+
* @return \ADOFieldObject the field
4343
*/
4444
public function FetchField($fieldoffset = -1): ADOFieldObject
4545
{

src/classes/ArrayRecordSet.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ public function __construct($data)
4545
$this->EOF = true;
4646
}
4747
}
48-
48+
public function getIterator()
49+
{
50+
return $this->_array;
51+
}
4952
/**
5053
* Returns the recordCount.
5154
*/

src/classes/ContainerUtils.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
* @property string $database
2424
* @property bool $DEBUGMODE
2525
* @property array $deploy_info
26-
* @property \GuzzleHttp\Client $fcIntranetClient
27-
* @property Messages $flash
26+
* @property Messages $flash
2827
* @property bool $IN_TEST
2928
* @property Misc $misc
3029
* @property Request $request
@@ -35,7 +34,7 @@
3534
* @property string $THEME_PATH
3635
* @property ViewManager $view
3736
*
38-
* @method mixed get(string)
37+
* @method mixed get($varname='')
3938
*/
4039
class ContainerUtils extends Container implements ContainerInterface
4140
{

src/classes/Misc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function getDatabaseAccessor($database = '', $server_id = null)
369369
// Create a database wrapper class for easy manipulation of the
370370
// connection.
371371

372-
$this->_data = new $_type($_connection->conn, $this->container, $server_info);
372+
$this->_data = new $_type($_connection, $this->container, $server_info);
373373
$this->_data->platform = $_connection->platform;
374374

375375
//$this->_data->getHelpPages();

src/controllers/AggregatesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function doDefault($msg = '')
184184
'content' => $this->lang['strcreateaggregate'],
185185
],
186186
];
187-
$this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
187+
return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
188188
}
189189

190190
/**
@@ -676,6 +676,6 @@ public function doProperties($msg = '')
676676
'content' => $this->lang['strdrop'],
677677
];
678678

679-
$this->printNavLinks($navlinks, 'aggregates-properties', \get_defined_vars());
679+
return $this->printNavLinks($navlinks, 'aggregates-properties', \get_defined_vars());
680680
}
681681
}

src/controllers/AlldbController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function doDefault($msg = '')
238238
'content' => $this->lang['strcreatedatabase'],
239239
],
240240
];
241-
$this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
241+
return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
242242
}
243243

244244
/**

src/controllers/BaseController.php

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function adjustTabsForTree(&$tabs)
256256
/**
257257
* Produce JSON data for the browser tree.
258258
*
259-
* @param \ADORecordSet|\PHPPgAdmin\Interfaces\Recordset
259+
* @param \ADORecordSet|\PHPPgAdmin\Interfaces\RecordSet $_treedata
260260
* @param false|string $section
261261
* @param bool $print either to return or echo the result
262262
*
@@ -268,7 +268,21 @@ public function printTree(&$_treedata, &$attrs, $section, $print = true)
268268
{
269269
$tree = $this->_getTreeController();
270270

271-
return $tree->printTree($_treedata, $attrs, $section, $print);
271+
$parent= $tree->printTree($_treedata, $attrs, $section);
272+
273+
if ($print) {
274+
if (isset($_REQUEST['children'])) {
275+
$children = $parent;
276+
$parent = ['children' => $children];
277+
}
278+
279+
return $this
280+
->container
281+
->response
282+
->withStatus(200)
283+
->withJson($parent);
284+
}
285+
return $parent;
272286
}
273287

274288
/**
@@ -284,7 +298,12 @@ public function printTrail($trail = [], bool $do_print = true)
284298
$from = __METHOD__;
285299
$html_trail = $this->_getNavbarController();
286300

287-
return $html_trail->printTrail($trail, $do_print, $from);
301+
return tap( $html_trail->printTrail($trail ),function(?string $html) use ($do_print){
302+
if($do_print) {
303+
304+
echo $html;
305+
}
306+
} );
288307
}
289308

290309
/**
@@ -298,15 +317,24 @@ public function printNavLinks(array $navlinks, string $place, array $env = [], $
298317
$from = __METHOD__;
299318
$footer_controller = $this->_getFooterController();
300319

301-
return $footer_controller->printNavLinks($navlinks, $place, $env, $do_print, $from);
320+
return tap($footer_controller->printNavLinks($navlinks, $place, $env, $from),function(?string $navLinksHtml) use ($do_print){
321+
if($do_print) {
322+
323+
echo $navLinksHtml;
324+
}
325+
} );
302326
}
303327

304328
public function printTabs(string $tabs, string $activetab, bool $do_print = true)
305329
{
306330
$from = __METHOD__;
307331
$html_trail = $this->_getNavbarController();
308332

309-
return $html_trail->printTabs($tabs, $activetab, $do_print, $from);
333+
return tap($html_trail->printTabs($tabs, $activetab, false, $from),function(?string $html) use ($do_print){
334+
if($do_print) {
335+
echo $html;
336+
}
337+
} );
310338
}
311339

312340
/**
@@ -323,7 +351,11 @@ public function printLink($link, bool $do_print = true, ?string $from = null)
323351

324352
$html_trail = $this->_getNavbarController();
325353

326-
return $html_trail->printLink($link, $do_print, $from);
354+
return tap($html_trail->printLink($link, $do_print, $from),function(?string $html) use ($do_print){
355+
if($do_print) {
356+
echo $html;
357+
}
358+
} );
327359
}
328360

329361
/**
@@ -362,9 +394,7 @@ public function printFooter(bool $doBody = true, string $template = 'footer.twig
362394

363395
public function printReload($database, $do_print = true)
364396
{
365-
$footer_controller = $this->_getFooterController();
366-
367-
return $footer_controller->printReload($database, $do_print);
397+
return '';
368398
}
369399

370400
/**
@@ -413,7 +443,7 @@ public function printHeader(string $title = '', ?string $script = null, bool $do
413443
$title = '' !== $title ? $title : $this->headerTitle();
414444
$header_controller = $this->_getHeaderController();
415445

416-
return $header_controller->printHeader($title, $script, $do_print, $template);
446+
return $header_controller->printHeader($title, $script, $do_print, $template);
417447
}
418448

419449
/**
@@ -437,7 +467,7 @@ public function printTitle(string $title, ?string $help = null, bool $do_print =
437467
{
438468
$header_controller = $this->_getHeaderController();
439469

440-
return $header_controller->printTitle($title, $help, $do_print);
470+
return $header_controller->printTitle($title, $help, $do_print);
441471
}
442472

443473
/**

src/controllers/CastsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function doDefault($msg = '')
9393
if (self::isRecordset($casts)) {
9494
echo $this->printTable($casts, $columns, $actions, 'casts-casts', $this->lang['strnocasts']);
9595
}
96+
return '';
9697
}
9798

9899
/**

src/controllers/ColpropertiesController.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function render()
6666
* @param string $msg message to display
6767
* @param bool $isTable tells if we're showing table properties
6868
*/
69-
public function doDefault($msg = '', $isTable = true): void
69+
public function doDefault($msg = '', $isTable = true)
7070
{
7171
if (!isset($_REQUEST['table']) || empty($_REQUEST['table'])) {
7272
$isTable = false;
@@ -89,7 +89,9 @@ public function doDefault($msg = '', $isTable = true): void
8989
$this->printTabs('column', 'properties');
9090
$this->printMsg($msg);
9191

92-
if (!empty($_REQUEST['column'])) {
92+
if (empty($_REQUEST['column'])){
93+
return '';
94+
}
9395
// Get table
9496
$tdata = $data->getTable($this->tableName);
9597
// Get columns
@@ -222,8 +224,9 @@ public function doDefault($msg = '', $isTable = true): void
222224
];
223225
}
224226

225-
$this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
226-
}
227+
return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
228+
229+
227230
}
228231

229232
/**

src/controllers/ConstraintsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function doDefault($msg = '')
237237
'content' => $this->lang['straddfk'],
238238
],
239239
];
240-
$this->printNavLinks($navlinks, 'constraints-constraints', \get_defined_vars());
240+
return $this->printNavLinks($navlinks, 'constraints-constraints', \get_defined_vars());
241241
}
242242

243243
/**

src/controllers/ConversionsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function doDefault($msg = '')
7878
if (self::isRecordset($conversions)) {
7979
echo $this->printTable($conversions, $columns, $actions, 'conversions-conversions', $this->lang['strnoconversions']);
8080
}
81+
return '';
8182
}
8283

8384
/**

src/controllers/DatabaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function render()
142142

143143
echo $output;
144144

145-
$this->printFooter(true, $footer_template);
145+
return $this->printFooter(true, $footer_template);
146146
}
147147

148148
/**

src/controllers/DataexportController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function doDefault($msg = '')
170170
) . \PHP_EOL;
171171
echo '</form>' . \PHP_EOL;
172172

173-
$this->printFooter();
173+
return $this->printFooter();
174174
}
175175

176176
protected function mimicDumpFeature($format, string $cleanprefix, bool $oids)

0 commit comments

Comments
 (0)