Skip to content

Commit 1e01c7b

Browse files
authored
Add PHPStan (#740)
1 parent 45137e2 commit 1e01c7b

File tree

7 files changed

+230
-5
lines changed

7 files changed

+230
-5
lines changed

.github/workflows/ci.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
push:
66
branches:
77
- master
8-
- develop
98
- release/**
109

1110
jobs:

.github/workflows/cs.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name: Code style
1+
name: CS
22

33
on:
44
pull_request:
55
push:
66
branches:
77
- master
8-
- develop
98
- release/**
109

1110
jobs:
@@ -19,7 +18,7 @@ jobs:
1918
- name: Setup PHP
2019
uses: shivammathur/setup-php@v2
2120
with:
22-
php-version: '8.1'
21+
php-version: '8.2'
2322

2423
- name: Install dependencies
2524
run: composer update --no-progress --no-interaction --prefer-dist
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Static Analysis
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- release/**
9+
10+
jobs:
11+
phpstan:
12+
name: PHPStan
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.2'
22+
23+
- name: Install dependencies
24+
run: composer update --no-progress --no-interaction --prefer-dist
25+
26+
- name: Run script
27+
run: vendor/bin/phpstan analyse

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0",
3939
"orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0",
4040
"friendsofphp/php-cs-fixer": "^3.11",
41-
"mockery/mockery": "^1.3"
41+
"mockery/mockery": "^1.3",
42+
"phpstan/phpstan": "^1.10"
4243
},
4344
"autoload-dev": {
4445
"psr-4": {

phpstan-baseline.neon

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\RequestReceived not found\\.$#"
5+
count: 1
6+
path: src/Sentry/Laravel/EventHandler.php
7+
8+
-
9+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\RequestTerminated not found\\.$#"
10+
count: 1
11+
path: src/Sentry/Laravel/EventHandler.php
12+
13+
-
14+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\TaskReceived not found\\.$#"
15+
count: 1
16+
path: src/Sentry/Laravel/EventHandler.php
17+
18+
-
19+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\TaskTerminated not found\\.$#"
20+
count: 1
21+
path: src/Sentry/Laravel/EventHandler.php
22+
23+
-
24+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\TickReceived not found\\.$#"
25+
count: 1
26+
path: src/Sentry/Laravel/EventHandler.php
27+
28+
-
29+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\TickTerminated not found\\.$#"
30+
count: 1
31+
path: src/Sentry/Laravel/EventHandler.php
32+
33+
-
34+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\WorkerErrorOccurred not found\\.$#"
35+
count: 1
36+
path: src/Sentry/Laravel/EventHandler.php
37+
38+
-
39+
message: "#^Class Laravel\\\\Octane\\\\Events\\\\WorkerStopping not found\\.$#"
40+
count: 1
41+
path: src/Sentry/Laravel/EventHandler.php
42+
43+
-
44+
message: "#^Class Laravel\\\\Sanctum\\\\Events\\\\TokenAuthenticated not found\\.$#"
45+
count: 1
46+
path: src/Sentry/Laravel/EventHandler.php
47+
48+
-
49+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneRequestReceivedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\RequestReceived\\.$#"
50+
count: 1
51+
path: src/Sentry/Laravel/EventHandler.php
52+
53+
-
54+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneRequestTerminatedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\RequestTerminated\\.$#"
55+
count: 1
56+
path: src/Sentry/Laravel/EventHandler.php
57+
58+
-
59+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneTaskReceivedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\TaskReceived\\.$#"
60+
count: 1
61+
path: src/Sentry/Laravel/EventHandler.php
62+
63+
-
64+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneTaskTerminatedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\TaskTerminated\\.$#"
65+
count: 1
66+
path: src/Sentry/Laravel/EventHandler.php
67+
68+
-
69+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneTickReceivedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\TickReceived\\.$#"
70+
count: 1
71+
path: src/Sentry/Laravel/EventHandler.php
72+
73+
-
74+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneTickTerminatedHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\TickTerminated\\.$#"
75+
count: 1
76+
path: src/Sentry/Laravel/EventHandler.php
77+
78+
-
79+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneWorkerErrorOccurredHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\WorkerErrorOccurred\\.$#"
80+
count: 1
81+
path: src/Sentry/Laravel/EventHandler.php
82+
83+
-
84+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:octaneWorkerStoppingHandler\\(\\) has invalid type Laravel\\\\Octane\\\\Events\\\\WorkerStopping\\.$#"
85+
count: 1
86+
path: src/Sentry/Laravel/EventHandler.php
87+
88+
-
89+
message: "#^Parameter \\$event of method Sentry\\\\Laravel\\\\EventHandler\\:\\:sanctumTokenAuthenticatedHandler\\(\\) has invalid type Laravel\\\\Sanctum\\\\Events\\\\TokenAuthenticated\\.$#"
90+
count: 1
91+
path: src/Sentry/Laravel/EventHandler.php
92+
93+
-
94+
message: "#^Parameter \\$component of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:handleComponentBoot\\(\\) has invalid type Livewire\\\\Component\\.$#"
95+
count: 1
96+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
97+
98+
-
99+
message: "#^Parameter \\$component of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:handleComponentBooted\\(\\) has invalid type Livewire\\\\Component\\.$#"
100+
count: 1
101+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
102+
103+
-
104+
message: "#^Parameter \\$component of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:handleComponentDehydrate\\(\\) has invalid type Livewire\\\\Component\\.$#"
105+
count: 1
106+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
107+
108+
-
109+
message: "#^Parameter \\$component of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:handleComponentMount\\(\\) has invalid type Livewire\\\\Component\\.$#"
110+
count: 1
111+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
112+
113+
-
114+
message: "#^Parameter \\$livewireManager of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:setup\\(\\) has invalid type Livewire\\\\LivewireManager\\.$#"
115+
count: 1
116+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
117+
118+
-
119+
message: "#^Parameter \\$request of method Sentry\\\\Laravel\\\\Features\\\\LivewirePackageIntegration\\:\\:handleComponentBooted\\(\\) has invalid type Livewire\\\\Request\\.$#"
120+
count: 1
121+
path: src/Sentry/Laravel/Features/LivewirePackageIntegration.php
122+
123+
-
124+
message: "#^Call to protected method resolve\\(\\) of class Illuminate\\\\Filesystem\\\\FilesystemManager\\.$#"
125+
count: 1
126+
path: src/Sentry/Laravel/Features/Storage/Integration.php
127+
128+
-
129+
message: "#^Class Laravel\\\\Lumen\\\\Application not found\\.$#"
130+
count: 3
131+
path: src/Sentry/Laravel/ServiceProvider.php
132+
133+
-
134+
message: "#^Class GraphQL\\\\Language\\\\AST\\\\DocumentNode not found\\.$#"
135+
count: 1
136+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
137+
138+
-
139+
message: "#^Class GraphQL\\\\Language\\\\AST\\\\OperationDefinitionNode not found\\.$#"
140+
count: 1
141+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
142+
143+
-
144+
message: "#^Class Nuwave\\\\Lighthouse\\\\Events\\\\EndExecution not found\\.$#"
145+
count: 1
146+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
147+
148+
-
149+
message: "#^Class Nuwave\\\\Lighthouse\\\\Events\\\\EndRequest not found\\.$#"
150+
count: 1
151+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
152+
153+
-
154+
message: "#^Class Nuwave\\\\Lighthouse\\\\Events\\\\StartExecution not found\\.$#"
155+
count: 1
156+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
157+
158+
-
159+
message: "#^Class Nuwave\\\\Lighthouse\\\\Events\\\\StartRequest not found\\.$#"
160+
count: 1
161+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
162+
163+
-
164+
message: "#^Parameter \\$endExecution of method Sentry\\\\Laravel\\\\Tracing\\\\Integrations\\\\LighthouseIntegration\\:\\:handleEndExecution\\(\\) has invalid type Nuwave\\\\Lighthouse\\\\Events\\\\EndExecution\\.$#"
165+
count: 1
166+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
167+
168+
-
169+
message: "#^Parameter \\$endRequest of method Sentry\\\\Laravel\\\\Tracing\\\\Integrations\\\\LighthouseIntegration\\:\\:handleEndRequest\\(\\) has invalid type Nuwave\\\\Lighthouse\\\\Events\\\\EndRequest\\.$#"
170+
count: 1
171+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
172+
173+
-
174+
message: "#^Parameter \\$operation of method Sentry\\\\Laravel\\\\Tracing\\\\Integrations\\\\LighthouseIntegration\\:\\:extractOperationNames\\(\\) has invalid type GraphQL\\\\Language\\\\AST\\\\OperationDefinitionNode\\.$#"
175+
count: 1
176+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
177+
178+
-
179+
message: "#^Parameter \\$startExecution of method Sentry\\\\Laravel\\\\Tracing\\\\Integrations\\\\LighthouseIntegration\\:\\:handleStartExecution\\(\\) has invalid type Nuwave\\\\Lighthouse\\\\Events\\\\StartExecution\\.$#"
180+
count: 1
181+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
182+
183+
-
184+
message: "#^Parameter \\$startRequest of method Sentry\\\\Laravel\\\\Tracing\\\\Integrations\\\\LighthouseIntegration\\:\\:handleStartRequest\\(\\) has invalid type Nuwave\\\\Lighthouse\\\\Events\\\\StartRequest\\.$#"
185+
count: 1
186+
path: src/Sentry/Laravel/Tracing/Integrations/LighthouseIntegration.php
187+
188+
-
189+
message: "#^Class Laravel\\\\Lumen\\\\Application not found\\.$#"
190+
count: 2
191+
path: src/Sentry/Laravel/Tracing/ServiceProvider.php

phpstan.neon

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 1
6+
paths:
7+
- src

src/Sentry/Laravel/Features/Storage/Integration.php

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function (Application $application, array $config) use ($filesystemManager): Fil
5858
// This is a "hack" to make sure that the original driver is resolved by the FilesystemManager
5959
config(["filesystems.disks.{$disk}" => $config]);
6060

61+
/** @var FilesystemManager $this */
6162
return $this->resolve($disk);
6263
})->bindTo($filesystemManager, FilesystemManager::class);
6364

0 commit comments

Comments
 (0)