Skip to content

Commit

Permalink
Update dependencies (#62)
Browse files Browse the repository at this point in the history
* updated brick/date-time

* updated tomasvotruba/type-coverage

* updated rector

* updated eventsauce
  • Loading branch information
osteel authored Aug 21, 2023
1 parent a379b7f commit b6e4644
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 58 deletions.
2 changes: 1 addition & 1 deletion app/Commands/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function summary(TaxYearSummaryRepository $repository, string $taxYear,
return self::SUCCESS;
}

$taxYear = $this->presenter->choice('Review another tax year?', array_merge(['No'], $availableTaxYears), 'No');
$taxYear = $this->presenter->choice('Review another tax year?', ['No', ...$availableTaxYears], 'No');

if ($taxYear === 'No') {
return self::SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion app/Services/CommandRunner/CommandRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Illuminate\Contracts\Console\Kernel;

final class CommandRunner implements CommandRunnerContract
final readonly class CommandRunner implements CommandRunnerContract
{
public function __construct(private Kernel $artisan)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Services/DatabaseManager/DatabaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Illuminate\Process\PendingProcess;
use Symfony\Component\Console\Output\NullOutput;

final class DatabaseManager implements DatabaseManagerContract
final readonly class DatabaseManager implements DatabaseManagerContract
{
public function __construct(
private Repository $config,
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Presenter/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class Presenter implements PresenterContract
{
private SymfonyStyle $ui;
private readonly SymfonyStyle $ui;

public function __construct(InputInterface $input, OutputInterface $output)
{
Expand Down
4 changes: 2 additions & 2 deletions app/Services/TransactionProcessor/TransactionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use Domain\ValueObjects\Transactions\Swap;
use Domain\ValueObjects\Transactions\Transfer;

final class TransactionProcessor implements TransactionProcessorContract
final readonly class TransactionProcessor implements TransactionProcessorContract
{
public function __construct(private readonly TransactionDispatcherContract $transactionDispatcher)
public function __construct(private TransactionDispatcherContract $transactionDispatcher)
{
}

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"ext-bcmath": "*"
},
"require-dev": {
"brick/date-time": "^0.4.2",
"brick/date-time": "^0.5.1",
"eventsauce/eventsauce": "^3.4",
"eventsauce/message-repository-for-illuminate": "^0.4.2",
"eventsauce/message-repository-for-illuminate": "^1.0",
"eventsauce/object-hydrator": "^1.3",
"eventsauce/pest-utilities": "^3.4",
"fakerphp/faker": "^1.21.0",
Expand All @@ -40,8 +40,8 @@
"phpoffice/phpspreadsheet": "^1.28",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.6",
"rector/rector": "^0.15.21",
"tomasvotruba/type-coverage": "^0.1.0"
"rector/rector": "^0.18.0",
"tomasvotruba/type-coverage": "^0.2.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions domain/src/Actions/UpdateSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Domain\Projections\Summary;
use Domain\ValueObjects\FiatAmount;

final class UpdateSummary
final readonly class UpdateSummary
{
final public function __construct(public readonly FiatAmount $fiatBalanceUpdate)
final public function __construct(public FiatAmount $fiatBalanceUpdate)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@

final class SharePoolingAssetDisposal extends SharePoolingAssetTransaction
{
public readonly QuantityAllocation $sameDayQuantityAllocation;

public readonly QuantityAllocation $thirtyDayQuantityAllocation;

public function __construct(
LocalDate $date,
Quantity $quantity,
FiatAmount $costBasis,
public readonly FiatAmount $proceeds,
public readonly bool $forFiat,
?QuantityAllocation $sameDayQuantityAllocation = null,
?QuantityAllocation $thirtyDayQuantityAllocation = null,
public readonly QuantityAllocation $sameDayQuantityAllocation = new QuantityAllocation(),
public readonly QuantityAllocation $thirtyDayQuantityAllocation = new QuantityAllocation(),
bool $processed = true,
?SharePoolingAssetTransactionId $id = null,
) {
Expand All @@ -34,9 +30,6 @@ public function __construct(
$costBasis->currency === $proceeds->currency
|| throw SharePoolingAssetDisposalException::currencyMismatch($costBasis->currency, $proceeds->currency);

$this->sameDayQuantityAllocation = $sameDayQuantityAllocation ?? new QuantityAllocation();
$this->thirtyDayQuantityAllocation = $thirtyDayQuantityAllocation ?? new QuantityAllocation();

$allocatedQuantity = $this->sameDayQuantityAllocation->quantity()->plus($this->thirtyDayQuantityAllocation->quantity());

$this->quantity->isGreaterThanOrEqualTo($allocatedQuantity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Ramsey\Uuid\Uuid;
use Stringable;

final class SharePoolingAssetTransactionId implements Stringable
final readonly class SharePoolingAssetTransactionId implements Stringable
{
final private function __construct(public readonly string $id)
final private function __construct(public string $id)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Domain\Aggregates\TaxYear\ValueObjects\TaxYearId;
use Stringable;

final class RevertCapitalGainUpdate implements Stringable
final readonly class RevertCapitalGainUpdate implements Stringable
{
final public function __construct(
public readonly LocalDate $date,
public readonly CapitalGain $capitalGainUpdate,
public LocalDate $date,
public CapitalGain $capitalGainUpdate,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions domain/src/Aggregates/TaxYear/Actions/UpdateCapitalGain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Domain\Aggregates\TaxYear\ValueObjects\TaxYearId;
use Stringable;

final class UpdateCapitalGain implements Stringable
final readonly class UpdateCapitalGain implements Stringable
{
final public function __construct(
public readonly LocalDate $date,
public readonly CapitalGain $capitalGainUpdate,
public LocalDate $date,
public CapitalGain $capitalGainUpdate,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions domain/src/Aggregates/TaxYear/Actions/UpdateIncome.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Domain\ValueObjects\FiatAmount;
use Stringable;

final class UpdateIncome implements Stringable
final readonly class UpdateIncome implements Stringable
{
public function __construct(
public readonly LocalDate $date,
public readonly FiatAmount $incomeUpdate,
public LocalDate $date,
public FiatAmount $incomeUpdate,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Domain\ValueObjects\FiatAmount;
use Stringable;

final class UpdateNonAttributableAllowableCost implements Stringable
final readonly class UpdateNonAttributableAllowableCost implements Stringable
{
public function __construct(
public readonly LocalDate $date,
public readonly FiatAmount $nonAttributableAllowableCostChange,
public LocalDate $date,
public FiatAmount $nonAttributableAllowableCostChange,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Brick\DateTime\LocalDate;
use Domain\Aggregates\TaxYear\ValueObjects\CapitalGain;

final class CapitalGainUpdateReverted
final readonly class CapitalGainUpdateReverted
{
final public function __construct(
public readonly LocalDate $date,
public readonly CapitalGain $capitalGainUpdate,
public readonly CapitalGain $newCapitalGain,
public LocalDate $date,
public CapitalGain $capitalGainUpdate,
public CapitalGain $newCapitalGain,
) {
}
}
8 changes: 4 additions & 4 deletions domain/src/Aggregates/TaxYear/Events/CapitalGainUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Brick\DateTime\LocalDate;
use Domain\Aggregates\TaxYear\ValueObjects\CapitalGain;

final class CapitalGainUpdated
final readonly class CapitalGainUpdated
{
final public function __construct(
public readonly LocalDate $date,
public readonly CapitalGain $capitalGainUpdate,
public readonly CapitalGain $newCapitalGain,
public LocalDate $date,
public CapitalGain $capitalGainUpdate,
public CapitalGain $newCapitalGain,
) {
}
}
8 changes: 4 additions & 4 deletions domain/src/Aggregates/TaxYear/Events/IncomeUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Brick\DateTime\LocalDate;
use Domain\ValueObjects\FiatAmount;

final class IncomeUpdated
final readonly class IncomeUpdated
{
public function __construct(
public readonly LocalDate $date,
public readonly FiatAmount $incomeUpdate,
public readonly FiatAmount $newIncome,
public LocalDate $date,
public FiatAmount $incomeUpdate,
public FiatAmount $newIncome,
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Brick\DateTime\LocalDate;
use Domain\ValueObjects\FiatAmount;

final class NonAttributableAllowableCostUpdated
final readonly class NonAttributableAllowableCostUpdated
{
public function __construct(
public readonly LocalDate $date,
public readonly FiatAmount $nonAttributableAllowableCostChange,
public readonly FiatAmount $newNonAttributableAllowableCost,
public LocalDate $date,
public FiatAmount $nonAttributableAllowableCostChange,
public FiatAmount $newNonAttributableAllowableCost,
) {
}
}
4 changes: 2 additions & 2 deletions domain/src/Aggregates/TaxYear/Projections/TaxYearSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function capitalGain(): Attribute
{
return Attribute::make(
get: function (?string $value) {
$values = is_null($value) ? [] : json_decode($value, true);
$values = is_null($value) ? [] : json_decode($value, true, 512, JSON_THROW_ON_ERROR);

assert(is_array($values));

Expand All @@ -76,7 +76,7 @@ protected function capitalGain(): Attribute
proceeds: new FiatAmount($values['proceeds'] ?? '0', $this->currency),
);
},
set: fn (CapitalGain $value) => json_encode($value),
set: fn (CapitalGain $value) => json_encode($value, JSON_THROW_ON_ERROR),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
use Domain\ValueObjects\Transactions\Transaction;
use Domain\ValueObjects\Transactions\Transfer;

final class TransactionDispatcher implements TransactionDispatcherContract
final readonly class TransactionDispatcher implements TransactionDispatcherContract
{
public function __construct(
private readonly IncomeHandler $incomeHandler,
private readonly TransferHandler $transferHandler,
private readonly NonFungibleAssetHandler $nonFungibleAssetHandler,
private readonly SharePoolingAssetHandler $sharePoolingAssetHandler,
private IncomeHandler $incomeHandler,
private TransferHandler $transferHandler,
private NonFungibleAssetHandler $nonFungibleAssetHandler,
private SharePoolingAssetHandler $sharePoolingAssetHandler,
) {
}

Expand Down

0 comments on commit b6e4644

Please sign in to comment.