Skip to content

Commit

Permalink
adds some more type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflabs committed Feb 25, 2020
1 parent 3be2c9a commit 97f0fcb
Show file tree
Hide file tree
Showing 223 changed files with 601 additions and 498 deletions.
2 changes: 1 addition & 1 deletion index.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

// This section is made to be able to parse requests coming from PHP Builtin webserver
Expand Down
2 changes: 1 addition & 1 deletion src/classes/ADONewConnection.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand Down
9 changes: 7 additions & 2 deletions src/classes/ADORecordSet.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand All @@ -20,7 +20,12 @@
*/
class ADORecordSet extends \ADORecordSet implements \Countable
{
public function count()
/**
* Returns the recordCount.
*
* @return int
*/
public function count(): int
{
return $this->recordCount();
}
Expand Down
4 changes: 2 additions & 2 deletions src/classes/ADOdbException.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand Down Expand Up @@ -100,7 +100,7 @@ public function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnecti
*
* @internal param $P2 $fn specific parameter - see below
*/
public static function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
public static function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection): void
{
if (error_reporting() == 0) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/classes/ArrayRecordSet.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function recordCount()
* Advance the internal pointer of the instance array
* if no more fields are left, marks the instance variable $EOF as true.
*/
public function moveNext()
public function moveNext(): void
{
$this->fields = next($this->_array);
if ($this->fields === false) {
Expand Down
7 changes: 6 additions & 1 deletion src/classes/ContainerUtils.php
Expand Up @@ -82,7 +82,12 @@ public function __construct()
$this->container = $container;
}

public static function createContainer($conf)
/**
* @psalm-return array{0: mixed, 1: mixed}
*
* @param mixed $conf
*/
public static function createContainer($conf): array
{
if (!self::$instance) {
self::$instance = new self();
Expand Down
23 changes: 14 additions & 9 deletions src/classes/Misc.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand Down Expand Up @@ -43,7 +43,7 @@ class Misc
public $href = '';
public $controller_name = 'Misc';
public $lang = [];

public $conf = [];
protected $container;

/**
Expand Down Expand Up @@ -178,7 +178,7 @@ public function getConf($key = null)
* @param string $help help section identifier
* @param bool $do_print true to echo, false to return
*/
public function printHelp($str, $help = null, $do_print = true)
public function printHelp($str, $help = null, $do_print = true): ?string
{
if ($help !== null) {
$helplink = $this->getHelpLink($help);
Expand Down Expand Up @@ -494,7 +494,7 @@ public function getServerInfo($server_id = null)
* @param mixed $value the new value, or null to unset the parameter
* @param null|string $server_id the server identifier, or null for current server
*/
public function setServerInfo($key, $value, $server_id = null)
public function setServerInfo($key, $value, $server_id = null): void
{
if ($server_id === null) {
$server_id = $this->container->requestobj->getParam('server');
Expand Down Expand Up @@ -626,7 +626,7 @@ public function getHREF($exclude_from = null)
/**
* Sets the form tracking variable.
*/
public function setForm()
public function setForm(): string
{
$form = [];
if ($this->container->server) {
Expand All @@ -650,7 +650,7 @@ public function setForm()
*
* @param mixed $var The variable to strip (passed by reference)
*/
public function stripVar(&$var)
public function stripVar(&$var): void
{
if (is_array($var)) {
foreach ($var as $k => $v) {
Expand Down Expand Up @@ -707,7 +707,12 @@ public function inisizeToBytes($strIniSize)
}
}

public function getRequestVars($subject = '')
/**
* @psalm-return array{subject?: mixed, server?: mixed, database?: mixed, schema?: mixed}
*
* @param mixed $subject
*/
public function getRequestVars($subject = ''): array
{
$v = [];
if (!empty($subject)) {
Expand All @@ -727,7 +732,7 @@ public function getRequestVars($subject = '')
return $v;
}

public function icon($icon)
public function icon($icon): string
{
if (!is_string($icon)) {
return '';
Expand Down Expand Up @@ -814,7 +819,7 @@ public function escapeShellCmd($str)
*
* @param string $script the SQL script to save
*/
public function saveScriptHistory($script)
public function saveScriptHistory($script): void
{
list($usec, $sec) = explode(' ', microtime());
$time = ((float) $usec + (float) $sec);
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Translations.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/AcinsertController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/AggregatesController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/AlldbController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/BaseController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/BrowserController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/CastsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ColpropertiesController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ConstraintsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ConversionsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DatabaseController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DataexportController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DataimportController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DbexportController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DisplayController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DomainsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/FulltextController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/FunctionsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/GroupsController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/HelpController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/HistoryController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/IndexesController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/InfoController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/IntroController.php
@@ -1,7 +1,7 @@
<?php

/**
* PHPPgAdmin v6.0.0-RC9
* PHPPgAdmin v6.0.0-RC8
*/

namespace PHPPgAdmin\Controller;
Expand Down

0 comments on commit 97f0fcb

Please sign in to comment.