1
1
<?php
2
-
3
- declare (strict_types=1 );
4
-
5
2
/**
6
3
* Copyright © Magento, Inc. All rights reserved.
7
4
* See COPYING.txt for license details.
8
5
*/
9
-
6
+
10
7
use Magento \FunctionalTestingFramework \Module \MagentoSequence ;
11
8
12
9
if (!function_exists ('msq ' )) {
13
10
/**
14
11
* Return unique sequence within test.
15
12
*
16
- * @param int|string| null $id Optional identifier for the sequence.
17
- * @return string The generated unique sequence.
13
+ * @param null $id
14
+ * @return string
18
15
*/
19
- function msq (int |string |null $ id = null ): string
16
+ function msq (int |string |null $ id = null )
20
17
{
21
- if ($ id !== null && isset (MagentoSequence::$ hash [$ id ])) {
18
+ if ($ id and isset (MagentoSequence::$ hash [$ id ])) {
22
19
return MagentoSequence::$ hash [$ id ];
23
20
}
24
-
25
- $ prefix = MagentoSequence::$ prefix ?? '' ;
26
- $ sequence = $ prefix . uniqid ('' , true ); // Use true for high-entropy ID
27
-
28
- if ($ id !== null ) {
29
- MagentoSequence::$ hash [$ id ] = $ sequence ; // Avoid dynamic properties
21
+ $ prefix = MagentoSequence::$ prefix ;
22
+ $ sequence = $ prefix . uniqid ();
23
+ if ($ id ) {
24
+ MagentoSequence::$ hash [$ id ] = $ sequence ;
30
25
}
31
-
32
26
return $ sequence ;
33
27
}
34
28
}
@@ -37,22 +31,19 @@ function msq(int|string|null $id = null): string
37
31
/**
38
32
* Return unique sequence within suite.
39
33
*
40
- * @param int|string| null $id Optional identifier for the suite sequence.
41
- * @return string The generated unique suite sequence.
34
+ * @param null $id
35
+ * @return string
42
36
*/
43
- function msqs (int |string |null $ id = null ): string
37
+ function msqs (int |string |null $ id = null )
44
38
{
45
- if ($ id !== null && isset (MagentoSequence::$ suiteHash [$ id ])) {
39
+ if ($ id and isset (MagentoSequence::$ suiteHash [$ id ])) {
46
40
return MagentoSequence::$ suiteHash [$ id ];
47
41
}
48
-
49
- $ prefix = MagentoSequence::$ prefix ?? '' ;
50
- $ sequence = $ prefix . uniqid ('' , true ); // Use true for high-entropy ID
51
-
52
- if ($ id !== null ) {
53
- MagentoSequence::$ suiteHash [$ id ] = $ sequence ; // Avoid dynamic properties
42
+ $ prefix = MagentoSequence::$ prefix ;
43
+ $ sequence = $ prefix . uniqid ();
44
+ if ($ id ) {
45
+ MagentoSequence::$ suiteHash [$ id ] = $ sequence ;
54
46
}
55
-
56
47
return $ sequence ;
57
48
}
58
49
}
0 commit comments