typehint and init value optimization

This commit is contained in:
Dennis Eichhorn 2019-12-22 11:14:08 +01:00
parent ca064b75d2
commit 5e7d806b7f
8 changed files with 58 additions and 46 deletions

View File

@ -30,7 +30,7 @@ final class City
* @var int
* @since 1.0.0
*/
private $id = 0;
private int $id = 0;
/**
* Country code.
@ -38,7 +38,7 @@ final class City
* @var string
* @since 1.0.0
*/
private $countryCode = '';
private string $countryCode = '';
/**
* State code.
@ -46,7 +46,7 @@ final class City
* @var string
* @since 1.0.0
*/
private $state = '';
private string $state = '';
/**
* City name.
@ -54,7 +54,7 @@ final class City
* @var string
* @since 1.0.0
*/
private $name = '';
private string $name = '';
/**
* Postal code.
@ -62,7 +62,7 @@ final class City
* @var int
* @since 1.0.0
*/
private $postal = 0;
private int $postal = 0;
/**
* Latitude.
@ -70,7 +70,7 @@ final class City
* @var float
* @since 1.0.0
*/
private $lat = 0.0;
private float $lat = 0.0;
/**
* Longitude.
@ -78,7 +78,7 @@ final class City
* @var float
* @since 1.0.0
*/
private $long = 0.0;
private float $long = 0.0;
/**
* Get city name

View File

@ -30,7 +30,7 @@ final class Currency
* @var int
* @since 1.0.0
*/
private $id = 0;
private int $id = 0;
/**
* Currency name.
@ -38,7 +38,7 @@ final class Currency
* @var string
* @since 1.0.0
*/
private $name = '';
private string $name = '';
/**
* Currency code.
@ -46,7 +46,7 @@ final class Currency
* @var string
* @since 1.0.0
*/
private $code = '';
private string $code = '';
/**
* Currency code.
@ -54,7 +54,7 @@ final class Currency
* @var int
* @since 1.0.0
*/
private $number = 0;
private int $number = 0;
/**
* Currency decimals.
@ -62,7 +62,7 @@ final class Currency
* @var int
* @since 1.0.0
*/
private $decimals = 0;
private int $decimals = 0;
/**
* Currency countries.
@ -70,7 +70,7 @@ final class Currency
* @var string
* @since 1.0.0
*/
private $countries = '';
private string $countries = '';
/**
* Get currency name

View File

@ -30,7 +30,7 @@ final class Language
* @var int
* @since 1.0.0
*/
private $id = 0;
private int $id = 0;
/**
* Language name.
@ -38,7 +38,7 @@ final class Language
* @var string
* @since 1.0.0
*/
private $name = '';
private string $name = '';
/**
* Language native.
@ -46,7 +46,7 @@ final class Language
* @var string
* @since 1.0.0
*/
private $native = '';
private string $native = '';
/**
* Language code.
@ -54,7 +54,7 @@ final class Language
* @var string
* @since 1.0.0
*/
private $code2 = '';
private string $code2 = '';
/**
* Language code.
@ -62,7 +62,7 @@ final class Language
* @var string
* @since 1.0.0
*/
private $code3 = '';
private string $code3 = '';
/**
* Language code.
@ -70,7 +70,7 @@ final class Language
* @var string
* @since 1.0.0
*/
private $code3Native = '';
private string $code3Native = '';
/**
* Get id

View File

@ -27,24 +27,24 @@ final class Complex
/**
* Real part.
*
* @var mixed
* @var int|float
* @since 1.0.0
*/
private $re = null;
private $re;
/**
* Imaginary part.
*
* @var mixed
* @var int|float
* @since 1.0.0
*/
private $im = null;
private $im;
/**
* Constructor.
*
* @param mixed $re Real part
* @param mixed $im Imaginary part
* @param int|float $re Real part
* @param int|float $im Imaginary part
*
* @since 1.0.0
*/
@ -57,7 +57,7 @@ final class Complex
/**
* Get real part
*
* @return mixed
* @return int|float
*
* @since 1.0.0
*/
@ -69,7 +69,7 @@ final class Complex
/**
* Get imaginary part
*
* @return mixed
* @return int|float
*
* @since 1.0.0
*/
@ -125,7 +125,7 @@ final class Complex
/**
* Absolute
*
* @return mixed
* @return int|float
*
* @since 1.0.0
*/

View File

@ -42,15 +42,15 @@ class File extends FileAbstract implements FileInterface
* @var resource
* @since 1.0.0
*/
private $con = null;
private $con;
/**
* Ftp connection uri.
*
* @var null|Http
* @var Http
* @since 1.0.0
*/
private ?Http $uri = null;
private Http $uri;
/**
* Create ftp connection

View File

@ -52,7 +52,7 @@ final class Http implements UriInterface
* @var array
* @since 1.0.0
*/
private array $pathElements = [];
private array $pathElements;
/**
* Uri.
@ -60,7 +60,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $uri = '';
private string $uri;
/**
* Uri scheme.
@ -68,7 +68,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $scheme = '';
private string $scheme;
/**
* Uri host.
@ -76,7 +76,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $host = '';
private string $host;
/**
* Uri port.
@ -84,7 +84,7 @@ final class Http implements UriInterface
* @var int
* @since 1.0.0
*/
private int $port = 80;
private int $port;
/**
* Uri user.
@ -92,7 +92,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $user = '';
private string $user;
/**
* Uri password.
@ -100,7 +100,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $pass = '';
private string $pass;
/**
* Uri path.
@ -108,7 +108,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $path = '';
private string $path;
/**
* Uri query.
@ -124,7 +124,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $queryString = '';
private string $queryString;
/**
* Uri fragment.
@ -132,7 +132,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $fragment = '';
private string $fragment;
/**
* Uri base.
@ -140,7 +140,7 @@ final class Http implements UriInterface
* @var string
* @since 1.0.0
*/
private string $base = '';
private string $base;
/**
* Constructor.
@ -163,6 +163,18 @@ final class Http implements UriInterface
$url = \parse_url($this->uri);
if ($url === false) {
$this->scheme = '';
$this->host = '';
$this->port = 80;
$this->user = '';
$this->pass = '';
$this->path = '';
$this->queryString = '';
$this->query = [];
$this->pathElements = [];
$this->fragment = '';
$this->base = '';
return;
}

View File

@ -54,7 +54,7 @@ class HIBCC
* @var string
* @since 1.0.0
*/
private $dateFormat = 'Y-m-d';
private string $dateFormat = 'Y-m-d';
/**
* Date of the expiration.

View File

@ -53,7 +53,7 @@ class View extends ViewAbstract
* @var null|ApplicationAbstract
* @since 1.0.0
*/
protected ?ApplicationAbstract $app = null;
protected ?ApplicationAbstract $app;
/**
* Request.
@ -61,7 +61,7 @@ class View extends ViewAbstract
* @var null|RequestAbstract
* @since 1.0.0
*/
protected ?RequestAbstract $request = null;
protected ?RequestAbstract $request;
/**
* Request.
@ -69,7 +69,7 @@ class View extends ViewAbstract
* @var null|ResponseAbstract
* @since 1.0.0
*/
protected ?ResponseAbstract $response = null;
protected ?ResponseAbstract $response;
/**
* Theme name.