type fixes
This commit is contained in:
@@ -36,15 +36,15 @@ use Espo\Core\Field\Address;
|
||||
*/
|
||||
class AddressBuilder
|
||||
{
|
||||
protected $street;
|
||||
private ?string $street;
|
||||
|
||||
protected $city;
|
||||
private ?string$city;
|
||||
|
||||
protected $country;
|
||||
private ?string $country;
|
||||
|
||||
protected $state;
|
||||
private ?string $state;
|
||||
|
||||
protected $postalCode;
|
||||
private ?string $postalCode;
|
||||
|
||||
public function clone(Address $address): self
|
||||
{
|
||||
|
||||
@@ -38,11 +38,11 @@ use Espo\Core\{
|
||||
|
||||
class AddressFormatterFactory
|
||||
{
|
||||
private $metadataProvider;
|
||||
private AddressFormatterMetadataProvider $metadataProvider;
|
||||
|
||||
private $injectableFactory;
|
||||
private InjectableFactory $injectableFactory;
|
||||
|
||||
private $config;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(
|
||||
AddressFormatterMetadataProvider $metadataProvider,
|
||||
@@ -56,6 +56,7 @@ class AddressFormatterFactory
|
||||
|
||||
public function create(int $format): AddressFormatter
|
||||
{
|
||||
/** @var ?class-string */
|
||||
$className = $this->metadataProvider->getFormatterClassName($format);
|
||||
|
||||
if (!$className) {
|
||||
|
||||
@@ -35,7 +35,7 @@ use RuntimeException;
|
||||
|
||||
class CurrencyConfigDataProvider
|
||||
{
|
||||
protected $config;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class CurrencyConfigDataProvider
|
||||
/**
|
||||
* Get a list of available currencies.
|
||||
*
|
||||
* @return array<int, string>
|
||||
* @return array<int,string>
|
||||
*/
|
||||
public function getCurrencyList(): array
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ use RuntimeException;
|
||||
*/
|
||||
class CurrencyConverter
|
||||
{
|
||||
protected $configDataProvider;
|
||||
private CurrencyConfigDataProvider $configDataProvider;
|
||||
|
||||
public function __construct(CurrencyConfigDataProvider $configDataProvider)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,10 @@ use RuntimeException;
|
||||
*/
|
||||
class CurrencyRates
|
||||
{
|
||||
private $data = [];
|
||||
/**
|
||||
* @var array<string,float>
|
||||
*/
|
||||
private array $data = [];
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -56,6 +59,9 @@ class CurrencyRates
|
||||
return $this->data[$currencyCode];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,float> $data
|
||||
*/
|
||||
public static function fromArray(array $data): self
|
||||
{
|
||||
$obj = new self();
|
||||
|
||||
@@ -43,9 +43,9 @@ use Throwable;
|
||||
*/
|
||||
class Date implements DateTimeable
|
||||
{
|
||||
private $value;
|
||||
private string $value;
|
||||
|
||||
private $dateTime;
|
||||
private DateTimeImmutable $dateTime;
|
||||
|
||||
private const SYSTEM_FORMAT = 'Y-m-d';
|
||||
|
||||
@@ -138,6 +138,7 @@ class Date implements DateTimeable
|
||||
*/
|
||||
public function modify(string $modifier): self
|
||||
{
|
||||
/** @var DateTimeImmutable|false */
|
||||
$dateTime = $this->dateTime->modify($modifier);
|
||||
|
||||
if (!$dateTime) {
|
||||
|
||||
@@ -43,9 +43,9 @@ use Throwable;
|
||||
*/
|
||||
class DateTime implements DateTimeable
|
||||
{
|
||||
private $value;
|
||||
private string $value;
|
||||
|
||||
private $dateTime;
|
||||
private DateTimeImmutable $dateTime;
|
||||
|
||||
private const SYSTEM_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
@@ -170,6 +170,9 @@ class DateTime implements DateTimeable
|
||||
*/
|
||||
public function modify(string $modifier): self
|
||||
{
|
||||
/**
|
||||
* @var DateTimeImmutable|false
|
||||
*/
|
||||
$dateTime = $this->dateTime->modify($modifier);
|
||||
|
||||
if (!$dateTime) {
|
||||
|
||||
@@ -44,9 +44,9 @@ use RuntimeException;
|
||||
*/
|
||||
class DateTimeOptional implements DateTimeable
|
||||
{
|
||||
private $dateTimeValue = null;
|
||||
private ?DateTime $dateTimeValue = null;
|
||||
|
||||
private $dateValue = null;
|
||||
private ?Date $dateValue = null;
|
||||
|
||||
private const SYSTEM_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
|
||||
@@ -38,11 +38,11 @@ use FILTER_VALIDATE_EMAIL;
|
||||
*/
|
||||
class EmailAddress
|
||||
{
|
||||
private $address;
|
||||
private string $address;
|
||||
|
||||
private $isOptedOut = false;
|
||||
private bool $isOptedOut = false;
|
||||
|
||||
private $isInvalid = false;
|
||||
private bool $isInvalid = false;
|
||||
|
||||
public function __construct(string $address)
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ use RuntimeException;
|
||||
*/
|
||||
class EmailAddressGroupFactory implements ValueFactory
|
||||
{
|
||||
private $metadata;
|
||||
private Metadata $metadata;
|
||||
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
/**
|
||||
* @todo Use OrmDefs instead of Metadata.
|
||||
@@ -134,6 +134,10 @@ class EmailAddressGroupFactory implements ValueFactory
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int,array<string,mixed>|\stdClass> $dataList
|
||||
* @return \stdClass[]
|
||||
*/
|
||||
private function sanitizeDataList(array $dataList): array
|
||||
{
|
||||
$sanitizedDataList = [];
|
||||
|
||||
@@ -40,16 +40,12 @@ class EmailAddressGroup
|
||||
/**
|
||||
* @var EmailAddress[]
|
||||
*/
|
||||
private $list = [];
|
||||
private array $list = [];
|
||||
|
||||
/**
|
||||
* @var ?EmailAddress
|
||||
*/
|
||||
private $primary = null;
|
||||
private ?EmailAddress $primary = null;
|
||||
|
||||
/**
|
||||
* @param EmailAddress[] $list
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function __construct(array $list = [])
|
||||
|
||||
@@ -36,9 +36,9 @@ use RuntimeException;
|
||||
*/
|
||||
class Link
|
||||
{
|
||||
private $id;
|
||||
private string $id;
|
||||
|
||||
private $name = null;
|
||||
private ?string $name = null;
|
||||
|
||||
public function __construct(string $id)
|
||||
{
|
||||
|
||||
@@ -44,19 +44,13 @@ use Espo\Core\{
|
||||
|
||||
use RuntimeException;
|
||||
use InvalidArgumentException;
|
||||
use StdClass;
|
||||
use stdClass;
|
||||
|
||||
class LinkMultipleFactory implements ValueFactory
|
||||
{
|
||||
/**
|
||||
* @var Defs
|
||||
*/
|
||||
private $ormDefs;
|
||||
private Defs $ormDefs;
|
||||
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(Defs $ormDefs, EntityManager $entityManager)
|
||||
{
|
||||
@@ -124,7 +118,7 @@ class LinkMultipleFactory implements ValueFactory
|
||||
return new LinkMultiple($itemList);
|
||||
}
|
||||
|
||||
private function loadLinkMultipleField(CoreEntity $entity, $field): void
|
||||
private function loadLinkMultipleField(CoreEntity $entity, string $field): void
|
||||
{
|
||||
$columns = $this->ormDefs
|
||||
->getEntity($entity->getEntityType())
|
||||
@@ -134,7 +128,7 @@ class LinkMultipleFactory implements ValueFactory
|
||||
$entity->loadLinkMultipleField($field, $columns);
|
||||
}
|
||||
|
||||
private function loadColumnData(Entity $entity, string $field): StdClass
|
||||
private function loadColumnData(Entity $entity, string $field): stdClass
|
||||
{
|
||||
$columnData = (object) [];
|
||||
|
||||
@@ -172,7 +166,7 @@ class LinkMultipleFactory implements ValueFactory
|
||||
return $columnData;
|
||||
}
|
||||
|
||||
private function addColumnValues(LinkMultipleItem $item, object $data)
|
||||
private function addColumnValues(LinkMultipleItem $item, stdClass $data): LinkMultipleItem
|
||||
{
|
||||
foreach (get_object_vars($data) as $column => $value) {
|
||||
$item = $item->withColumnValue($column, $value);
|
||||
|
||||
@@ -36,11 +36,14 @@ use RuntimeException;
|
||||
*/
|
||||
class LinkMultipleItem
|
||||
{
|
||||
private $id;
|
||||
private string $id;
|
||||
|
||||
private $name = null;
|
||||
private ?string $name = null;
|
||||
|
||||
private $columnData = [];
|
||||
/**
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
private array $columnData = [];
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
|
||||
@@ -36,11 +36,11 @@ use RuntimeException;
|
||||
*/
|
||||
class LinkParent
|
||||
{
|
||||
private $entityType;
|
||||
private string $entityType;
|
||||
|
||||
private $id;
|
||||
private string $id;
|
||||
|
||||
private $name = null;
|
||||
private ?string $name = null;
|
||||
|
||||
public function __construct(string $entityType, string $id)
|
||||
{
|
||||
|
||||
@@ -36,13 +36,13 @@ use RuntimeException;
|
||||
*/
|
||||
class PhoneNumber
|
||||
{
|
||||
private $number;
|
||||
private string $number;
|
||||
|
||||
private $type = null;
|
||||
private ?string $type = null;
|
||||
|
||||
private $isOptedOut = false;
|
||||
private bool $isOptedOut = false;
|
||||
|
||||
private $isInvalid = false;
|
||||
private bool $isInvalid = false;
|
||||
|
||||
public function __construct(string $number)
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ use RuntimeException;
|
||||
*/
|
||||
class PhoneNumberGroupFactory implements ValueFactory
|
||||
{
|
||||
private $metadata;
|
||||
private Metadata $metadata;
|
||||
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
/**
|
||||
* @todo Use OrmDefs instead of Metadata.
|
||||
@@ -138,6 +138,10 @@ class PhoneNumberGroupFactory implements ValueFactory
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int,array<string,mixed>|\stdClass> $dataList
|
||||
* @return \stdClass[]
|
||||
*/
|
||||
private function sanitizeDataList(array $dataList): array
|
||||
{
|
||||
$sanitizedDataList = [];
|
||||
|
||||
@@ -38,7 +38,6 @@ use Espo\Core\Repositories\Database;
|
||||
use Espo\Core\Di;
|
||||
|
||||
/**
|
||||
* @template T of PhoneNumberEntity
|
||||
* @extends Database<PhoneNumberEntity>
|
||||
*/
|
||||
class PhoneNumber extends Database implements
|
||||
|
||||
Reference in New Issue
Block a user