Skip to content

Commit d8a1567

Browse files
committed
Cleanup codes. Level 5
1 parent b1817bc commit d8a1567

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

tests/SmokeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function testLinterInstanceIsObject(): void
9797
*
9898
* @return void
9999
*/
100-
public function testCliInclusion()
100+
public function testCliInclusion(): void
101101
{
102102
try {
103103
$argv = ['--help'];

tests/Unit/Exceptions/LinterExceptionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class LinterExceptionTest extends TestCase
2121
*
2222
* @return void
2323
*/
24-
public function testBasicException()
24+
public function testBasicException(): void
2525
{
2626
$exception = new LinterException('Test message', 123);
2727
$this->assertEquals('Test message', $exception->getMessage());
@@ -37,7 +37,7 @@ public function testBasicException()
3737
*
3838
* @return void
3939
*/
40-
public function testExceptionWithContext()
40+
public function testExceptionWithContext(): void
4141
{
4242
$exception = new LinterException('Test message', 0, null, 'Additional context');
4343
$this->assertEquals('Additional context', $exception->getContext());
@@ -52,7 +52,7 @@ public function testExceptionWithContext()
5252
*
5353
* @return void
5454
*/
55-
public function testFileAccessErrorFactory()
55+
public function testFileAccessErrorFactory(): void
5656
{
5757
$exception = LinterException::fileAccessError('/path/to/file.php');
5858
$this->assertEquals(
@@ -74,7 +74,7 @@ public function testFileAccessErrorFactory()
7474
*
7575
* @return void
7676
*/
77-
public function testParsingErrorFactory()
77+
public function testParsingErrorFactory(): void
7878
{
7979
$exception = LinterException::parsingError('/path/to/file.php', 'Syntax error');
8080
$this->assertEquals(
@@ -96,7 +96,7 @@ public function testParsingErrorFactory()
9696
*
9797
* @return void
9898
*/
99-
public function testInvalidRuleFactory()
99+
public function testInvalidRuleFactory(): void
100100
{
101101
$exception = LinterException::invalidRule('bad_rule_pattern');
102102
$this->assertEquals(
@@ -118,7 +118,7 @@ public function testInvalidRuleFactory()
118118
*
119119
* @return void
120120
*/
121-
public function testExceptionChaining()
121+
public function testExceptionChaining(): void
122122
{
123123
$previous = new \RuntimeException('Previous error');
124124
$exception = new LinterException('Wrapper error', 0, $previous);

tests/Unit/LinterTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function tearDown(): void
7171
*
7272
* @return void
7373
*/
74-
public function testClassIsFinal()
74+
public function testClassIsFinal(): void
7575
{
7676
$reflection = new \ReflectionClass(Linter::class);
7777
$this->assertTrue($reflection->isFinal(), 'Linter class should be final');
@@ -84,7 +84,7 @@ public function testClassIsFinal()
8484
*
8585
* @return void
8686
*/
87-
public function testClassHasCorrectNamespace()
87+
public function testClassHasCorrectNamespace(): void
8888
{
8989
$this->assertStringStartsWith(
9090
'Yousha\PhpSecurityLinter',
@@ -100,7 +100,7 @@ public function testClassHasCorrectNamespace()
100100
*
101101
* @return void
102102
*/
103-
public function testLinterInitializesWithRules()
103+
public function testLinterInitializesWithRules(): void
104104
{
105105
$reflection = new \ReflectionClass(Linter::class);
106106
$property = $reflection->getProperty('rules');
@@ -121,7 +121,7 @@ public function testLinterInitializesWithRules()
121121
*
122122
* @return void
123123
*/
124-
public function testScanMethodExists()
124+
public function testScanMethodExists(): void
125125
{
126126
$this->assertTrue(
127127
method_exists(Linter::class, 'scan')
@@ -135,7 +135,7 @@ public function testScanMethodExists()
135135
*
136136
* @return void
137137
*/
138-
public function testScanMethodSignature()
138+
public function testScanMethodSignature(): void
139139
{
140140
$method = new \ReflectionMethod(Linter::class, 'scan');
141141

@@ -163,7 +163,7 @@ public function testScanMethodSignature()
163163
*
164164
* @return void
165165
*/
166-
public function testScanDirectoryWithNonPhpFiles()
166+
public function testScanDirectoryWithNonPhpFiles(): void
167167
{
168168
$tempDir = sys_get_temp_dir() . '/test_dir_' . uniqid();
169169
mkdir($tempDir);
@@ -185,7 +185,7 @@ public function testScanDirectoryWithNonPhpFiles()
185185
*
186186
* @return void
187187
*/
188-
public function testScanReturnsMetadataWithFiles()
188+
public function testScanReturnsMetadataWithFiles(): void
189189
{
190190
// Create temp dir with sample PHP file
191191
$tempDir = sys_get_temp_dir() . '/test_dir_' . uniqid();
@@ -209,7 +209,7 @@ public function testScanReturnsMetadataWithFiles()
209209
*
210210
* @return void
211211
*/
212-
public function testScanThrowsExceptionForInvalidPath()
212+
public function testScanThrowsExceptionForInvalidPath(): void
213213
{
214214
$this->expectException(LinterException::class);
215215
$this->expectExceptionMessage('Path does not exist: /nonexistent/path');
@@ -224,7 +224,7 @@ public function testScanThrowsExceptionForInvalidPath()
224224
*
225225
* @return void
226226
*/
227-
public function testCanScanEmptyDirectory()
227+
public function testCanScanEmptyDirectory(): void
228228
{
229229
$tempDir = sys_get_temp_dir() . '/empty_test_dir_' . uniqid();
230230
mkdir($tempDir);
@@ -253,7 +253,7 @@ public function testCanScanEmptyDirectory()
253253
*
254254
* @return void
255255
*/
256-
public function testShouldExcludeMethodIsPrivate()
256+
public function testShouldExcludeMethodIsPrivate(): void
257257
{
258258
$method = new \ReflectionMethod(Linter::class, 'shouldExclude');
259259
$this->assertTrue($method->isPrivate());
@@ -266,7 +266,7 @@ public function testShouldExcludeMethodIsPrivate()
266266
*
267267
* @return void
268268
*/
269-
public function testScanFileMethodIsPrivate()
269+
public function testScanFileMethodIsPrivate(): void
270270
{
271271
$method = new \ReflectionMethod(Linter::class, 'scanFile');
272272
$this->assertTrue($method->isPrivate());
@@ -279,7 +279,7 @@ public function testScanFileMethodIsPrivate()
279279
*
280280
* @return void
281281
*/
282-
public function testInvalidDirectory()
282+
public function testInvalidDirectory(): void
283283
{
284284
$this->expectException(LinterException::class);
285285
$linter = new Linter();

0 commit comments

Comments
 (0)