From 3af5daf8447b1c1167756de1d84d98a7082ca328 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 15:43:29 +0400 Subject: [PATCH 1/8] Resolve all the deprecations in tests --- phpunit.xml.dist | 6 ++++++ tests/Unit/Router/InvokeActivityTestCase.php | 1 + tests/Unit/Router/StartWorkflowTestCase.php | 2 ++ 3 files changed, 9 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c2b9b8b09..d9c16f1b2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,6 +9,12 @@ stopOnFailure="false" stopOnError="false" stderr="true" + displayDetailsOnIncompleteTests="true" + displayDetailsOnSkippedTests="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" > diff --git a/tests/Unit/Router/InvokeActivityTestCase.php b/tests/Unit/Router/InvokeActivityTestCase.php index 8bd1b8c58..972c9f66f 100644 --- a/tests/Unit/Router/InvokeActivityTestCase.php +++ b/tests/Unit/Router/InvokeActivityTestCase.php @@ -32,6 +32,7 @@ final class InvokeActivityTestCase extends AbstractUnit { private ServiceContainer $services; private InvokeActivity $router; + private ActivityContext $activityContext; protected function setUp(): void { diff --git a/tests/Unit/Router/StartWorkflowTestCase.php b/tests/Unit/Router/StartWorkflowTestCase.php index df068592f..e5e47c93a 100644 --- a/tests/Unit/Router/StartWorkflowTestCase.php +++ b/tests/Unit/Router/StartWorkflowTestCase.php @@ -37,6 +37,8 @@ final class StartWorkflowTestCase extends AbstractUnit { private ServiceContainer $services; private StartWorkflow $router; + private WorkflowContext $workflowContext; + private MarshallerInterface $marshaller; protected function setUp(): void { From 76129b1a27c705f78a8a255c089e5e3a4d7248a1 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 15:44:46 +0400 Subject: [PATCH 2/8] Fix deprecation on Service Client exception parsing --- src/Exception/Client/ServiceClientException.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Exception/Client/ServiceClientException.php b/src/Exception/Client/ServiceClientException.php index 9bad38e4a..e8c7eb9ae 100644 --- a/src/Exception/Client/ServiceClientException.php +++ b/src/Exception/Client/ServiceClientException.php @@ -31,7 +31,11 @@ public function __construct(\stdClass $status, \Throwable $previous = null) $this->status->mergeFromString($status->metadata['grpc-status-details-bin'][0]); } - parent::__construct($status->details . " (code: $status->code)", $status->code, $previous); + parent::__construct(\sprintf( + "%s (code: %d)", + isset($status->details) ? (string) $status->details : '', + $status->code, + ), $status->code, $previous); } public function getStatus(): Status From 6fc1cb93c72aff8c405f7ff6fe3b628a81d67ff1 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 15:45:43 +0400 Subject: [PATCH 3/8] Deprecate `Schedule\Spec\ScheduleSpec::$excludeCalendarList` and stop hydrating it in the related protobuf message --- src/Client/Schedule/Spec/ScheduleSpec.php | 2 ++ src/Internal/Mapper/ScheduleMapper.php | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Client/Schedule/Spec/ScheduleSpec.php b/src/Client/Schedule/Spec/ScheduleSpec.php index d1a688836..7f6268183 100644 --- a/src/Client/Schedule/Spec/ScheduleSpec.php +++ b/src/Client/Schedule/Spec/ScheduleSpec.php @@ -76,6 +76,8 @@ final class ScheduleSpec * Any timestamps matching any of exclude* will be skipped. * * @var list + * + * @deprecated */ #[MarshalArray(name: 'exclude_calendar', of: CalendarSpec::class)] public readonly array $excludeCalendarList; diff --git a/src/Internal/Mapper/ScheduleMapper.php b/src/Internal/Mapper/ScheduleMapper.php index bddb2317d..3a5fdd483 100644 --- a/src/Internal/Mapper/ScheduleMapper.php +++ b/src/Internal/Mapper/ScheduleMapper.php @@ -92,10 +92,7 @@ private function prepareSpec(array $result): ScheduleSpec $result['calendar'] ?? [], ); - $result['exclude_calendar'] = \array_map( - static fn(array $item): CalendarSpec => new CalendarSpec($item), - $result['exclude_calendar'] ?? [], - ); + unset($result['exclude_calendar']); $result['interval'] = \array_map( static fn(array $item): IntervalSpec => new IntervalSpec($item), From 8da10b01addb04a989fb0803a85558ba4e341e0c Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 15:57:45 +0400 Subject: [PATCH 4/8] Update psalm baseline --- psalm-baseline.xml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index b0bb1673b..2c82fdfb9 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -109,6 +109,12 @@ + + + excludeCalendarList]]> + excludeCalendarList]]> + + getSuccess()]]> @@ -508,7 +514,6 @@ - @@ -1218,10 +1223,6 @@ - - - - @@ -1367,11 +1368,6 @@ - - - - - getRelayAddress()]]> From 9d7225ca58ed84bb62fc308325ff7680c8ce4136 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 16:12:20 +0400 Subject: [PATCH 5/8] Deprecate `ScheduleSpec::withExcludeCalendarList()` and `ScheduleSpec::withAddedExcludeCalendar()` methods --- src/Client/Schedule/Spec/ScheduleSpec.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Client/Schedule/Spec/ScheduleSpec.php b/src/Client/Schedule/Spec/ScheduleSpec.php index 7f6268183..6b51b0d94 100644 --- a/src/Client/Schedule/Spec/ScheduleSpec.php +++ b/src/Client/Schedule/Spec/ScheduleSpec.php @@ -246,24 +246,25 @@ public function withAddedInterval(mixed $interval): self } /** - * Returns a new instance with the replaced exclude calendar list. + * Does nothing. + * + * @deprecated This method is deprecated and will be removed in the next major release. */ public function withExcludeCalendarList(CalendarSpec ...$calendar): self { - /** @see self::$excludeCalendarList */ - return $this->with('excludeCalendarList', $calendar); + @\trigger_error('ScheduleSpec::withExcludeCalendarList() is deprecated', E_USER_DEPRECATED); + return $this; } /** - * Any timestamps matching any of exclude* will be skipped. + * Does nothing. + * + * @deprecated This method is deprecated and will be removed in the next major release. */ public function withAddedExcludeCalendar(CalendarSpec $calendar): self { - $value = $this->excludeCalendarList; - $value[] = $calendar; - - /** @see self::$excludeCalendarList */ - return $this->with('excludeCalendarList', $value); + @\trigger_error('ScheduleSpec::withAddedExcludeCalendar() is deprecated', E_USER_DEPRECATED); + return $this; } /** From 3a564a93716f8156826e62cfe346be7540668de5 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 16:14:37 +0400 Subject: [PATCH 6/8] CI: run windows tests with protobuf ext only --- .github/workflows/run-test-suite.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-test-suite.yml b/.github/workflows/run-test-suite.yml index 2162c7a41..3abf00c31 100644 --- a/.github/workflows/run-test-suite.yml +++ b/.github/workflows/run-test-suite.yml @@ -48,17 +48,14 @@ jobs: fail-fast: ${{ inputs.fail-fast }} matrix: php: [ 8.1, 8.2, 8.3 ] - os: [ ubuntu-latest, windows-latest ] + os: [ ubuntu-latest ] extensions-suffix: [ '', ', protobuf' ] dependencies: [ lowest , highest ] timeout-minutes: [ '${{ inputs.test-timeout }}' ] - exclude: - - os: windows-latest - php: 8.2 + include: - os: windows-latest extensions-suffix: ', protobuf' - - os: windows-latest - php: 8.3 + php: 8.1 steps: - name: Set Git To Use LF run: | From ca4a595098a159eb53807865cce24319a246f28b Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 5 Nov 2024 16:17:42 +0400 Subject: [PATCH 7/8] Update psalm baseline --- psalm-baseline.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 2c82fdfb9..b45183d02 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -112,7 +112,6 @@ excludeCalendarList]]> - excludeCalendarList]]> From 9397729e9c7416663310fb6aef721e41b30410eb Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Thu, 7 Nov 2024 16:59:10 +0400 Subject: [PATCH 8/8] Revert some changes in ScheduleSpec and its mapper --- psalm-baseline.xml | 1 + src/Client/Schedule/Spec/ScheduleSpec.php | 14 ++++++++++---- src/Internal/Mapper/ScheduleMapper.php | 5 ++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index b45183d02..2c82fdfb9 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -112,6 +112,7 @@ excludeCalendarList]]> + excludeCalendarList]]> diff --git a/src/Client/Schedule/Spec/ScheduleSpec.php b/src/Client/Schedule/Spec/ScheduleSpec.php index 6b51b0d94..5e6c74047 100644 --- a/src/Client/Schedule/Spec/ScheduleSpec.php +++ b/src/Client/Schedule/Spec/ScheduleSpec.php @@ -246,25 +246,31 @@ public function withAddedInterval(mixed $interval): self } /** - * Does nothing. + * Returns a new instance with the replaced exclude calendar list. * * @deprecated This method is deprecated and will be removed in the next major release. */ public function withExcludeCalendarList(CalendarSpec ...$calendar): self { @\trigger_error('ScheduleSpec::withExcludeCalendarList() is deprecated', E_USER_DEPRECATED); - return $this; + + /** @see self::$excludeCalendarList */ + return $this->with('excludeCalendarList', $calendar); } /** - * Does nothing. + * Any timestamps matching any of exclude* will be skipped. * * @deprecated This method is deprecated and will be removed in the next major release. */ public function withAddedExcludeCalendar(CalendarSpec $calendar): self { @\trigger_error('ScheduleSpec::withAddedExcludeCalendar() is deprecated', E_USER_DEPRECATED); - return $this; + $value = $this->excludeCalendarList; + $value[] = $calendar; + + /** @see self::$excludeCalendarList */ + return $this->with('excludeCalendarList', $value); } /** diff --git a/src/Internal/Mapper/ScheduleMapper.php b/src/Internal/Mapper/ScheduleMapper.php index 3a5fdd483..bddb2317d 100644 --- a/src/Internal/Mapper/ScheduleMapper.php +++ b/src/Internal/Mapper/ScheduleMapper.php @@ -92,7 +92,10 @@ private function prepareSpec(array $result): ScheduleSpec $result['calendar'] ?? [], ); - unset($result['exclude_calendar']); + $result['exclude_calendar'] = \array_map( + static fn(array $item): CalendarSpec => new CalendarSpec($item), + $result['exclude_calendar'] ?? [], + ); $result['interval'] = \array_map( static fn(array $item): IntervalSpec => new IntervalSpec($item),