Skip to content

Commit 9397729

Browse files
committed
Revert some changes in ScheduleSpec and its mapper
1 parent ca4a595 commit 9397729

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

psalm-baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
<file src="src/Client/Schedule/Spec/ScheduleSpec.php">
113113
<DeprecatedProperty>
114114
<code><![CDATA[$this->excludeCalendarList]]></code>
115+
<code><![CDATA[$this->excludeCalendarList]]></code>
115116
</DeprecatedProperty>
116117
</file>
117118
<file src="src/Client/Update/UpdateHandle.php">

src/Client/Schedule/Spec/ScheduleSpec.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,25 +246,31 @@ public function withAddedInterval(mixed $interval): self
246246
}
247247

248248
/**
249-
* Does nothing.
249+
* Returns a new instance with the replaced exclude calendar list.
250250
*
251251
* @deprecated This method is deprecated and will be removed in the next major release.
252252
*/
253253
public function withExcludeCalendarList(CalendarSpec ...$calendar): self
254254
{
255255
@\trigger_error('ScheduleSpec::withExcludeCalendarList() is deprecated', E_USER_DEPRECATED);
256-
return $this;
256+
257+
/** @see self::$excludeCalendarList */
258+
return $this->with('excludeCalendarList', $calendar);
257259
}
258260

259261
/**
260-
* Does nothing.
262+
* Any timestamps matching any of exclude* will be skipped.
261263
*
262264
* @deprecated This method is deprecated and will be removed in the next major release.
263265
*/
264266
public function withAddedExcludeCalendar(CalendarSpec $calendar): self
265267
{
266268
@\trigger_error('ScheduleSpec::withAddedExcludeCalendar() is deprecated', E_USER_DEPRECATED);
267-
return $this;
269+
$value = $this->excludeCalendarList;
270+
$value[] = $calendar;
271+
272+
/** @see self::$excludeCalendarList */
273+
return $this->with('excludeCalendarList', $value);
268274
}
269275

270276
/**

src/Internal/Mapper/ScheduleMapper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ private function prepareSpec(array $result): ScheduleSpec
9292
$result['calendar'] ?? [],
9393
);
9494

95-
unset($result['exclude_calendar']);
95+
$result['exclude_calendar'] = \array_map(
96+
static fn(array $item): CalendarSpec => new CalendarSpec($item),
97+
$result['exclude_calendar'] ?? [],
98+
);
9699

97100
$result['interval'] = \array_map(
98101
static fn(array $item): IntervalSpec => new IntervalSpec($item),

0 commit comments

Comments
 (0)