start implementing array{} typehint

This commit is contained in:
Dennis Eichhorn 2020-02-04 21:52:59 +01:00
parent 47cd969f10
commit dfba5f1021
40 changed files with 70 additions and 65 deletions

View File

@ -27,7 +27,7 @@ class Grid
/** /**
* Grid system containing all nodes * Grid system containing all nodes
* *
* @var array * @var array<int, array<int, Node>>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $nodes = [[]]; private array $nodes = [[]];

View File

@ -27,7 +27,7 @@ final class AssetManager implements \Countable
/** /**
* Assets. * Assets.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $assets = []; private array $assets = [];

View File

@ -60,7 +60,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
/** /**
* Database data. * Database data.
* *
* @var array * @var array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string}
* @since 1.0.0 * @since 1.0.0
*/ */
protected array $dbdata = []; protected array $dbdata = [];
@ -177,6 +177,11 @@ abstract class ConnectionAbstract implements ConnectionInterface
return $this->schemaGrammar; return $this->schemaGrammar;
} }
/**
* array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
*/
abstract public function connect(array $dbdata = null) : void;
/** /**
* Object destructor. * Object destructor.
* *

View File

@ -41,7 +41,7 @@ final class ConnectionFactory
* *
* Overwrites current connection if existing * Overwrites current connection if existing
* *
* @param string[] $dbdata the basic database information for establishing a connection * @param array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
* *
* @return ConnectionAbstract * @return ConnectionAbstract
* *

View File

@ -38,7 +38,7 @@ final class MysqlConnection extends ConnectionAbstract
* *
* Creates the database object and overwrites all default values. * Creates the database object and overwrites all default values.
* *
* @param string[] $dbdata the basic database information for establishing a connection * @param array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -38,7 +38,7 @@ final class PostgresConnection extends ConnectionAbstract
* *
* Creates the database object and overwrites all default values. * Creates the database object and overwrites all default values.
* *
* @param string[] $dbdata the basic database information for establishing a connection * @param array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -38,7 +38,7 @@ final class SQLiteConnection extends ConnectionAbstract
* *
* Creates the database object and overwrites all default values. * Creates the database object and overwrites all default values.
* *
* @param string[] $dbdata the basic database information for establishing a connection * @param array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -38,7 +38,7 @@ final class SqlServerConnection extends ConnectionAbstract
* *
* Creates the database object and overwrites all default values. * Creates the database object and overwrites all default values.
* *
* @param string[] $dbdata the basic database information for establishing a connection * @param array{db:string, host:string, port:int, login:string, password:string, database:string, prefix:string} $dbdata the basic database information for establishing a connection
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -77,7 +77,7 @@ abstract class GrammarAbstract
/** /**
* Special keywords. * Special keywords.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
protected array $specialKeywords = [ protected array $specialKeywords = [

View File

@ -152,7 +152,7 @@ class Builder extends BuilderAbstract
/** /**
* Group. * Group.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
public array $groups = []; public array $groups = [];

View File

@ -42,7 +42,7 @@ class Builder extends QueryBuilder
/** /**
* Fields. * Fields.
* *
* @var array * @var array<string, array{name:string, type:string, default:mixed, null:bool, primary:bool, autoincrement:bool, foreignTable:?string, foreignKey:?string}>
* @since 1.0.0 * @since 1.0.0
*/ */
public array $createFields = []; public array $createFields = [];
@ -66,7 +66,7 @@ class Builder extends QueryBuilder
/** /**
* Tables. * Tables.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
public array $selectTables = ['*']; public array $selectTables = ['*'];

View File

@ -39,7 +39,7 @@ class ConsoleSession implements SessionInterface
/** /**
* Raw session data. * Raw session data.
* *
* @var array * @var array<string, mixed>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $sessionData = []; private array $sessionData = [];

View File

@ -40,7 +40,7 @@ final class HttpSession implements SessionInterface
/** /**
* Raw session data. * Raw session data.
* *
* @var array * @var array<string, mixed>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $sessionData = []; private array $sessionData = [];

View File

@ -36,7 +36,7 @@ final class EventManager implements \Countable
/** /**
* Events. * Events.
* *
* @var array * @var array<string, array<string, bool>>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $groups = []; private array $groups = [];
@ -44,7 +44,7 @@ final class EventManager implements \Countable
/** /**
* Callbacks. * Callbacks.
* *
* @var array * @var array<string, array{remove:bool, reset:bool, callbacks:array}>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $callbacks = []; private array $callbacks = [];

View File

@ -30,7 +30,7 @@ final class L11nManager
/** /**
* Language. * Language.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $language = []; private array $language = [];

View File

@ -95,7 +95,7 @@ class Localization
/** /**
* Time format. * Time format.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $datetime = []; private array $datetime = [];
@ -103,7 +103,7 @@ class Localization
/** /**
* Weight. * Weight.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $weight = []; private array $weight = [];
@ -111,7 +111,7 @@ class Localization
/** /**
* Speed. * Speed.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $speed = []; private array $speed = [];
@ -119,7 +119,7 @@ class Localization
/** /**
* Length. * Length.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $length = []; private array $length = [];
@ -127,7 +127,7 @@ class Localization
/** /**
* Area. * Area.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $area = []; private array $area = [];
@ -135,7 +135,7 @@ class Localization
/** /**
* Volume. * Volume.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $volume = []; private array $volume = [];

View File

@ -39,7 +39,7 @@ final class FileLogger implements LoggerInterface
* Potential values are null or an array filled with log timings. * Potential values are null or an array filled with log timings.
* This is used in order to profile code sections by ID. * This is used in order to profile code sections by ID.
* *
* @var array * @var array<string, array{start:float, end:float, time:float}>
* @since 1.0.0 * @since 1.0.0
*/ */
private static array $timings = []; private static array $timings = [];
@ -180,7 +180,7 @@ final class FileLogger implements LoggerInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function startTimeLog($id = '') : bool public static function startTimeLog(string $id = '') : bool
{ {
if (isset(self::$timings[$id])) { if (isset(self::$timings[$id])) {
return false; return false;
@ -203,7 +203,7 @@ final class FileLogger implements LoggerInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function endTimeLog($id = '') : float public static function endTimeLog(string $id = '') : float
{ {
$temp = \explode(' ', \microtime()); $temp = \explode(' ', \microtime());
$mtime = ((float) $temp[1]) + ((float) $temp[0]); $mtime = ((float) $temp[1]) + ((float) $temp[0]);

View File

@ -37,7 +37,7 @@ final class Polygon implements D2ShapeInterface
* *
* These coordinates define the polygon * These coordinates define the polygon
* *
* @var array[] * @var array<int, array{x:int|float, y:int|float}>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $coord = []; private array $coord = [];

View File

@ -52,7 +52,7 @@ final class Request extends RequestAbstract
/** /**
* Request hash. * Request hash.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
protected array $hash = []; protected array $hash = [];

View File

@ -60,7 +60,7 @@ final class Request extends RequestAbstract
/** /**
* Request information. * Request information.
* *
* @var string[] * @var array{browser:string, os:string}
* @since 1.0.0 * @since 1.0.0
*/ */
private array $info; private array $info;
@ -68,7 +68,7 @@ final class Request extends RequestAbstract
/** /**
* Request hash. * Request hash.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
protected array $hash = []; protected array $hash = [];

View File

@ -49,7 +49,7 @@ final class Head implements RenderableInterface
/** /**
* Assets bound to this page instance. * Assets bound to this page instance.
* *
* @var array * @var array<string, array<type:int, attributes:array>>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $assets = []; private array $assets = [];

View File

@ -62,7 +62,7 @@ final class Meta implements RenderableInterface
/** /**
* Itemprop. * Itemprop.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $itemprops = []; private array $itemprops = [];
@ -70,7 +70,7 @@ final class Meta implements RenderableInterface
/** /**
* Property. * Property.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $properties = []; private array $properties = [];
@ -78,7 +78,7 @@ final class Meta implements RenderableInterface
/** /**
* Name. * Name.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $names = []; private array $names = [];

View File

@ -66,7 +66,7 @@ final class ModuleManager
/** /**
* Installed modules. * Installed modules.
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $installed = []; private array $installed = [];
@ -74,7 +74,7 @@ final class ModuleManager
/** /**
* All active modules (on all pages not just the ones that are running now). * All active modules (on all pages not just the ones that are running now).
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $active = []; private array $active = [];
@ -90,7 +90,7 @@ final class ModuleManager
/** /**
* All modules in the module directory. * All modules in the module directory.
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $all = []; private array $all = [];
@ -98,7 +98,7 @@ final class ModuleManager
/** /**
* To load based on request uri. * To load based on request uri.
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $uriLoad = []; private array $uriLoad = [];

View File

@ -27,7 +27,7 @@ final class Preloader
/** /**
* Files and paths * Files and paths
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
private array $includes = []; private array $includes = [];
@ -35,7 +35,7 @@ final class Preloader
/** /**
* Ignored files and paths * Ignored files and paths
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
private array $ignores = []; private array $ignores = [];

View File

@ -27,7 +27,7 @@ final class SocketRouter implements RouterInterface
/** /**
* Routes. * Routes.
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $routes = []; private array $routes = [];

View File

@ -47,7 +47,7 @@ final class WebRouter implements RouterInterface
/** /**
* Routes. * Routes.
* *
* @var array * @var array<string, array>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $routes = []; private array $routes = [];

View File

@ -30,7 +30,7 @@ final class PhpCode
/** /**
* Disabled functions * Disabled functions
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
public static array $disabledFunctions = [ public static array $disabledFunctions = [
@ -45,7 +45,7 @@ final class PhpCode
/** /**
* Deprecated functions * Deprecated functions
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
public static array $deprecatedFunctions = [ public static array $deprecatedFunctions = [

View File

@ -29,7 +29,7 @@ final class MultiMap implements \Countable
/** /**
* Stored values. * Stored values.
* *
* @var array * @var array<int|string, mixed>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $values = []; private array $values = [];
@ -37,7 +37,7 @@ final class MultiMap implements \Countable
/** /**
* Associated keys for values. * Associated keys for values.
* *
* @var array * @var array<int|string, int|string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $keys = []; private array $keys = [];

View File

@ -37,7 +37,7 @@ class PriorityQueue implements \Countable, \Serializable
/** /**
* Queue. * Queue.
* *
* @var array * @var array<int, array{data:mixed, priority:float}>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $queue = []; private array $queue = [];

View File

@ -29,7 +29,7 @@ final class Storage
/** /**
* Registered storage. * Registered storage.
* *
* @var array * @var array<string, StorageAbstract|string>
* @since 1.0.0 * @since 1.0.0
*/ */
private static array $registered = []; private static array $registered = [];
@ -87,8 +87,8 @@ final class Storage
/** /**
* Register storage environment. * Register storage environment.
* *
* @param string $name Name of the environment * @param string $name Name of the environment
* @param mixed|StorageAbstract|string $class Class to register. This can be either a namespace path, a anonymous class or storage implementation. * @param StorageAbstract|string $class Class to register. This can be either a namespace path, a anonymous class or storage implementation.
* *
* @return bool * @return bool
* *

View File

@ -49,7 +49,7 @@ final class Argument implements UriInterface
/** /**
* Path elements. * Path elements.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
private array $pathElements = []; private array $pathElements = [];
@ -113,7 +113,7 @@ final class Argument implements UriInterface
/** /**
* Uri query. * Uri query.
* *
* @var array * @var array<string, mixed>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $query = []; private array $query = [];

View File

@ -33,7 +33,7 @@ final class Currency
/** /**
* ECB currency rates. * ECB currency rates.
* *
* @var array * @var array<string, float>
* @since 1.0.0 * @since 1.0.0
*/ */
private static array $ecbCurrencies = []; private static array $ecbCurrencies = [];

View File

@ -27,7 +27,7 @@ final class Numeric
/** /**
* Romans association. * Romans association.
* *
* @var array * @var array<string, int>
* @since 1.0.0 * @since 1.0.0
*/ */
public const ROMANS = [ public const ROMANS = [

View File

@ -27,7 +27,7 @@ final class Dictionary
/** /**
* Huffman dictionary. * Huffman dictionary.
* *
* @var array * @var array<string, string>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $dictionary = []; private array $dictionary = [];
@ -98,8 +98,8 @@ final class Dictionary
/** /**
* Fill dictionary. * Fill dictionary.
* *
* @param array $entry Source data to generate dictionary from * @param array<int, array<int, string>> $entry Source data to generate dictionary from
* @param string $value Dictionary value * @param string $value Dictionary value
* *
* @return void * @return void
* *

View File

@ -83,7 +83,7 @@ class Commit
/** /**
* Files. * Files.
* *
* @var array * @var array<string, array{old:string, new:string}>
* @since 1.0.0 * @since 1.0.0
*/ */
private array $files = []; private array $files = [];

View File

@ -44,7 +44,7 @@ class Zip implements ArchiveInterface
return false; return false;
} }
/** @var array $sources */ /** @var array $sources<string, string> */
foreach ($sources as $source => $relative) { foreach ($sources as $source => $relative) {
if (\is_numeric($source) && \realpath($relative) !== false) { if (\is_numeric($source) && \realpath($relative) !== false) {
$source = $relative; $source = $relative;

View File

@ -27,7 +27,7 @@ class File
/** /**
* Extensions. * Extensions.
* *
* @var array[] * @var array<string[]>
* @since 1.0.0 * @since 1.0.0
*/ */
private static $extensions = [ private static $extensions = [

View File

@ -130,8 +130,8 @@ class Text
/** /**
* Get a random string. * Get a random string.
* *
* @param int $length Text length * @param int $length Text length
* @param array $words Vocabulary * @param string[] $words Vocabulary
* *
* @return string * @return string
* *

View File

@ -29,7 +29,7 @@ final class StringCompare
/** /**
* Dictionary. * Dictionary.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
private array $dictionary = []; private array $dictionary = [];
@ -37,7 +37,7 @@ final class StringCompare
/** /**
* Constructor. * Constructor.
* *
* @param array $dictionary Dictionary * @param string[] $dictionary Dictionary
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -34,7 +34,7 @@ class View extends ViewAbstract
/** /**
* View data. * View data.
* *
* @var array * @var array<string, mixed>
* @since 1.0.0 * @since 1.0.0
*/ */
protected array $data = []; protected array $data = [];