Skip to content

Commit 150660a

Browse files
chore: intuitively order union types
1 parent 47e2824 commit 150660a

File tree

20 files changed

+106
-100
lines changed

20 files changed

+106
-100
lines changed

.php-cs-fixer.dist.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@
77
return (new Config())
88
->setParallelConfig(ParallelConfigFactory::detect())
99
->setFinder(Finder::create()->in([__DIR__.'/src', __DIR__.'/tests']))
10-
->setRules(['@PhpCsFixer' => true, 'phpdoc_align' => false, 'new_with_parentheses' => ['named_class' => false]])
10+
->setRules([
11+
'@PhpCsFixer' => true,
12+
'phpdoc_align' => false,
13+
'new_with_parentheses' => ['named_class' => false],
14+
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
15+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
16+
])
1117
;

src/CasGenerator/CasGeneratorGenerateCasParams.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ final class CasGeneratorGenerateCasParams implements BaseModel
5555
/**
5656
* CAS authority to generate the document from (currently only kfintech is supported).
5757
*
58-
* @var null|CasAuthority::* $casAuthority
58+
* @var CasAuthority::*|null $casAuthority
5959
*/
6060
#[Api('cas_authority', enum: CasAuthority::class, optional: true)]
6161
public ?string $casAuthority;
@@ -97,7 +97,7 @@ public function __construct()
9797
*
9898
* You must use named parameters to construct any parameters with a default value.
9999
*
100-
* @param null|CasAuthority::* $casAuthority
100+
* @param CasAuthority::*|null $casAuthority
101101
*/
102102
public static function with(
103103
string $email,

src/CasParser/UnifiedResponse.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class UnifiedResponse implements BaseModel
2929
{
3030
use SdkModel;
3131

32-
/** @var null|list<DematAccount> $dematAccounts */
32+
/** @var list<DematAccount>|null $dematAccounts */
3333
#[Api(
3434
'demat_accounts',
3535
type: new ListOf(DematAccount::class),
@@ -46,7 +46,7 @@ final class UnifiedResponse implements BaseModel
4646
#[Api(optional: true)]
4747
public ?Meta $meta;
4848

49-
/** @var null|list<MutualFund> $mutualFunds */
49+
/** @var list<MutualFund>|null $mutualFunds */
5050
#[Api('mutual_funds', type: new ListOf(MutualFund::class), optional: true)]
5151
public ?array $mutualFunds;
5252

@@ -64,8 +64,8 @@ public function __construct()
6464
*
6565
* You must use named parameters to construct any parameters with a default value.
6666
*
67-
* @param null|list<DematAccount> $dematAccounts
68-
* @param null|list<MutualFund> $mutualFunds
67+
* @param list<DematAccount>|null $dematAccounts
68+
* @param list<MutualFund>|null $mutualFunds
6969
*/
7070
public static function with(
7171
?array $dematAccounts = null,

src/CasParser/UnifiedResponse/DematAccount.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final class DematAccount implements BaseModel
4848
/**
4949
* Type of demat account.
5050
*
51-
* @var null|DematType::* $dematType
51+
* @var DematType::*|null $dematType
5252
*/
5353
#[Api('demat_type', enum: DematType::class, optional: true)]
5454
public ?string $dematType;
@@ -85,7 +85,7 @@ public function __construct()
8585
*
8686
* You must use named parameters to construct any parameters with a default value.
8787
*
88-
* @param null|DematType::* $dematType
88+
* @param DematType::*|null $dematType
8989
*/
9090
public static function with(
9191
?AdditionalInfo $additionalInfo = null,

src/CasParser/UnifiedResponse/DematAccount/AdditionalInfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final class AdditionalInfo implements BaseModel
6060
/**
6161
* List of linked PAN numbers (NSDL).
6262
*
63-
* @var null|list<string> $linkedPans
63+
* @var list<string>|null $linkedPans
6464
*/
6565
#[Api('linked_pans', type: new ListOf('string'), optional: true)]
6666
public ?array $linkedPans;
@@ -88,7 +88,7 @@ public function __construct()
8888
*
8989
* You must use named parameters to construct any parameters with a default value.
9090
*
91-
* @param null|list<string> $linkedPans
91+
* @param list<string>|null $linkedPans
9292
*/
9393
public static function with(
9494
?string $boStatus = null,

src/CasParser/UnifiedResponse/DematAccount/Holdings.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ final class Holdings implements BaseModel
2727
{
2828
use SdkModel;
2929

30-
/** @var null|list<Aif> $aifs */
30+
/** @var list<Aif>|null $aifs */
3131
#[Api(type: new ListOf(Aif::class), optional: true)]
3232
public ?array $aifs;
3333

34-
/** @var null|list<CorporateBond> $corporateBonds */
34+
/** @var list<CorporateBond>|null $corporateBonds */
3535
#[Api(
3636
'corporate_bonds',
3737
type: new ListOf(CorporateBond::class),
3838
optional: true
3939
)]
4040
public ?array $corporateBonds;
4141

42-
/** @var null|list<DematMutualFund> $dematMutualFunds */
42+
/** @var list<DematMutualFund>|null $dematMutualFunds */
4343
#[Api(
4444
'demat_mutual_funds',
4545
type: new ListOf(DematMutualFund::class),
4646
optional: true,
4747
)]
4848
public ?array $dematMutualFunds;
4949

50-
/** @var null|list<Equity> $equities */
50+
/** @var list<Equity>|null $equities */
5151
#[Api(type: new ListOf(Equity::class), optional: true)]
5252
public ?array $equities;
5353

54-
/** @var null|list<GovernmentSecurity> $governmentSecurities */
54+
/** @var list<GovernmentSecurity>|null $governmentSecurities */
5555
#[Api(
5656
'government_securities',
5757
type: new ListOf(GovernmentSecurity::class),
@@ -70,11 +70,11 @@ public function __construct()
7070
*
7171
* You must use named parameters to construct any parameters with a default value.
7272
*
73-
* @param null|list<Aif> $aifs
74-
* @param null|list<CorporateBond> $corporateBonds
75-
* @param null|list<DematMutualFund> $dematMutualFunds
76-
* @param null|list<Equity> $equities
77-
* @param null|list<GovernmentSecurity> $governmentSecurities
73+
* @param list<Aif>|null $aifs
74+
* @param list<CorporateBond>|null $corporateBonds
75+
* @param list<DematMutualFund>|null $dematMutualFunds
76+
* @param list<Equity>|null $equities
77+
* @param list<GovernmentSecurity>|null $governmentSecurities
7878
*/
7979
public static function with(
8080
?array $aifs = null,

src/CasParser/UnifiedResponse/Insurance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class Insurance implements BaseModel
1919
{
2020
use SdkModel;
2121

22-
/** @var null|list<LifeInsurancePolicy> $lifeInsurancePolicies */
22+
/** @var list<LifeInsurancePolicy>|null $lifeInsurancePolicies */
2323
#[Api(
2424
'life_insurance_policies',
2525
type: new ListOf(LifeInsurancePolicy::class),
@@ -38,7 +38,7 @@ public function __construct()
3838
*
3939
* You must use named parameters to construct any parameters with a default value.
4040
*
41-
* @param null|list<LifeInsurancePolicy> $lifeInsurancePolicies
41+
* @param list<LifeInsurancePolicy>|null $lifeInsurancePolicies
4242
*/
4343
public static function with(?array $lifeInsurancePolicies = null): self
4444
{

src/CasParser/UnifiedResponse/Meta.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class Meta implements BaseModel
2424
/**
2525
* Type of CAS detected and processed.
2626
*
27-
* @var null|CasType::* $casType
27+
* @var CasType::*|null $casType
2828
*/
2929
#[Api('cas_type', enum: CasType::class, optional: true)]
3030
public ?string $casType;
@@ -49,7 +49,7 @@ public function __construct()
4949
*
5050
* You must use named parameters to construct any parameters with a default value.
5151
*
52-
* @param null|CasType::* $casType
52+
* @param CasType::*|null $casType
5353
*/
5454
public static function with(
5555
?string $casType = null,

src/CasParser/UnifiedResponse/MutualFund.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class MutualFund implements BaseModel
4949
#[Api(optional: true)]
5050
public ?string $registrar;
5151

52-
/** @var null|list<Scheme> $schemes */
52+
/** @var list<Scheme>|null $schemes */
5353
#[Api(type: new ListOf(Scheme::class), optional: true)]
5454
public ?array $schemes;
5555

@@ -70,7 +70,7 @@ public function __construct()
7070
*
7171
* You must use named parameters to construct any parameters with a default value.
7272
*
73-
* @param null|list<Scheme> $schemes
73+
* @param list<Scheme>|null $schemes
7474
*/
7575
public static function with(
7676
?AdditionalInfo $additionalInfo = null,

src/CasParser/UnifiedResponse/MutualFund/Scheme.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ final class Scheme implements BaseModel
6868
/**
6969
* List of nominees.
7070
*
71-
* @var null|list<string> $nominees
71+
* @var list<string>|null $nominees
7272
*/
7373
#[Api(type: new ListOf('string'), optional: true)]
7474
public ?array $nominees;
7575

76-
/** @var null|list<Transaction> $transactions */
76+
/** @var list<Transaction>|null $transactions */
7777
#[Api(type: new ListOf(Transaction::class), optional: true)]
7878
public ?array $transactions;
7979

8080
/**
8181
* Type of mutual fund scheme.
8282
*
83-
* @var null|Type::* $type
83+
* @var Type::*|null $type
8484
*/
8585
#[Api(enum: Type::class, optional: true)]
8686
public ?string $type;
@@ -108,9 +108,9 @@ public function __construct()
108108
*
109109
* You must use named parameters to construct any parameters with a default value.
110110
*
111-
* @param null|list<string> $nominees
112-
* @param null|list<Transaction> $transactions
113-
* @param null|Type::* $type
111+
* @param list<string>|null $nominees
112+
* @param list<Transaction>|null $transactions
113+
* @param Type::*|null $type
114114
*/
115115
public static function with(
116116
?AdditionalInfo $additionalInfo = null,

0 commit comments

Comments
 (0)