@@ -44,4 +44,179 @@ public function testDocBlockConstFixer(): void
4444 $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
4545 }
4646
47+ /**
48+ * Tests extends with PHP 8+ T_NAME_FULLY_QUALIFIED (parse() method fix).
49+ *
50+ * @return void
51+ */
52+ public function testExtendsSniffer (): void
53+ {
54+ $ this ->prefix = 'extends- ' ;
55+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
56+ $ this ->prefix = null ;
57+ }
58+
59+ /**
60+ * @return void
61+ */
62+ public function testExtendsFixer (): void
63+ {
64+ $ this ->prefix = 'extends- ' ;
65+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
66+ $ this ->prefix = null ;
67+ }
68+
69+ /**
70+ * Tests implements with PHP 8+ T_NAME_FULLY_QUALIFIED (parse() method fix).
71+ *
72+ * @return void
73+ */
74+ public function testImplementsSniffer (): void
75+ {
76+ $ this ->prefix = 'implements- ' ;
77+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
78+ $ this ->prefix = null ;
79+ }
80+
81+ /**
82+ * @return void
83+ */
84+ public function testImplementsFixer (): void
85+ {
86+ $ this ->prefix = 'implements- ' ;
87+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
88+ $ this ->prefix = null ;
89+ }
90+
91+ /**
92+ * Tests new keyword with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForNew() fix).
93+ *
94+ * @return void
95+ */
96+ public function testNewSniffer (): void
97+ {
98+ $ this ->prefix = 'new- ' ;
99+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
100+ $ this ->prefix = null ;
101+ }
102+
103+ /**
104+ * @return void
105+ */
106+ public function testNewFixer (): void
107+ {
108+ $ this ->prefix = 'new- ' ;
109+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
110+ $ this ->prefix = null ;
111+ }
112+
113+ /**
114+ * Tests static call with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForStatic() fix).
115+ *
116+ * @return void
117+ */
118+ public function testStaticSniffer (): void
119+ {
120+ $ this ->prefix = 'static- ' ;
121+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
122+ $ this ->prefix = null ;
123+ }
124+
125+ /**
126+ * @return void
127+ */
128+ public function testStaticFixer (): void
129+ {
130+ $ this ->prefix = 'static- ' ;
131+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
132+ $ this ->prefix = null ;
133+ }
134+
135+ /**
136+ * Tests instanceof with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForInstanceOf() fix).
137+ *
138+ * @return void
139+ */
140+ public function testInstanceofSniffer (): void
141+ {
142+ $ this ->prefix = 'instanceof- ' ;
143+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
144+ $ this ->prefix = null ;
145+ }
146+
147+ /**
148+ * @return void
149+ */
150+ public function testInstanceofFixer (): void
151+ {
152+ $ this ->prefix = 'instanceof- ' ;
153+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
154+ $ this ->prefix = null ;
155+ }
156+
157+ /**
158+ * Tests catch with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForCatchOrCallable() fix).
159+ *
160+ * @return void
161+ */
162+ public function testCatchSniffer (): void
163+ {
164+ $ this ->prefix = 'catch- ' ;
165+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
166+ $ this ->prefix = null ;
167+ }
168+
169+ /**
170+ * @return void
171+ */
172+ public function testCatchFixer (): void
173+ {
174+ $ this ->prefix = 'catch- ' ;
175+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
176+ $ this ->prefix = null ;
177+ }
178+
179+ /**
180+ * Tests parameter type with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForSignature() fix).
181+ *
182+ * @return void
183+ */
184+ public function testParamSniffer (): void
185+ {
186+ $ this ->prefix = 'param- ' ;
187+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
188+ $ this ->prefix = null ;
189+ }
190+
191+ /**
192+ * @return void
193+ */
194+ public function testParamFixer (): void
195+ {
196+ $ this ->prefix = 'param- ' ;
197+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
198+ $ this ->prefix = null ;
199+ }
200+
201+ /**
202+ * Tests return type with PHP 8+ T_NAME_FULLY_QUALIFIED (checkUseForReturnTypeHint() fix).
203+ *
204+ * @return void
205+ */
206+ public function testReturnSniffer (): void
207+ {
208+ $ this ->prefix = 'return- ' ;
209+ $ this ->assertSnifferFindsErrors (new UseStatementSniff (), 1 );
210+ $ this ->prefix = null ;
211+ }
212+
213+ /**
214+ * @return void
215+ */
216+ public function testReturnFixer (): void
217+ {
218+ $ this ->prefix = 'return- ' ;
219+ $ this ->assertSnifferCanFixErrors (new UseStatementSniff ());
220+ $ this ->prefix = null ;
221+ }
47222}
0 commit comments