Skip to content

Commit b6c5eec

Browse files
committed
Cleanup inspection files
1 parent 3e98377 commit b6c5eec

30 files changed

+780
-235
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/config/yaml/inspection/YamlDuplicateParameterKeyInspection.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/main/java/fr/adrienbrault/idea/symfony2plugin/config/yaml/inspection/YamlDuplicateServiceKeyInspection.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/main/java/fr/adrienbrault/idea/symfony2plugin/dic/inspection/ContainerConstantInspection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public class ContainerConstantInspection extends LocalInspectionTool {
2121
public static final String MESSAGE = "Symfony: constant not found";
2222

23-
public static class MyYamlLocalInspectionTool extends LocalInspectionTool {
23+
public static class ContainerConstantYamlInspection extends LocalInspectionTool {
2424
@Override
2525
public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
2626
Project project = holder.getProject();
@@ -41,7 +41,7 @@ public void visitElement(@NotNull PsiElement element) {
4141
}
4242
}
4343

44-
public static class MyXmlLocalInspectionTool extends LocalInspectionTool {
44+
public static class ContainerConstantXmlInspection extends LocalInspectionTool {
4545
@Override
4646
public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
4747
Project project = holder.getProject();

src/main/resources/META-INF/plugin.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,6 @@
333333
language=""
334334
implementationClass="fr.adrienbrault.idea.symfony2plugin.routing.inspection.DuplicateLocalRouteInspection"/>
335335

336-
<localInspection groupPath="Symfony" shortName="Symfony2YamlDuplicateServiceKeyInspection" displayName="Duplicate Key"
337-
groupName="Service"
338-
enabledByDefault="true" level="WARNING"
339-
language="yaml"
340-
implementationClass="fr.adrienbrault.idea.symfony2plugin.config.yaml.inspection.YamlDuplicateServiceKeyInspection"/>
341-
342-
<localInspection groupPath="Symfony" shortName="Symfony2YamlDuplicateParameterKeyInspection" displayName="Duplicate Key"
343-
groupName="Service"
344-
enabledByDefault="true" level="WARNING"
345-
language="yaml"
346-
implementationClass="fr.adrienbrault.idea.symfony2plugin.config.yaml.inspection.YamlDuplicateParameterKeyInspection"/>
347-
348336
<localInspection groupPath="Symfony" shortName="Symfony2XmlDuplicateServiceKeyInspection" displayName="Duplicate Key"
349337
groupName="Service"
350338
enabledByDefault="true" level="WARNING"
@@ -498,14 +486,14 @@
498486
enabledByDefault="true"
499487
level="WARNING"
500488
language="XML"
501-
implementationClass="fr.adrienbrault.idea.symfony2plugin.dic.inspection.ContainerConstantInspection$MyXmlLocalInspectionTool"/>
489+
implementationClass="fr.adrienbrault.idea.symfony2plugin.dic.inspection.ContainerConstantInspection$ContainerConstantXmlInspection"/>
502490

503491
<localInspection groupPath="Symfony" shortName="ContainerConstantYaml" displayName="Constant not found in yaml definition"
504492
groupName="Service"
505493
enabledByDefault="true"
506494
level="WARNING"
507495
language="yaml"
508-
implementationClass="fr.adrienbrault.idea.symfony2plugin.dic.inspection.ContainerConstantInspection$MyYamlLocalInspectionTool"/>
496+
implementationClass="fr.adrienbrault.idea.symfony2plugin.dic.inspection.ContainerConstantInspection$ContainerConstantYamlInspection"/>
509497

510498
<localInspection groupPath="Symfony" shortName="TwigTranslationDomain" displayName="Twig: Missing translation domain"
511499
groupName="Translation"

src/main/resources/inspectionDescriptions/ContainerConstant.html

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<html>
2+
<body>
3+
Constant referenced in XML configuration is not defined or cannot be resolved
4+
<!-- tooltip end -->
5+
6+
<p>
7+
This inspection detects undefined constants in Symfony XML configuration files.
8+
It validates that constants referenced using <code>&lt;argument type="constant"&gt;</code>
9+
are actually defined and available.
10+
</p>
11+
12+
<p>
13+
The inspection checks for:
14+
</p>
15+
16+
<ul>
17+
<li>Undefined PHP constants in <code>&lt;argument type="constant"&gt;</code> elements</li>
18+
<li>Constants that don't exist in the current PHP context</li>
19+
<li>Misspelled constant names</li>
20+
</ul>
21+
22+
<p>
23+
Example XML configuration that would trigger this inspection:
24+
</p>
25+
26+
<pre><code>
27+
&lt;services&gt;
28+
&lt;service id="my_service" class="App\Service\MyService"&gt;
29+
&lt;!-- Valid constant references --&gt;
30+
&lt;argument type="constant"&gt;DateTime::class&lt;/argument&gt;
31+
&lt;argument type="constant"&gt;PHP_VERSION&lt;/argument&gt;
32+
33+
&lt;!-- Invalid constant that will trigger inspection --&gt;
34+
&lt;argument type="constant"&gt;\Foobar\Car::UNDEFINED_CONSTANT&lt;/argument&gt;
35+
36+
&lt;!-- If MAX_ITEMS doesn't exist on MyService class, this will trigger inspection --&gt;
37+
&lt;argument type="constant"&gt;App\Service\MyService::MAX_ITEMS&lt;/argument&gt;
38+
&lt;/service&gt;
39+
40+
&lt;service id="another_service" class="DateTime"&gt;
41+
&lt;argument type="constant"&gt;\Foobar\Car::FOOBAR_1&lt;/argument&gt; &lt;!-- This will trigger inspection --&gt;
42+
&lt;/service&gt;
43+
&lt;/services&gt;
44+
</code></pre>
45+
46+
</body>
47+
</html>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<html>
2+
<body>
3+
Constant referenced in YAML configuration is not defined or cannot be resolved
4+
<!-- tooltip end -->
5+
6+
<p>
7+
This inspection detects undefined constants in Symfony YAML configuration files.
8+
It validates that constants referenced using the <code>!php/const:</code> tag format
9+
are actually defined and available.
10+
</p>
11+
12+
<p>
13+
The inspection checks for:
14+
</p>
15+
16+
<ul>
17+
<li>Undefined PHP constants referenced with <code>!php/const:</code> tag</li>
18+
<li>Constants that don't exist in the current PHP context</li>
19+
<li>Misspelled constant names</li>
20+
</ul>
21+
22+
<p>
23+
Example YAML configuration that would trigger this inspection:
24+
</p>
25+
26+
<pre><code>
27+
parameters:
28+
# Global constants
29+
php_version: !php/const:PHP_VERSION
30+
undefined_global: !php/const:UNDEFINED_CONSTANT # This will trigger inspection
31+
32+
services:
33+
my_service:
34+
class: App\Service\MyService
35+
arguments:
36+
# Class constants
37+
- !php/const:App\Entity\User::class
38+
- !php/const:App\Service\MyService::MAX_ITEMS # If MAX_ITEMS doesn't exist, this will trigger inspection
39+
- !php/const:\Foobar\Car::UNDEFINED_CLASS # This will trigger inspection
40+
</code></pre>
41+
</body>
42+
</html>

src/main/resources/inspectionDescriptions/ControllerMethodInspection.html

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<html>
2+
<body>
3+
Controller action method referenced in route does not exist in the specified class
4+
<!-- tooltip end -->
5+
6+
<p>
7+
This inspection detects missing controller action methods in Symfony XML route definitions.
8+
It validates that when a route references a controller action, the corresponding method
9+
actually exists in the controller class.
10+
</p>
11+
12+
<p>
13+
The inspection checks for:
14+
</p>
15+
16+
<ul>
17+
<li>Controller methods referenced in XML route configurations that don't exist</li>
18+
<li>Misspelled method names in controller references</li>
19+
<li>Controllers that exist but lack the specified action method</li>
20+
</ul>
21+
22+
<p>
23+
Example XML route configuration that would trigger this inspection:
24+
</p>
25+
26+
<pre><code>
27+
&lt;routes&gt;
28+
&lt;route id="homepage" controller="App\Controller\HomeController::index" /&gt;
29+
&lt;!-- OK if index() method exists in HomeController --&gt;
30+
31+
&lt;route id="contact" controller="App\Controller\ContactController::show" /&gt;
32+
&lt;!-- Triggers inspection if show() method doesn't exist in ContactController --&gt;
33+
34+
&lt;route id="product_list" controller="App\Controller\ProductController::listProducts" /&gt;
35+
&lt;!-- Triggers inspection if listProducts() method doesn't exist --&gt;
36+
&lt;/routes&gt;
37+
</code></pre>
38+
39+
<p>
40+
The inspection supports various controller reference formats:
41+
</p>
42+
43+
<ul>
44+
<li><code>App\Controller\MyController::methodName</code> - Class::method syntax</li>
45+
<li><code>MyController::methodName</code> - Shortcut syntax</li>
46+
<li><code>service_id:methodName</code> - Service ID syntax</li>
47+
</ul>
48+
</body>
49+
</html>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<html>
2+
<body>
3+
Controller action method referenced in route does not exist in the specified class
4+
<!-- tooltip end -->
5+
6+
<p>
7+
This inspection detects missing controller action methods in Symfony YAML route definitions.
8+
It validates that when a route references a controller action, the corresponding method
9+
actually exists in the controller class.
10+
</p>
11+
12+
<p>
13+
The inspection checks for:
14+
</p>
15+
16+
<ul>
17+
<li>Controller methods referenced in YAML route configurations that don't exist</li>
18+
<li>Misspelled method names in controller references</li>
19+
<li>Controllers that exist but lack the specified action method</li>
20+
</ul>
21+
22+
<p>
23+
Example YAML route configuration that would trigger this inspection:
24+
</p>
25+
26+
<pre><code>
27+
# config/routes.yaml
28+
homepage:
29+
controller: App\Controller\HomeController::index
30+
# OK if index() method exists in HomeController
31+
32+
contact:
33+
controller: App\Controller\ContactController::show
34+
# Triggers inspection if show() method doesn't exist in ContactController
35+
36+
product_list:
37+
controller: App\Controller\ProductController::listProducts
38+
# Triggers inspection if listProducts() method doesn't exist
39+
40+
# Alternative formats supported:
41+
api_user_profile:
42+
controller: user_controller::getProfile # Shortcut syntax
43+
# Triggers inspection if getProfile() doesn't exist
44+
45+
service_action:
46+
controller: app.service.my_service:processData # Service ID syntax
47+
# Triggers inspection if processData() doesn't exist in the service
48+
</code></pre>
49+
50+
<p>
51+
The inspection supports various controller reference formats:
52+
</p>
53+
54+
<ul>
55+
<li><code>App\Controller\MyController::methodName</code> - Class::method syntax</li>
56+
<li><code>MyController::methodName</code> - Shortcut syntax (configured in framework.yaml)</li>
57+
<li><code>service_id:methodName</code> - Service ID syntax</li>
58+
</ul>
59+
</body>
60+
</html>

0 commit comments

Comments
 (0)