Skip to content

Commit 1aab42a

Browse files
committed
test: Add inspections for null pointer and void function usage
- Introduce new static analysis inspections for null pointers and void function results in multiple test files. - Update existing annotations to improve code quality and catch potential issues early. - Ensure all relevant tests are annotated consistently.
1 parent 987ccf7 commit 1aab42a

21 files changed

+73
-7
lines changed

_ide_helper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

3-
/** @noinspection EmptyClassInspection */
43
/** @noinspection ClassNameCollisionInspection */
4+
/** @noinspection EmptyClassInspection */
5+
/** @noinspection PhpMultipleClassDeclarationsInspection */
56

67
declare(strict_types=1);
78

monorepo-builder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
/** @noinspection PhpUnusedAliasInspection */
4+
35
declare(strict_types=1);
46

57
/**

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
/** @noinspection PhpInternalEntityUsedInspection */
44
/** @noinspection PhpUnhandledExceptionInspection */
5+
/** @noinspection PhpUnusedAliasInspection */
6+
57
declare(strict_types=1);
68

79
/**

tests/Channels/AbstractChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Channels/ChannelTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4-
/** @noinspection DebugFunctionUsageInspection */
5-
/** @noinspection ForgottenDebugOutputInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
68
/** @noinspection StaticClosureCanBeUsedInspection */
79

810
declare(strict_types=1);

tests/Channels/DumpChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Channels/LogChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Channels/MailChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Channels/NotifyChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Channels/StackChannelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Collectors/CollectorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/Commands/TestCommandTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/ExceptionNotifyManagerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
/** @noinspection AnonymousFunctionStaticInspection */
44
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
57
/** @noinspection PhpVoidFunctionResultUsedInspection */
68
/** @noinspection StaticClosureCanBeUsedInspection */
79

tests/ExceptionNotifyServiceProviderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
48
/** @noinspection StaticClosureCanBeUsedInspection */
59

610
declare(strict_types=1);

tests/FeatureTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
/** @noinspection AnonymousFunctionStaticInspection */
44
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
57
/** @noinspection PhpVoidFunctionResultUsedInspection */
68
/** @noinspection StaticClosureCanBeUsedInspection */
79

tests/Mail/ReportExceptionMailTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
8+
/** @noinspection StaticClosureCanBeUsedInspection */
9+
310
declare(strict_types=1);
411

512
/**

tests/Pest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
22

33
/** @noinspection AnonymousFunctionStaticInspection */
4-
/** @noinspection PhpInconsistentReturnPointsInspection */
5-
/** @noinspection PhpUndefinedClassInspection */
6-
/** @noinspection PhpUnused */
4+
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
78
/** @noinspection StaticClosureCanBeUsedInspection */
89

10+
/** @noinspection PhpInconsistentReturnPointsInspection */
11+
912
declare(strict_types=1);
1013

1114
/**
@@ -17,9 +20,11 @@
1720
* @see https://github.com/guanguans/laravel-exception-notify
1821
*/
1922

23+
use Composer\Autoload\ClassLoader;
24+
use Faker\Factory;
2025
use Guanguans\LaravelExceptionNotifyTests\TestCase;
2126
use Illuminate\Support\Collection;
22-
use Illuminate\Support\Facades\File;
27+
use Pest\Expectation;
2328

2429
uses(TestCase::class)
2530
->beforeAll(function (): void {})

tests/Support/ExceptionContextTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
/** @noinspection AnonymousFunctionStaticInspection */
44
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
58
/** @noinspection StaticClosureCanBeUsedInspection */
69

710
declare(strict_types=1);

tests/Support/HeplersTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/** @noinspection NullPointerExceptionInspection */
55
/** @noinspection PhpInternalEntityUsedInspection */
66
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
78
/** @noinspection StaticClosureCanBeUsedInspection */
89

910
declare(strict_types=1);

tests/Support/JsonFixerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/** @noinspection AnonymousFunctionStaticInspection */
44
/** @noinspection NullPointerExceptionInspection */
5+
/** @noinspection PhpInternalEntityUsedInspection */
56
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpVoidFunctionResultUsedInspection */
68
/** @noinspection StaticClosureCanBeUsedInspection */
79

810
declare(strict_types=1);

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
/** @noinspection EfferentObjectCouplingInspection */
34
/** @noinspection PhpMissingParentCallCommonInspection */
45

56
declare(strict_types=1);

0 commit comments

Comments
 (0)