Skip to content

Commit

Permalink
Huge csfixing from php-cs-fixer
Browse files Browse the repository at this point in the history
Removed excessive phpdoc type hinting
  • Loading branch information
hiqsol committed May 9, 2020
1 parent 1305423 commit 9798b7a
Show file tree
Hide file tree
Showing 62 changed files with 108 additions and 321 deletions.
1 change: 1 addition & 0 deletions .php_cs
Expand Up @@ -28,6 +28,7 @@ return PhpCsFixer\Config::create()
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
'blank_line_before_return' => false,
'phpdoc_align' => false,
'phpdoc_summary' => false,
'phpdoc_scalar' => false,
'phpdoc_separation' => false,
'phpdoc_to_comment' => false,
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/CannotReassignException.php
Expand Up @@ -2,8 +2,8 @@

namespace hiqdev\php\billing\Exception;

use hiqdev\php\billing\ExceptionInterface;
use Exception;
use hiqdev\php\billing\ExceptionInterface;
use Throwable;

/**
Expand Down
7 changes: 1 addition & 6 deletions src/action/AbstractAction.php
Expand Up @@ -13,11 +13,11 @@
use DateTimeImmutable;
use hiqdev\php\billing\customer\CustomerInterface;
use hiqdev\php\billing\EntityInterface;
use hiqdev\php\billing\Exception\CannotReassignException;
use hiqdev\php\billing\sale\SaleInterface;
use hiqdev\php\billing\target\TargetInterface;
use hiqdev\php\billing\type\TypeInterface;
use hiqdev\php\units\QuantityInterface;
use hiqdev\php\billing\Exception\CannotReassignException;

/**
* Chargeable Action.
Expand Down Expand Up @@ -56,12 +56,7 @@ abstract class AbstractAction implements ActionInterface, EntityInterface
protected $parent;

/**
* @param TypeInterface $type
* @param TargetInterface $target
* @param QuantityInterface $quantity
* @param CustomerInterface $customer
* @param SaleInterface $sale
* @param DateTimeImmutable $time
* @param ActionInterface $parent
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/action/Action.php
Expand Up @@ -32,8 +32,8 @@ public function isApplicable(PriceInterface $price): bool
/**
* // TODO: think about moving to Sale::isOccurred()
*
* @return bool whether Sale that belongs to current Action occurs in current month or earlier
* @throws \Exception
* @return bool whether Sale that belongs to current Action occurs in current month or earlier
*/
private function saleOccurred(): bool
{
Expand Down
17 changes: 0 additions & 17 deletions src/action/ActionInterface.php
Expand Up @@ -11,7 +11,6 @@
namespace hiqdev\php\billing\action;

use DateTimeImmutable;
use hiqdev\php\billing\charge\ChargeInterface;
use hiqdev\php\billing\customer\CustomerInterface;
use hiqdev\php\billing\price\PriceInterface;
use hiqdev\php\billing\sale\SaleInterface;
Expand All @@ -36,61 +35,45 @@ interface ActionInterface extends \JsonSerializable
{
/**
* Returns if the given price applicable to this action.
*
* @param PriceInterface $price
* @return bool
*/
public function isApplicable(PriceInterface $price): bool;

/**
* Returns client ot this action.
* @return CustomerInterface
*/
public function getCustomer(): CustomerInterface;

/**
* Returns target ot this action.
* @return TargetInterface
*/
public function getTarget(): TargetInterface;

/**
* Returns type ot this action.
* @return TypeInterface
*/
public function getType(): TypeInterface;

/**
* Returns quantity ot this action.
* @return QuantityInterface
*/
public function getQuantity(): QuantityInterface;

/**
* Returns time ot this action.
* @return DateTimeImmutable
*/
public function getTime(): DateTimeImmutable;

/**
* Returns sale if set.
* @return SaleInterface|null
*/
public function getSale(): ?SaleInterface;

/**
* Returns null if the action state is not set.
* @return bool|null
*/
public function isFinished(): ?bool;

/**
* @return ActionInterface|null
*/
public function getParent(): ?ActionInterface;

/**
* @return ActionState|null
*/
public function getState(): ?ActionState;
}
5 changes: 1 addition & 4 deletions src/action/TemporaryAction.php
Expand Up @@ -7,6 +7,7 @@
* @license BSD-3-Clause
* @copyright Copyright (c) 2017-2019, HiQDev (http://hiqdev.com/)
*/

namespace hiqdev\php\billing\action;

use hiqdev\php\billing\customer\CustomerInterface;
Expand All @@ -27,10 +28,6 @@ class TemporaryAction extends Action implements TemporaryActionInterface
{
/**
* Creates Temporary Action out of generic $action
*
* @param ActionInterface $action
* @param CustomerInterface $customer
* @return TemporaryAction
*/
public static function createAsSubaction(ActionInterface $action, CustomerInterface $customer): TemporaryAction
{
Expand Down
31 changes: 9 additions & 22 deletions src/bill/Bill.php
Expand Up @@ -62,15 +62,15 @@ class Bill implements BillInterface

public function __construct(
$id,
TypeInterface $type,
DateTimeImmutable $time,
Money $sum,
QuantityInterface $quantity,
CustomerInterface $customer,
TargetInterface $target = null,
PlanInterface $plan = null,
array $charges = [],
BillState $state = null
TypeInterface $type,
DateTimeImmutable $time,
Money $sum,
QuantityInterface $quantity,
CustomerInterface $customer,
TargetInterface $target = null,
PlanInterface $plan = null,
array $charges = [],
BillState $state = null
) {
$this->id = $id;
$this->type = $type;
Expand Down Expand Up @@ -127,17 +127,11 @@ public function setId($id)
$this->id = $id;
}

/**
* @return TypeInterface
*/
public function getType(): TypeInterface
{
return $this->type;
}

/**
* @return DateTimeImmutable
*/
public function getTime(): DateTimeImmutable
{
return $this->time;
Expand Down Expand Up @@ -167,9 +161,6 @@ public function getQuantity()
return $this->quantity;
}

/**
* @return BillInterface
*/
public function setQuantity(QuantityInterface $quantity): BillInterface
{
$this->quantity = $quantity;
Expand All @@ -193,9 +184,6 @@ public function getPlan()
return $this->plan;
}

/**
* @return bool
*/
public function hasCharges(): bool
{
return $this->charges !== [];
Expand All @@ -211,7 +199,6 @@ public function getCharges(): array

/**
* @param ChargeInterface[] $prices
* @return self
* @throws \Exception
*/
public function setCharges(array $charges): self
Expand Down
9 changes: 0 additions & 9 deletions src/bill/BillInterface.php
Expand Up @@ -27,19 +27,10 @@
*/
interface BillInterface extends EntityInterface
{
/**
* @return string
*/
public function getUniqueString(): string;

/**
* @return TypeInterface
*/
public function getType(): TypeInterface;

/**
* @return DateTimeImmutable
*/
public function getTime(): DateTimeImmutable;

/**
Expand Down
25 changes: 9 additions & 16 deletions src/charge/Charge.php
Expand Up @@ -66,13 +66,13 @@ class Charge implements ChargeInterface

public function __construct(
$id,
TypeInterface $type,
TargetInterface $target,
ActionInterface $action,
?PriceInterface $price,
QuantityInterface $usage,
Money $sum,
BillInterface $bill = null
TypeInterface $type,
TargetInterface $target,
ActionInterface $action,
?PriceInterface $price,
QuantityInterface $usage,
Money $sum,
BillInterface $bill = null
) {
$this->id = $id;
$this->type = $type;
Expand Down Expand Up @@ -124,9 +124,6 @@ public function getAction(): ActionInterface
return $this->action;
}

/**
* @return PriceInterface
*/
public function getPrice(): PriceInterface
{
return $this->price;
Expand Down Expand Up @@ -200,7 +197,7 @@ public function setComment(string $comment): ChargeInterface

public function setId($id): ChargeInterface
{
if ((string)$this->id === (string)$id) {
if ((string) $this->id === (string) $id) {
return $this;
}
if ($this->id !== null) {
Expand All @@ -216,9 +213,6 @@ public function jsonSerialize()
return array_filter(get_object_vars($this));
}

/**
* @return ChargeInterface|null
*/
public function getParent(): ?ChargeInterface
{
return $this->parent;
Expand All @@ -227,8 +221,8 @@ public function getParent(): ?ChargeInterface
/**
* @param ChargeInterface|null $parent
*
* @return Charge
* @throws \Exception if parent is already set
* @return Charge
*/
public function setParent(ChargeInterface $parent): self
{
Expand All @@ -244,7 +238,6 @@ public function setParent(ChargeInterface $parent): self
/**
* Forcefully changes parent charge
*
* @param ChargeInterface $parent
* @return Charge
*/
public function overwriteParent(ChargeInterface $parent): self
Expand Down
33 changes: 0 additions & 33 deletions src/charge/ChargeInterface.php
Expand Up @@ -27,67 +27,34 @@ interface ChargeInterface extends \JsonSerializable
*/
public function getId();

/**
* @return bool
*/
public function hasId(): bool;

/**
* @return TypeInterface
*/
public function getType(): TypeInterface;

/**
* @return TargetInterface
*/
public function getTarget(): TargetInterface;

/**
* @return ActionInterface
*/
public function getAction(): ActionInterface;

/**
* @return PriceInterface
*/
public function getPrice(): PriceInterface;

/**
* @return Money
*/
public function getSum(): Money;

/**
* @return QuantityInterface
*/
public function getUsage(): QuantityInterface;

/**
* @param string $comment
* @return self
*/
public function setComment(string $comment): self;

/**
* @return string
*/
public function getComment(): ?string;

/**
* @return self
*/
public function setFinished(): self;

/**
* @return ChargeInterface|null
*/
public function getParent(): ?ChargeInterface;

/**
* Provides unique string.
* Can be used to compare or aggregate charges.
*
* @return string
*/
public function getUniqueString(): string;
}
6 changes: 0 additions & 6 deletions src/charge/ChargeModifier.php
Expand Up @@ -23,19 +23,13 @@ interface ChargeModifier
/**
* Calculates modified charges.
*
* @param ChargeInterface|null $charge
* @param ActionInterface $action
* @return ChargeInterface[] calculated modification charges, including the original $charge
*/
public function modifyCharge(?ChargeInterface $charge, ActionInterface $action): array;

/**
* Returns true if modifier is applicable for the given charge
* (due to time or other limitations).
*
* @param ChargeInterface|null $charge
* @param ActionInterface $action
* @return bool
*/
public function isSuitable(?ChargeInterface $charge, ActionInterface $action): bool;
}

0 comments on commit 9798b7a

Please sign in to comment.