Skip to content

Commit

Permalink
[TASK] Replace @var annotation with type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
extcode committed Oct 16, 2024
1 parent d230635 commit a9d9805
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 188 deletions.
40 changes: 11 additions & 29 deletions Tests/Unit/Domain/Model/CouponTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,17 @@
#[CoversClass(Coupon::class)]
class CouponTest extends UnitTestCase
{
/**
* @var Coupon
*/
protected $coupon;

/**
* @var string
*/
protected $title = '';

/**
* @var string
*/
protected $code = '';

/**
* @var string
*/
protected $couponType = '';

/**
* @var float
*/
protected $discount = 0.0;

/**
* @var int
*/
protected $taxClassId = 0;
protected Coupon $coupon;

protected string $title = '';

protected string $code = '';

protected string $couponType = '';

protected float $discount = 0.0;

protected int $taxClassId = 0;

public function setUp(): void
{
Expand Down
59 changes: 13 additions & 46 deletions Tests/Unit/Domain/Model/Order/DiscountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,19 @@
#[CoversClass(Discount::class)]
class DiscountTest extends UnitTestCase
{
/**
* @var Discount
*/
protected $discount;

/**
* Title
*
* @var string
*/
protected $title = '';

/**
* Code
*
* @var string
*/
protected $code = '';

/**
* Gross
*
* @var float
*/
protected $gross = 0.0;

/**
* Net
*
* @var float
*/
protected $net = 0.0;

/**
* TaxClass
*
* @var TaxClass
*/
protected $taxClass;

/**
* Tax
*
* @var float
*/
protected $tax = 0.0;
protected Discount $discount;

protected string $title = '';

protected string $code = '';

protected float $gross = 0.0;

protected float $net = 0.0;

protected TaxClass $taxClass;

protected float $tax = 0.0;

public function setUp(): void
{
Expand Down
12 changes: 3 additions & 9 deletions Tests/Unit/Domain/Model/Order/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@
#[CoversClass(Item::class)]
class ItemTest extends UnitTestCase
{
/**
* @var int
*/
protected $cartPid = 1;

/**
* @var Item
*/
protected $item;
protected int $cartPid = 1;

protected Item $item;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions Tests/Unit/Domain/Model/Order/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
#[CoversClass(Payment::class)]
class PaymentTest extends UnitTestCase
{
/**
* @var Payment
*/
protected $payment;
protected Payment $payment;

public function setUp(): void
{
Expand Down
26 changes: 7 additions & 19 deletions Tests/Unit/Domain/Model/Order/ProductAdditionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@
#[CoversClass(ProductAdditional::class)]
class ProductAdditionalTest extends UnitTestCase
{
/**
* @var string
*/
protected $additionalType = '';

/**
* @var string
*/
protected $additionalKey = '';

/**
* @var string
*/
protected $additionalValue = '';

/**
* @var ProductAdditional
*/
protected $productAdditional;
protected string $additionalType = '';

protected string $additionalKey = '';

protected string $additionalValue = '';

protected ProductAdditional $productAdditional;

public function setUp(): void
{
Expand Down
26 changes: 7 additions & 19 deletions Tests/Unit/Domain/Model/Order/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@
#[CoversClass(Product::class)]
class ProductTest extends UnitTestCase
{
/**
* @var Product
*/
protected $product;

/**
* @var string
*/
protected $sku;

/**
* @var string
*/
protected $title;

/**
* @var int
*/
protected $count = 0;
protected Product $product;

protected string $sku;

protected string $title;

protected int $count = 0;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions Tests/Unit/Domain/Model/Order/ShippingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
#[CoversClass(Shipping::class)]
class ShippingTest extends UnitTestCase
{
/**
* @var Shipping
*/
protected $shipping;
protected Shipping $shipping;

public function setUp(): void
{
Expand Down
26 changes: 7 additions & 19 deletions Tests/Unit/Domain/Model/Order/TaxClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@
#[CoversClass(TaxClass::class)]
class TaxClassTest extends UnitTestCase
{
/**
* @var TaxClass
*/
protected $taxClass;

/**
* @var string
*/
protected $title;

/**
* @var string
*/
protected $value;

/**
* @var float
*/
protected $calc = 0.0;
protected TaxClass $taxClass;

protected string $title;

protected string $value;

protected float $calc = 0.0;

public function setUp(): void
{
Expand Down
19 changes: 5 additions & 14 deletions Tests/Unit/Domain/Model/Order/TaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,11 @@
#[CoversClass(Tax::class)]
class TaxTest extends UnitTestCase
{
/**
* @var Tax
*/
protected $orderTax;

/**
* @var float
*/
protected $tax;

/**
* @var TaxClass
*/
protected $taxClass;
protected Tax $orderTax;

protected float $tax;

protected TaxClass $taxClass;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions Tests/Unit/Domain/Model/Order/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
#[CoversClass(Transaction::class)]
class TransactionTest extends UnitTestCase
{
/**
* @var Transaction
*/
protected $transaction;
protected Transaction $transaction;

public function setUp(): void
{
Expand Down
10 changes: 2 additions & 8 deletions Tests/Unit/Domain/Model/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@
#[CoversClass(Tag::class)]
class TagTest extends UnitTestCase
{
/**
* @var Tag
*/
protected $tag;
protected Tag $tag;

/**
* @var string
*/
protected $title = '';
protected string $title = '';

public function setUp(): void
{
Expand Down
18 changes: 5 additions & 13 deletions Tests/Unit/Validation/Validator/EmptyValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,22 @@
#[CoversClass(EmptyValidator::class)]
class EmptyValidatorTest extends UnitTestCase
{
/**
* @var string
*/
protected $validatorClassName = EmptyValidator::class;
protected string $validatorClassName = EmptyValidator::class;

/**
* @var ValidatorInterface
*/
protected $validator;
protected ValidatorInterface $validator;

/**
* @param array $options
* @return mixed
*/
protected function getValidator($options = [])
protected function getValidator(array $options = []): ValidatorInterface
{
$validator = new $this->validatorClassName($options);
return $validator;
return new $this->validatorClassName($options);
}

/**
* @param array $options
*/
protected function validatorOptions($options)
protected function validatorOptions(array $options): void
{
$this->validator = $this->getValidator($options);
}
Expand Down

0 comments on commit a9d9805

Please sign in to comment.