Skip to content

Commit

Permalink
Fix wrongly typed constructor argument of class Calendar
Browse files Browse the repository at this point in the history
Fixes #281
  • Loading branch information
markuspoerschke committed Sep 28, 2021
1 parent 3b369b5 commit 3b0dab3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- PHPStan complains about wrongly typed hinted constructor argument of `Calendar` class. [#281](https://github.com/markuspoerschke/iCal/issues/281)

## [2.3.0] - 2021-08-24

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Collection/EventsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
final class EventsArray extends Events
{
/**
* @var Event[]
* @var array<int, Event>
*/
private array $events = [];

/**
* @param Event[] $events
* @param array<array-key, Event> $events
*/
public function __construct(array $events)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Entity/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class Calendar
private array $timeZones = [];

/**
* @param Event[]|Iterator<Event>|Events $events
* @param array<array-key, Event>|Iterator<Event>|Events $events
*/
public function __construct($events = [])
{
$this->events = $this->ensureEventsObject($events);
}

/**
* @param Event[]|Iterator<Event>|Events $events
* @param array<array-key, Event>|Iterator<Event>|Events $events
*/
private function ensureEventsObject($events = []): Events
{
Expand Down

0 comments on commit 3b0dab3

Please sign in to comment.