Skip to content

Commit fe67be7

Browse files
committed
rerun CI
1 parent 41970f3 commit fe67be7

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use function count;
2424
use function in_array;
2525
use function strtolower;
26+
use function preg_match;
2627

2728
/**
2829
* @internal
@@ -309,7 +310,7 @@ public static function getTypeHintFromOneType(
309310

310311
// 'class-string', 'trait-string', 'callable-string', 'numeric-string', 'non-empty-string', 'non-falsy-string', 'literal-string',...
311312
// see https://psalm.dev/docs/annotating_code/type_syntax/scalar_types/#class-string-interface-string
312-
if (preg_match('/-string$/', strtolower($typeNode->name))) {
313+
if ((bool) preg_match('/-string$/', strtolower($typeNode->name))) {
313314
return 'string';
314315
}
315316

SlevomatCodingStandard/Helpers/TypeHintHelper.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use function count;
1414
use function implode;
1515
use function in_array;
16+
use function preg_match;
1617
use function preg_split;
1718
use function sort;
1819
use function sprintf;
@@ -170,6 +171,7 @@ public static function isSimpleUnofficialTypeHints(string $typeHint): bool
170171
static $simpleUnofficialTypeHints;
171172

172173
if ($simpleUnofficialTypeHints === null) {
174+
// see https://psalm.dev/docs/annotating_code/type_syntax/atomic_types/
173175
$simpleUnofficialTypeHints = [
174176
'null',
175177
'mixed',
@@ -180,15 +182,10 @@ public static function isSimpleUnofficialTypeHints(string $typeHint): bool
180182
'resource',
181183
'static',
182184
'$this',
183-
'class-string',
184-
'trait-string',
185-
'callable-string',
186-
'numeric-string',
187-
'non-empty-string',
188-
'non-falsy-string',
189-
'literal-string',
190185
'array-key',
191186
'list',
187+
'non-empty-array',
188+
'non-empty-list',
192189
'empty',
193190
'positive-int',
194191
'negative-int',
@@ -197,7 +194,7 @@ public static function isSimpleUnofficialTypeHints(string $typeHint): bool
197194
];
198195
}
199196

200-
return in_array($typeHint, $simpleUnofficialTypeHints, true);
197+
return in_array($typeHint, $simpleUnofficialTypeHints, true) || preg_match('/-string$/', $typeHint);
201198
}
202199

203200
/**

0 commit comments

Comments
 (0)