Skip to content

Commit 6780edc

Browse files
Merge pull request #90 from VincentLanglet/fixUnused
🐛 Another fix
2 parents 464981a + 91ccea8 commit 6780edc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

SymfonyCustom/Sniffs/Namespaces/UnusedUseSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private function isClassUsed(File $phpcsFile, int $usePtr, int $classPtr): bool
311311
|| ('class' === $type
312312
&& ((T_DOC_COMMENT_STRING === $tokens[$classUsed]['code']
313313
&& preg_match(
314-
'/(\s|\||\(|^)'.preg_quote($searchName, '/').'(\s|\||\\\\|<|$|\[\])/i',
314+
'/(\s|\||\(|\<|\,|^)'.preg_quote($searchName, '/').'(\s|\||\\\\|\<|\,|\>|$|\[\])/i',
315315
$tokens[$classUsed]['content']
316316
))
317317
|| (T_DOC_COMMENT_TAG === $tokens[$classUsed]['code']

SymfonyCustom/Tests/Namespaces/UnusedUseUnitTest.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ new MyClass3();
135135
namespace BugCollection;
136136

137137
use Doctrine\Collection;
138+
use Doctrine\Value;
139+
use Doctrine\Key;
138140

139141
/**
140-
* @param Collection<int, \Client> $a
142+
* @param Collection<Key, Value> $a
141143
*
142144
* @return null
143145
*/

SymfonyCustom/Tests/Namespaces/UnusedUseUnitTest.inc.fixed

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ new MyClass3();
122122
namespace BugCollection;
123123

124124
use Doctrine\Collection;
125+
use Doctrine\Value;
126+
use Doctrine\Key;
125127

126128
/**
127-
* @param Collection<int, \Client> $a
129+
* @param Collection<Key, Value> $a
128130
*
129131
* @return null
130132
*/

0 commit comments

Comments
 (0)