Skip to content

Commit 8e6fabe

Browse files
committed
refactor: adjust attribute declarations for NamedArgumentConstructor compatibility
- Updated attribute declarations across Workflow and Activity classes for better compatibility with `NamedArgumentConstructor`. - Removed unnecessary property and constructor in `LocalActivityInterface`. - Updated `psalm-baseline.xml` to reflect changes and deprecations.
1 parent 2195267 commit 8e6fabe

12 files changed

Lines changed: 67 additions & 33 deletions

psalm-baseline.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
3+
<file src="src/Activity/ActivityInterface.php">
4+
<DeprecatedClass>
5+
<code><![CDATA[NamedArgumentConstructor]]></code>
6+
</DeprecatedClass>
7+
</file>
8+
<file src="src/Activity/ActivityMethod.php">
9+
<DeprecatedClass>
10+
<code><![CDATA[NamedArgumentConstructor]]></code>
11+
</DeprecatedClass>
12+
</file>
13+
<file src="src/Activity/LocalActivityInterface.php">
14+
<DeprecatedClass>
15+
<code><![CDATA[NamedArgumentConstructor]]></code>
16+
</DeprecatedClass>
17+
</file>
318
<file src="src/Client/ActivityCompletionClientInterface.php">
419
<MissingParamType>
520
<code><![CDATA[$details]]></code>
@@ -1365,6 +1380,46 @@
13651380
<code><![CDATA[getUpdateContext]]></code>
13661381
</UndefinedInterfaceMethod>
13671382
</file>
1383+
<file src="src/Workflow/QueryMethod.php">
1384+
<DeprecatedClass>
1385+
<code><![CDATA[NamedArgumentConstructor]]></code>
1386+
</DeprecatedClass>
1387+
</file>
1388+
<file src="src/Workflow/ReturnType.php">
1389+
<DeprecatedClass>
1390+
<code><![CDATA[NamedArgumentConstructor]]></code>
1391+
</DeprecatedClass>
1392+
</file>
1393+
<file src="src/Workflow/SignalMethod.php">
1394+
<DeprecatedClass>
1395+
<code><![CDATA[NamedArgumentConstructor]]></code>
1396+
</DeprecatedClass>
1397+
</file>
1398+
<file src="src/Workflow/UpdateMethod.php">
1399+
<DeprecatedClass>
1400+
<code><![CDATA[NamedArgumentConstructor]]></code>
1401+
</DeprecatedClass>
1402+
</file>
1403+
<file src="src/Workflow/UpdateValidatorMethod.php">
1404+
<DeprecatedClass>
1405+
<code><![CDATA[NamedArgumentConstructor]]></code>
1406+
</DeprecatedClass>
1407+
</file>
1408+
<file src="src/Workflow/WorkflowInterface.php">
1409+
<DeprecatedClass>
1410+
<code><![CDATA[NamedArgumentConstructor]]></code>
1411+
</DeprecatedClass>
1412+
</file>
1413+
<file src="src/Workflow/WorkflowMethod.php">
1414+
<DeprecatedClass>
1415+
<code><![CDATA[NamedArgumentConstructor]]></code>
1416+
</DeprecatedClass>
1417+
</file>
1418+
<file src="src/Workflow/WorkflowVersioningBehavior.php">
1419+
<DeprecatedClass>
1420+
<code><![CDATA[NamedArgumentConstructor]]></code>
1421+
</DeprecatedClass>
1422+
</file>
13681423
<file src="testing/src/Downloader.php">
13691424
<PossiblyUndefinedStringArrayOffset>
13701425
<code><![CDATA[$asset['browser_download_url']]]></code>

src/Activity/ActivityInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @NamedArgumentConstructor
3333
* @Target({ "CLASS" })
3434
*/
35-
#[\Attribute(\Attribute::TARGET_CLASS)]
35+
#[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor]
3636
class ActivityInterface
3737
{
3838
/**

src/Activity/ActivityMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @NamedArgumentConstructor
2121
* @Target({ "METHOD" })
2222
*/
23-
#[\Attribute(\Attribute::TARGET_METHOD)]
23+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
2424
final class ActivityMethod
2525
{
2626
/**

src/Activity/LocalActivityInterface.php

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Temporal\Activity;
1313

1414
use Doctrine\Common\Annotations\Annotation\Target;
15-
use JetBrains\PhpStorm\Immutable;
1615
use Spiral\Attributes\NamedArgumentConstructor;
1716

1817
/**
@@ -32,25 +31,5 @@
3231
* @NamedArgumentConstructor
3332
* @Target({ "CLASS" })
3433
*/
35-
#[\Attribute(\Attribute::TARGET_CLASS)]
36-
final class LocalActivityInterface extends ActivityInterface
37-
{
38-
/**
39-
* Prefix to prepend to method names to generate activity types. Default is
40-
* empty string which means that method names are used as activity types.
41-
*
42-
* Note that this value is ignored if a name of an activity is specified
43-
* explicitly through {@see ActivityMethod::$name}.
44-
*
45-
* Be careful about names that contain special characters. These names can
46-
* be used as metric tags. And systems like prometheus ignore metrics which
47-
* have tags with unsupported characters.
48-
*/
49-
#[Immutable]
50-
public string $prefix = '';
51-
52-
public function __construct(string $prefix = '')
53-
{
54-
$this->prefix = $prefix;
55-
}
56-
}
34+
#[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor]
35+
final class LocalActivityInterface extends ActivityInterface {}

src/Workflow/QueryMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @NamedArgumentConstructor
2727
* @Target({ "METHOD" })
2828
*/
29-
#[\Attribute(\Attribute::TARGET_METHOD)]
29+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
3030
final class QueryMethod
3131
{
3232
/**

src/Workflow/ReturnType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @NamedArgumentConstructor
2121
* @Target({ "METHOD" })
2222
*/
23-
#[\Attribute(\Attribute::TARGET_METHOD)]
23+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
2424
final class ReturnType
2525
{
2626
public const TYPE_ANY = Type::TYPE_ANY;

src/Workflow/SignalMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @NamedArgumentConstructor
2424
* @Target({ "METHOD" })
2525
*/
26-
#[\Attribute(\Attribute::TARGET_METHOD)]
26+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
2727
final class SignalMethod
2828
{
2929
/**

src/Workflow/UpdateMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @NamedArgumentConstructor
2323
* @Target({ "METHOD" })
2424
*/
25-
#[\Attribute(\Attribute::TARGET_METHOD)]
25+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
2626
final class UpdateMethod
2727
{
2828
/**

src/Workflow/UpdateValidatorMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @NamedArgumentConstructor
2424
* @Target({ "METHOD" })
2525
*/
26-
#[\Attribute(\Attribute::TARGET_METHOD)]
26+
#[\Attribute(\Attribute::TARGET_METHOD), NamedArgumentConstructor]
2727
final class UpdateValidatorMethod
2828
{
2929
/**

src/Workflow/WorkflowInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
* You can use this method to help with memory management by breaking circular references.
2929
* Note: the Workflow logger may not emit logs from within the destroy method.
3030
*/
31-
#[\Attribute(\Attribute::TARGET_CLASS)]
31+
#[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor]
3232
class WorkflowInterface {}

0 commit comments

Comments
 (0)