diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2020-12-31 05:51:14 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2020-12-31 05:51:14 +0300 |
commit | bcaf420bfd9567b0660499f5ff8cd398b513ce0d (patch) | |
tree | 317103d65dc35c466331d7da8f9c21d4e87d781c | |
parent | d3a11dbb3183b4d24d01d812ca2acc9b47ea0f09 (diff) |
runs psalter to enhance type inference
41 files changed, 248 insertions, 44 deletions
diff --git a/composer.json b/composer.json index ed901326..f0711d33 100644 --- a/composer.json +++ b/composer.json @@ -35,8 +35,8 @@ "friendsofphp/php-cs-fixer": "^2.16", "kint-php/kint": "~3.3", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan": "^0.12.14", - "rector/rector-prefixed": "^0.8.29", + "phpstan/phpstan": "^0.12.64", + "rector/rector-prefixed": "^0.9", "simpletest/simpletest": "^1.2", "staabm/annotate-pull-request-from-checkstyle": "^1.4", "vimeo/psalm": "^4" diff --git a/composer.lock b/composer.lock index ffeee5c4..f49394e0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a5a3bd937ae867ecdf1ed23dd129092f", + "content-hash": "481ffafa3136ff0e1e2b1372ef20f300", "packages": [ { "name": "adodb/adodb-php", @@ -3371,16 +3371,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.50", + "version": "0.12.64", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b8248f9c81265af75d6d969ca3252aaf3e998f3a" + "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b8248f9c81265af75d6d969ca3252aaf3e998f3a", - "reference": "b8248f9c81265af75d6d969ca3252aaf3e998f3a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", + "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", "shasum": "" }, "require": { @@ -3411,7 +3411,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.50" + "source": "https://github.com/phpstan/phpstan/tree/0.12.64" }, "funding": [ { @@ -3427,7 +3427,7 @@ "type": "tidelift" } ], - "time": "2020-10-16T12:22:23+00:00" + "time": "2020-12-21T11:59:02+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3996,45 +3996,35 @@ }, { "name": "rector/rector-prefixed", - "version": "0.8.30", + "version": "0.9.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector-prefixed.git", - "reference": "90910ccc8c97daefa16d2501e35843cfcd395919" + "reference": "31b49acefe7240cba59f94b01f7ee47325322d8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector-prefixed/zipball/90910ccc8c97daefa16d2501e35843cfcd395919", - "reference": "90910ccc8c97daefa16d2501e35843cfcd395919", + "url": "https://api.github.com/repos/rectorphp/rector-prefixed/zipball/31b49acefe7240cba59f94b01f7ee47325322d8b", + "reference": "31b49acefe7240cba59f94b01f7ee47325322d8b", "shasum": "" }, "require": { - "php": "^7.2" - }, - "conflict": { - "nikic/php-parser": "<4.7", - "phpstan/phpstan": "<0.12" - }, - "replace": { - "rector/rector": "self.version" - }, - "require-dev": { - "doctrine/orm": "^2.7" + "php": "^7.3|^8.0", + "phpstan/phpstan": "^0.12.64" }, "bin": [ - "rector", - "rector.phar" + "bin/rector" ], "type": "library", "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Prefixed version of Rector compiled in PHAR", + "description": "Prefixed scoped version of rector/rector package", "support": { - "source": "https://github.com/rectorphp/rector-prefixed/tree/0.8.30" + "source": "https://github.com/rectorphp/rector-prefixed/tree/0.9.3" }, - "time": "2020-10-18T09:05:00+00:00" + "time": "2020-12-29T16:24:44+00:00" }, { "name": "sebastian/cli-parser", @@ -6708,7 +6698,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": [], - "prefer-stable": true, + "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.2", @@ -1,7 +1,7 @@ <?xml version="1.0"?> <psalm errorLevel="6" resolveFromConfigFile="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" totallyTyped="false" phpVersion="7.4" findUnusedVariablesAndParams="false" cacheDirectory=".build/psalm" errorBaseline="psalm-baseline.xml"> + xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" totallyTyped="false" phpVersion="7.2" findUnusedVariablesAndParams="false" cacheDirectory=".build/psalm" errorBaseline="psalm-baseline.xml"> <projectFiles> <directory name="src" /> <ignoreFiles> diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php index 85db5c55..41bdca49 100644 --- a/src/classes/ContainerUtils.php +++ b/src/classes/ContainerUtils.php @@ -89,7 +89,6 @@ class ContainerUtils extends Container implements ContainerInterface $userSettings = $values['settings'] ?? []; $this->registerDefaultServices($userSettings); - $this->container = $this; self::$instance = $this; } diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php index aca33ca1..afd57de0 100644 --- a/src/controllers/AggregatesController.php +++ b/src/controllers/AggregatesController.php @@ -182,6 +182,9 @@ class AggregatesController extends BaseController $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $this->data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/AlldbController.php b/src/controllers/AlldbController.php index 65c65461..54f42a1d 100644 --- a/src/controllers/AlldbController.php +++ b/src/controllers/AlldbController.php @@ -236,6 +236,9 @@ class AlldbController extends BaseController $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 88d188ef..110516a9 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -167,7 +167,7 @@ class BaseController * Default method to render the controller according to the action parameter. It should return with a PSR * responseObject but it prints texts whatsoeever. * - * @return string|void + * @return void */ public function render() { @@ -186,6 +186,9 @@ class BaseController $this->printFooter(); } + /** + * @return string + */ public function doDefault() { $html = '<div><h2>Section title</h2> <p>Main content</p></div>'; @@ -210,6 +213,9 @@ class BaseController return $prefix . $this->lang[$title] . ($suffix ? ': ' . $suffix : ''); } + /** + * @return ContainerUtils + */ public function getContainer() { return $this->container; @@ -508,7 +514,7 @@ class BaseController $_server_info['desc'] ); - $servers_controller = new ServersController($container); + $servers_controller = new ServersController($this->container); $servers_controller->render(); } @@ -516,6 +522,9 @@ class BaseController } } + /** + * @return HTMLTableController + */ private function _getTableController() { if (null === $this->_table_controller) { @@ -525,6 +534,9 @@ class BaseController return $this->_table_controller; } + /** + * @return HTMLFooterController + */ private function _getFooterController() { if (null === $this->_footer_controller) { @@ -534,6 +546,9 @@ class BaseController return $this->_footer_controller; } + /** + * @return HTMLHeaderController + */ private function _getHeaderController() { if (null === $this->_header_controller) { @@ -543,6 +558,9 @@ class BaseController return $this->_header_controller; } + /** + * @return HTMLNavbarController + */ private function _getNavbarController() { if (null === $this->_trail_controller) { @@ -552,6 +570,9 @@ class BaseController return $this->_trail_controller; } + /** + * @return TreeController + */ private function _getTreeController() { if (null === $this->_tree_controller) { diff --git a/src/controllers/CastsController.php b/src/controllers/CastsController.php index 653e9b1b..8d83745e 100644 --- a/src/controllers/CastsController.php +++ b/src/controllers/CastsController.php @@ -98,6 +98,8 @@ class CastsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/ConversionsController.php b/src/controllers/ConversionsController.php index d522ef50..9861672c 100644 --- a/src/controllers/ConversionsController.php +++ b/src/controllers/ConversionsController.php @@ -81,6 +81,9 @@ class ConversionsController extends BaseController echo $this->printTable($conversions, $columns, $actions, 'conversions-conversions', $this->lang['strnoconversions']); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/DatabaseController.php b/src/controllers/DatabaseController.php index f620cfc8..1c6b9192 100644 --- a/src/controllers/DatabaseController.php +++ b/src/controllers/DatabaseController.php @@ -143,6 +143,9 @@ class DatabaseController extends BaseController $this->printFooter(true, $footer_template); } + /** + * @return \Slim\Http\Response|string + */ public function doTree($print = true) { $reqvars = $this->misc->getRequestVars('database'); @@ -655,6 +658,9 @@ class DatabaseController extends BaseController return $msg; } + /** + * @return string + */ private function _highlight($string, $term) { return \str_replace($term, \sprintf( @@ -663,6 +669,9 @@ class DatabaseController extends BaseController ), $string); } + /** + * @return string + */ private function _printTypeOption(string $curr) { $filter = $_REQUEST['filter']; diff --git a/src/controllers/DataimportController.php b/src/controllers/DataimportController.php index 4b7dfb61..f1c688d7 100644 --- a/src/controllers/DataimportController.php +++ b/src/controllers/DataimportController.php @@ -314,6 +314,11 @@ class DataimportController extends BaseController return $this->printFooter(); } + /** + * @return array + * + * @psalm-return list<mixed> + */ public static function loadNULLArray() { $array = []; @@ -330,6 +335,8 @@ class DataimportController extends BaseController /** * @param null|string $field * @param mixed $null_array + * + * @return bool */ public static function determineNull(?string $field, $null_array) { diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php index 2ab7e6c2..6a7d20e7 100644 --- a/src/controllers/DisplayController.php +++ b/src/controllers/DisplayController.php @@ -277,6 +277,11 @@ class DisplayController extends BaseController $this->printNavLinks($navlinks, 'display-browse', \get_defined_vars()); } + /** + * @return (mixed|string)[] + * + * @psalm-return array{0: mixed, 1: string, 2: string} + */ public function getQueryTitleAndType($data, $object) { $fkey = $this->coalesceArr($_REQUEST, 'fkey')['fkey']; @@ -317,6 +322,10 @@ class DisplayController extends BaseController * @param string $subject * @param mixed $object * @param mixed $resultset + * + * @return ((array|mixed|string)[][]|mixed)[][] + * + * @psalm-return array{back?: array{attr: array{href: array{url: mixed, urlvars: mixed}}, content: mixed}, edit?: array{attr: array{href: array{url: string, urlvars: array{server: mixed, database: mixed, action: string, paginate: string}}}, content: mixed}, collapse: array{attr: array{href: array{url: string, urlvars: array{strings: string, page: mixed}}}, content: mixed}, createview?: array{attr: array{href: array{url: string, urlvars: array{server: mixed, database: mixed, action: string, formDefinition: mixed}}}, content: mixed}, download?: array{attr: array{href: array{url: string, urlvars: array{server: mixed, database: mixed}}}, content: mixed}, insert?: array{attr: array{href: array{url: string, urlvars: array{server: mixed, database: mixed, action: string, table: mixed}}}, content: mixed}, refresh: array{attr: array{href: array{url: string, urlvars: array{strings: mixed, page: mixed}}}, content: mixed}} */ public function getBrowseNavLinks($type, array $_gets, $page, string $subject, $object, $resultset) { @@ -1098,6 +1107,11 @@ class DisplayController extends BaseController echo '</div>'; } + /** + * @return (((((mixed|string)[]|string)[][]|mixed)[][]|string)[]|iterable)[] + * + * @psalm-return array{0: array{actionbuttons: array{edit: array{content: mixed, attr: array{href: array{url: string, urlvars: array{action: mixed|string, strings: mixed, page: mixed}}}}, delete: array{content: mixed, attr: array{href: array{url: string, urlvars: array{action: mixed|string, strings: mixed, page: mixed}}}}}, place: string}, 1: array<empty, empty>|iterable} + */ private function _getKeyAndActions(object $resultset, $object, $data, $page, array $_gets) { $key = []; @@ -1286,6 +1300,11 @@ class DisplayController extends BaseController return \unserialize(\urldecode($the_array[$key])); } + /** + * @return int[] + * + * @psalm-return array{0: int, 1: int} + */ private function _getMinMaxPages(int $page, int $pages) { $window = 10; diff --git a/src/controllers/DomainsController.php b/src/controllers/DomainsController.php index 3c58fae8..7a6c55c3 100644 --- a/src/controllers/DomainsController.php +++ b/src/controllers/DomainsController.php @@ -208,6 +208,8 @@ class DomainsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/FulltextController.php b/src/controllers/FulltextController.php index a67b32d6..476c4574 100644 --- a/src/controllers/FulltextController.php +++ b/src/controllers/FulltextController.php @@ -220,6 +220,8 @@ class FulltextController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { @@ -249,6 +251,9 @@ class FulltextController extends BaseController return $this->printTree($items, $attrs, 'fts'); } + /** + * @return \Slim\Http\Response|null|string + */ public function doSubTree($what) { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/FunctionsController.php b/src/controllers/FunctionsController.php index 78d8e4b1..95b99922 100644 --- a/src/controllers/FunctionsController.php +++ b/src/controllers/FunctionsController.php @@ -199,6 +199,8 @@ class FunctionsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { @@ -1436,6 +1438,9 @@ class FunctionsController extends BaseController $this->printNavLinks($navlinks, $place, \get_defined_vars()); } + /** + * @return string + */ private function _getNamedParamsArgs($data, $fndata) { if (isset($fndata->fields['proallarguments'])) { @@ -1514,6 +1519,8 @@ class FunctionsController extends BaseController * Build out JS to re-create table rows for arguments. * * @param string $szArgs args to parse + * + * @return string */ private function _buildJSRows($szArgs) { @@ -1558,6 +1565,9 @@ class FunctionsController extends BaseController return $szReturn; } + /** + * @return string + */ private function _buildJSData() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/IndexesController.php b/src/controllers/IndexesController.php index 9b94b22b..7cf0ee4f 100644 --- a/src/controllers/IndexesController.php +++ b/src/controllers/IndexesController.php @@ -217,6 +217,9 @@ class IndexesController extends BaseController ], 'indexes-indexes', \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/IntroController.php b/src/controllers/IntroController.php index 81a92def..3f30127d 100644 --- a/src/controllers/IntroController.php +++ b/src/controllers/IntroController.php @@ -28,6 +28,8 @@ class IntroController extends BaseController * Intro screen. * * Release: intro,v 1.19 2007/07/12 19:26:22 xzilla Exp $ + * + * @return string */ public function doDefault() { diff --git a/src/controllers/LanguagesController.php b/src/controllers/LanguagesController.php index 06cf11cc..14f5b593 100644 --- a/src/controllers/LanguagesController.php +++ b/src/controllers/LanguagesController.php @@ -75,6 +75,8 @@ class LanguagesController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/MaterializedviewsController.php b/src/controllers/MaterializedviewsController.php index 38dd61ba..6bf6cc7a 100644 --- a/src/controllers/MaterializedviewsController.php +++ b/src/controllers/MaterializedviewsController.php @@ -247,6 +247,8 @@ class MaterializedviewsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/OpclassesController.php b/src/controllers/OpclassesController.php index 73769d6f..b0d01065 100644 --- a/src/controllers/OpclassesController.php +++ b/src/controllers/OpclassesController.php @@ -83,6 +83,8 @@ class OpclassesController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/OperatorsController.php b/src/controllers/OperatorsController.php index bd49bdcc..839d6ece 100644 --- a/src/controllers/OperatorsController.php +++ b/src/controllers/OperatorsController.php @@ -68,6 +68,8 @@ class OperatorsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/RulesController.php b/src/controllers/RulesController.php index 873d1228..33b1ddf2 100644 --- a/src/controllers/RulesController.php +++ b/src/controllers/RulesController.php @@ -131,6 +131,9 @@ class RulesController extends BaseController ]], 'rules-rules', \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/SchemasController.php b/src/controllers/SchemasController.php index 98e6162b..810e3e63 100644 --- a/src/controllers/SchemasController.php +++ b/src/controllers/SchemasController.php @@ -197,6 +197,8 @@ class SchemasController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { @@ -231,6 +233,9 @@ class SchemasController extends BaseController return $this->printTree($schemas, $attrs, 'schemas'); } + /** + * @return \Slim\Http\Response|string + */ public function doSubTree() { $tabs = $this->misc->getNavTabs('schema'); diff --git a/src/controllers/SequencesController.php b/src/controllers/SequencesController.php index d35a843d..47efa54b 100644 --- a/src/controllers/SequencesController.php +++ b/src/controllers/SequencesController.php @@ -209,6 +209,8 @@ class SequencesController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/ServersController.php b/src/controllers/ServersController.php index 57337948..e287e5c3 100644 --- a/src/controllers/ServersController.php +++ b/src/controllers/ServersController.php @@ -157,6 +157,9 @@ class ServersController extends BaseController echo $this->printTable($servers, $columns, $actions, $this->table_place, $this->lang['strnoobjects'], $svPre); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $nodes = []; diff --git a/src/controllers/SqlController.php b/src/controllers/SqlController.php index d7a9d526..9b8521f6 100644 --- a/src/controllers/SqlController.php +++ b/src/controllers/SqlController.php @@ -190,6 +190,9 @@ class SqlController extends BaseController return $data->executeScript('script', $sqlCallback); } + /** + * @return ADORecordSet|null + */ private function execute_query() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/SqleditController.php b/src/controllers/SqleditController.php index c215fd68..6d98ecaf 100644 --- a/src/controllers/SqleditController.php +++ b/src/controllers/SqleditController.php @@ -55,6 +55,8 @@ class SqleditController extends BaseController /** * Allow execution of arbitrary SQL statements on a database. + * + * @return string */ public function doDefault() { @@ -133,6 +135,8 @@ class SqleditController extends BaseController /** * Searches for a named database object. + * + * @return string */ public function doFind() { @@ -208,6 +212,11 @@ class SqleditController extends BaseController return $default_html; } + /** + * @return string[][] + * + * @psalm-return array{SCHEMA: array{langkey: string, selected: string}, TABLE: array{langkey: string, selected: string}, VIEW: array{langkey: string, selected: string}, SEQUENCE: array{langkey: string, selected: string}, COLUMN: array{langkey: string, selected: string}, RULE: array{langkey: string, selected: string}, INDEX: array{langkey: string, selected: string}, TRIGGER: array{langkey: string, selected: string}, CONSTRAINT: array{langkey: string, selected: string}, FUNCTION: array{langkey: string, selected: string}, DOMAIN: array{langkey: string, selected: string}} + */ private function _getFilters() { return [ @@ -225,6 +234,11 @@ class SqleditController extends BaseController ]; } + /** + * @return string[][] + * + * @psalm-return array{AGGREGATE: array{langkey: string, selected: string}, TYPE: array{langkey: string, selected: string}, OPERATOR: array{langkey: string, selected: string}, OPCLASS: array{langkey: string, selected: string}, CONVERSION: array{langkey: string, selected: string}, LANGUAGE: array{langkey: string, selected: string}} + */ private function _getAdvancedFilters() { return [ diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php index 6dbcdd7b..2837a71b 100644 --- a/src/controllers/TablesController.php +++ b/src/controllers/TablesController.php @@ -225,6 +225,8 @@ class TablesController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { @@ -246,6 +248,9 @@ class TablesController extends BaseController return $this->printTree($tables, $attrs, 'tables'); } + /** + * @return \Slim\Http\Response|string + */ public function doSubTree() { $tabs = $this->misc->getNavTabs('table'); @@ -858,6 +863,8 @@ class TablesController extends BaseController * * @param mixed $confirm * @param mixed $msg + * + * @return null|string */ public function doSelectRows($confirm, $msg = '') { @@ -1503,6 +1510,11 @@ class TablesController extends BaseController } } + /** + * @return (mixed|string|string[])[][] + * + * @psalm-return array{table: array{title: mixed, field: mixed, url: string, vars: array{table: string}}, owner: array{title: mixed, field: mixed}, tablespace: array{title: mixed, field: mixed}, tuples: array{title: mixed, field: mixed, type: string}, table_size: array{title: mixed, field: mixed}, actions: array{title: mixed}, comment: array{title: mixed, field: mixed}} + */ private function _getColumns() { return [ @@ -1542,6 +1554,11 @@ class TablesController extends BaseController ]; } + /** + * @return ((((mixed|string)[]|string)[]|string)[]|mixed|string)[][] + * + * @psalm-return array{multiactions: array{keycols: array{table: string}, url: string, default: string}, browse: array{content: mixed, attr: array{href: array{url: string, urlvars: array{subject: string, return: string, table: mixed}}}}, select: array{content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, insert: array{content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, empty: array{multiaction: string, content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, alter: array{content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, drop: array{multiaction: string, content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, vacuum: array{multiaction: string, content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, analyze: array{multiaction: string, content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}, reindex: array{multiaction: string, content: mixed, attr: array{href: array{url: string, urlvars: array{action: string, table: mixed}}}}} + */ private function _getActions() { return [ diff --git a/src/controllers/TblpropertiesController.php b/src/controllers/TblpropertiesController.php index 1122a559..b49d5bbd 100644 --- a/src/controllers/TblpropertiesController.php +++ b/src/controllers/TblpropertiesController.php @@ -236,6 +236,9 @@ class TblpropertiesController extends BaseController $this->printNavLinks($navlinks, 'tblproperties-tblproperties', \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $misc = $this->misc; @@ -854,6 +857,11 @@ class TblpropertiesController extends BaseController } } + /** + * @return \Closure + * + * @psalm-return \Closure(mixed, mixed):mixed + */ private function _getAttPre($data) { $attPre = static function (&$rowdata, $actions) use ($data) { @@ -878,6 +886,11 @@ class TblpropertiesController extends BaseController return $attPre; } + /** + * @return \Closure + * + * @psalm-return \Closure(mixed, mixed):string + */ private function _getCstrRender($misc, $data) { $view = $this->view; diff --git a/src/controllers/TreeController.php b/src/controllers/TreeController.php index 9011470a..32ee9434 100644 --- a/src/controllers/TreeController.php +++ b/src/controllers/TreeController.php @@ -83,7 +83,9 @@ class TreeController extends BaseController * @param string $section The section where the branch is linked in the tree * @param bool $print either to return or echo the result * - * @return Response|string the json rendered tree + * @return (array|bool|string)[] the json rendered tree + * + * @psalm-return array<int|string, array<string, mixed>|bool|string> */ public function printTree(&$_treedata, &$attrs, $section, $print = true) { diff --git a/src/controllers/TriggersController.php b/src/controllers/TriggersController.php index e989592b..70373008 100644 --- a/src/controllers/TriggersController.php +++ b/src/controllers/TriggersController.php @@ -231,6 +231,9 @@ class TriggersController extends BaseController ]], 'triggers-triggers', \get_defined_vars()); } + /** + * @return \Slim\Http\Response|string + */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); diff --git a/src/controllers/TypesController.php b/src/controllers/TypesController.php index 739ccf12..c48c8a17 100644 --- a/src/controllers/TypesController.php +++ b/src/controllers/TypesController.php @@ -208,6 +208,8 @@ class TypesController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/controllers/ViewsController.php b/src/controllers/ViewsController.php index a7215b33..1e0332df 100644 --- a/src/controllers/ViewsController.php +++ b/src/controllers/ViewsController.php @@ -247,6 +247,8 @@ class ViewsController extends BaseController /** * Generate XML for the browser tree. + * + * @return \Slim\Http\Response|string */ public function doTree() { diff --git a/src/database/ADOdbBase.php b/src/database/ADOdbBase.php index 8f36d466..9d8db0ff 100644 --- a/src/database/ADOdbBase.php +++ b/src/database/ADOdbBase.php @@ -296,7 +296,7 @@ class ADOdbBase * * @param string $sql The SQL query to execute * - * @return ADORecordSet|int A recordset or an error code + * @return int|string A recordset or an error code */ public function execute($sql) { @@ -324,7 +324,7 @@ class ADOdbBase * * @param string $sql The SQL statement to be executed * - * @return ADORecordSet|int A recordset or an error number + * @return int|\RecordSet|string A recordset or an error number */ public function selectSet($sql) { @@ -336,11 +336,17 @@ class ADOdbBase } } + /** + * @return \the + */ public function ErrorNo(): int { return $this->conn->ErrorNo(); } + /** + * @return \the + */ public function ErrorMsg(): string { return $this->conn->ErrorMsg(); diff --git a/src/database/Postgres.php b/src/database/Postgres.php index 2d4bb5cf..fce8893b 100644 --- a/src/database/Postgres.php +++ b/src/database/Postgres.php @@ -289,8 +289,10 @@ class Postgres extends ADOdbBase } $term = \sprintf( - '$_PATERN_$%%s%$_PATERN_$', - $term + '$_PATERN_$%s%s%s$_PATERN_$', + '%', + $term, + '%' ); $sql .= \sprintf( diff --git a/src/database/databasetraits/FunctionTrait.php b/src/database/databasetraits/FunctionTrait.php index f7cc0d20..26e90dfa 100644 --- a/src/database/databasetraits/FunctionTrait.php +++ b/src/database/databasetraits/FunctionTrait.php @@ -73,7 +73,7 @@ trait FunctionTrait /** * Returns a list of all functions that can be used in triggers. * - * @return ADORecordSet Functions that can be used in a trigger + * @return int|\PHPPgAdmin\ADORecordSet Functions that can be used in a trigger */ public function getTriggerFunctions() { diff --git a/src/database/databasetraits/RoleTrait.php b/src/database/databasetraits/RoleTrait.php index c51243bb..50ce9fe7 100644 --- a/src/database/databasetraits/RoleTrait.php +++ b/src/database/databasetraits/RoleTrait.php @@ -904,6 +904,15 @@ trait RoleTrait abstract public function fieldArrayClean(&$arr); + /** + * @psalm-return -1|0 + * + * @param mixed $original_parent_roles + * @param mixed $new_roles_to_add + * @param mixed $rolename + * + * @return int + */ private function _dealWithOldParentRoles($original_parent_roles, $new_roles_to_add, $rolename) { $old = \explode(',', $original_parent_roles); @@ -934,6 +943,15 @@ trait RoleTrait return 0; } + /** + * @psalm-return -1|0 + * + * @param mixed $original_members + * @param mixed $new_members_of_role + * @param mixed $rolename + * + * @return int + */ private function _dealWithOriginalMembers($original_members, $new_members_of_role, $rolename) { //members @@ -964,6 +982,15 @@ trait RoleTrait return 0; } + /** + * @psalm-return -1|0 + * + * @param mixed $original_admins + * @param mixed $new_admins_of_role + * @param mixed $rolename + * + * @return int + */ private function _dealWithOriginalAdmins($original_admins, $new_admins_of_role, $rolename) { $old = \explode(',', $original_admins); @@ -991,6 +1018,19 @@ trait RoleTrait return 0; } + /** + * @param mixed $rolename + * @param mixed $password + * @param mixed $connlimit + * @param mixed $expiry + * @param mixed $superuser + * @param mixed $createdb + * @param mixed $createrole + * @param mixed $inherits + * @param mixed $login + * + * @return int|\PHPPgAdmin\ADORecordSet + */ private function _alterRole($rolename, $password, $connlimit, $expiry, $superuser, $createdb, $createrole, $inherits, $login) { $enc = $this->_encryptPassword($rolename, $password); diff --git a/src/database/databasetraits/SchemaTrait.php b/src/database/databasetraits/SchemaTrait.php index b22eb6b8..d1194946 100644 --- a/src/database/databasetraits/SchemaTrait.php +++ b/src/database/databasetraits/SchemaTrait.php @@ -63,7 +63,7 @@ trait SchemaTrait * * @param string $schema The the name of the schema to work in * - * @return int 0 if operation was successful + * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful */ public function setSchema($schema) { diff --git a/src/database/databasetraits/TableTrait.php b/src/database/databasetraits/TableTrait.php index efb7e01d..2664368c 100644 --- a/src/database/databasetraits/TableTrait.php +++ b/src/database/databasetraits/TableTrait.php @@ -301,7 +301,7 @@ trait TableTrait * @param string $table The name of the table * @param string $field (optional) The name of a field to return * - * @return ADORecordSet All attributes in order + * @return int|\PHPPgAdmin\ADORecordSet All attributes in order */ public function getTableAttributes($table, $field = '') { @@ -1220,7 +1220,7 @@ trait TableTrait /** * Ends the data object for a dump. * - * @return bool 0 success + * @return int 0 success */ public function endDump() { diff --git a/src/database/databasetraits/TriggerTrait.php b/src/database/databasetraits/TriggerTrait.php index a5e1f898..1db15b1a 100644 --- a/src/database/databasetraits/TriggerTrait.php +++ b/src/database/databasetraits/TriggerTrait.php @@ -169,7 +169,7 @@ trait TriggerTrait * @param string $type NOTHING for a do nothing rule, SOMETHING to use given action * @param string $action The action to take * - * @return int 0 if operation was successful + * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful */ public function setRule($name, $event, $table, $where, $instead, $type, $action) { diff --git a/src/lib.inc.php b/src/lib.inc.php index 8ab273a5..eebef60d 100644 --- a/src/lib.inc.php +++ b/src/lib.inc.php @@ -8,6 +8,7 @@ use PHPPgAdmin\ContainerUtils; use Slim\App; use Slim\Http\Request; use Slim\Http\Response; + \defined('BASE_PATH') || \define('BASE_PATH', \dirname(__DIR__)); /** |