File tree Expand file tree Collapse file tree 4 files changed +11
-32
lines changed Expand file tree Collapse file tree 4 files changed +11
-32
lines changed Original file line number Diff line number Diff line change 20
20
"brick/money" : " ^0.10.0"
21
21
},
22
22
"require-dev" : {
23
- "friendsofphp/php-cs-fixer" : " ^3.69" ,
23
+ "friendsofphp/php-cs-fixer" : " ^3.69.1 " ,
24
24
"infection/infection" : " ^0.29.12" ,
25
25
"maglnet/composer-require-checker" : " ^4.16.1" ,
26
26
"phpunit/phpunit" : " ^12.0.3" ,
27
- "rector/rector" : " ^2.0" ,
28
- "vimeo/psalm" : " ^6.8"
27
+ "rector/rector" : " ^2.0.9 " ,
28
+ "vimeo/psalm" : " ^6.8.4 "
29
29
},
30
30
"config" : {
31
31
"sort-packages" : true ,
Original file line number Diff line number Diff line change 8
8
9
9
final class Account
10
10
{
11
- private const int NAME_CHARS_LIMIT = 50 ;
12
-
13
11
/**
14
12
* @psalm-var non-empty-string|null
15
13
*/
@@ -51,22 +49,10 @@ public function rename(?string $name): void
51
49
$ this ->setName ($ name );
52
50
}
53
51
54
- /**
55
- * @pslam-param non-empty-string|null $name
56
- */
57
52
private function setName (?string $ name ): void
58
53
{
59
- if ($ name !== null ) {
60
- $ length = mb_strlen ($ name );
61
- if ($ length === 0 || $ length > self ::NAME_CHARS_LIMIT ) {
62
- throw new InvalidArgumentException (
63
- sprintf (
64
- 'Account name must be null or non-empty string no greater than %d symbols. ' ,
65
- self ::NAME_CHARS_LIMIT ,
66
- ),
67
- );
68
- }
69
- /** @psalm-var non-empty-string $name */
54
+ if ($ name === '' ) {
55
+ throw new InvalidArgumentException ('Account name must be null or non-empty string. ' );
70
56
}
71
57
72
58
$ this ->name = $ name ;
Original file line number Diff line number Diff line change 6
6
7
7
final class AccountFilter
8
8
{
9
- private ?AccountChartId $ accountChartId = null ;
9
+ public function __construct (
10
+ private ?AccountChartId $ accountChartId = null ,
11
+ ) {}
10
12
11
13
public function getAccountChartId (): ?AccountChartId
12
14
{
Original file line number Diff line number Diff line change @@ -33,22 +33,13 @@ public function testRename(string $name): void
33
33
$ this ->assertSame ($ name , $ account ->getName ());
34
34
}
35
35
36
- public static function dataInvalidRename (): array
37
- {
38
- return [
39
- 'empty-string ' => ['' ],
40
- 'long-string ' => [str_repeat ('. ' , 51 )],
41
- ];
42
- }
43
-
44
- #[DataProvider('dataInvalidRename ' )]
45
- public function testInvalidRename (string $ name ): void
36
+ public function testRenameToEmptyString (): void
46
37
{
47
38
$ account = TestFactory::createAccount ();
48
39
49
40
$ this ->expectException (InvalidArgumentException::class);
50
- $ this ->expectExceptionMessage ('Account name must be null or non-empty string no greater than 50 symbols . ' );
51
- $ account ->rename ($ name );
41
+ $ this ->expectExceptionMessage ('Account name must be null or non-empty string. ' );
42
+ $ account ->rename ('' );
52
43
}
53
44
54
45
public function testCreateAccountWithParentFromAnotherChart (): void
You can’t perform that action at this time.
0 commit comments