Skip to content

Commit e8a0c1b

Browse files
committed
Update build tools, platform version, and refactor CLAUDE.md
1 parent 70c7b38 commit e8a0c1b

8 files changed

Lines changed: 64 additions & 186 deletions

File tree

AGENTS.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is an IntelliJ IDEA/PhpStorm plugin that provides PHP annotation and PHP 8 Attribute support. The plugin extends the IDE to recognize annotation classes marked with `@Annotation`, provides code completion, navigation, inspections, and integrates with Doctrine ORM and Symfony frameworks.
8+
9+
**Plugin ID**: `de.espend.idea.php.annotation`
10+
11+
## Build Commands
12+
13+
### Build the plugin
14+
```bash
15+
./gradlew buildPlugin
16+
```
17+
The plugin ZIP will be in `build/distributions/`.
18+
19+
### Running Tests
20+
21+
```bash
22+
# Run all tests
23+
./gradlew test
24+
25+
# Run a specific test class
26+
./gradlew test --tests "fr.adrienbrault.idea.symfony2plugin.tests.dic.SymfonyContainerTypeProviderTest"
27+
28+
# Run tests matching a pattern
29+
./gradlew test --tests "*ContainerTest"
30+
```
31+
32+
## Architecture
33+
34+
- Tests extend `AnnotationLightCodeInsightFixtureTestCase` which provides a test fixture framework.
35+
36+
Test data files are in `src/test/java/de/espend/idea/php/annotation/tests/fixtures/`.
37+
38+
39+
## Decompiler Tools
40+
41+
For analyzing bundled plugins like Twig and PHP you MUST use **vineflower** and NOT **Fernflower** from IntelliJ (less quality):
42+
43+
**vineflower**
44+
45+
- **GitHub:** https://github.com/Vineflower/vineflower
46+
- **Download:** https://repo1.maven.org/maven2/org/vineflower/vineflower/1.11.2/vineflower-1.11.2.jar
47+
- **Local copy:** `decompiled/vineflower.jar`
48+
- **Usage:** `java -jar vineflower.jar input.jar output/`
49+
50+
**Bundled Plugin JARs (for decompilation):**
51+
- **Location:** `~/.gradle/caches/[gradle-version]/transforms/*/transformed/com.jetbrains.[plugin]-[intellij-version]/[plugin]/lib/[plugin].jar`
52+
- **Example:** `~/.gradle/caches/9.3.0/transforms/*/transformed/com.jetbrains.twig-253.28294.322/twig/lib/twig.jar`

CLAUDE.md

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

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5-
## Project Overview
5+
### Project Overview
66

7-
This is an IntelliJ IDEA/PhpStorm plugin that provides PHP annotation and PHP 8 Attribute support. The plugin extends the IDE to recognize annotation classes marked with `@Annotation`, provides code completion, navigation, inspections, and integrates with Doctrine ORM and Symfony frameworks.
8-
9-
**Plugin ID**: `de.espend.idea.php.annotation`
10-
11-
## Build Commands
12-
13-
### Build the plugin
14-
```bash
15-
./gradlew buildPlugin
16-
```
17-
The plugin ZIP will be in `build/distributions/`.
18-
19-
### Run tests
20-
```bash
21-
./gradlew test
22-
```
23-
24-
### Run a single test class
25-
```bash
26-
./gradlew test --tests "de.espend.idea.php.annotation.tests.AnnotationStubIndexTest"
27-
```
28-
29-
### Run a single test method
30-
```bash
31-
./gradlew test --tests "de.espend.idea.php.annotation.tests.AnnotationStubIndexTest.testThatAnnotationClassIsInIndex"
32-
```
33-
34-
### Run the plugin in a test IDE instance
35-
```bash
36-
./gradlew runIde
37-
```
38-
39-
### Verify plugin compatibility
40-
```bash
41-
./gradlew verifyPlugin
42-
```
43-
44-
### Clean build
45-
```bash
46-
./gradlew clean buildPlugin
47-
```
48-
49-
## Architecture
50-
51-
### Extension Point System
52-
53-
The plugin's core architecture is based on extension points that allow both internal components and external plugins (like Symfony Support or PHP Toolbox) to extend functionality.
54-
55-
**Key extension point interfaces** (in `src/main/java/de/espend/idea/php/annotation/extension/`):
56-
57-
- **PhpAnnotationCompletionProvider**: Provides code completion for annotation property values
58-
- **PhpAnnotationReferenceProvider**: Provides references and navigation for annotation elements
59-
- **PhpAnnotationDocTagGotoHandler**: Handles "Go to Declaration" for annotation tags
60-
- **PhpAnnotationDocTagAnnotator**: Provides custom highlighting/error annotations for doc tags
61-
- **PhpAnnotationGlobalNamespacesLoader**: Loads global annotation namespace mappings
62-
- **PhpAnnotationVirtualProperties**: Provides virtual properties for annotation classes
63-
- **PhpAnnotationUseAlias**: Maps custom class aliases (e.g., "ORM" => "Doctrine\\ORM\\Mapping")
64-
65-
Extension points are registered in `src/main/resources/META-INF/plugin.xml` and can be used by other plugins.
66-
67-
### Indexing System
68-
69-
The plugin uses two main file-based indices for fast lookup:
70-
71-
- **AnnotationStubIndex**: Indexes all PHP classes marked with `@Annotation` in their doc block
72-
- **AnnotationUsageIndex**: Indexes where annotations are used in the codebase
73-
74-
These indices power the navigation features (find usages, line markers) and are updated automatically when files change.
75-
76-
### Module Organization
77-
78-
- **annotator/**: Provides inline error highlighting and warnings
79-
- **completion/**: Code completion contributors and providers
80-
- **dict/**: Data transfer objects and dictionary classes
81-
- **doctrine/**: Doctrine ORM-specific features (property generators, repository class handling, column type support)
82-
- **extension/**: Extension point interfaces and parameters
83-
- **inspection/**: Code inspections (missing imports, deprecated usage, etc.)
84-
- **navigation/**: Navigation handlers and line marker providers
85-
- **pattern/**: PSI pattern matching for identifying annotation contexts
86-
- **reference/**: Reference contributors for navigation and "Find Usages"
87-
- **symfony/**: Symfony-specific annotation support
88-
- **toolbox/**: PHP Toolbox integration
89-
- **ui/**: Settings forms and configuration UI
90-
- **util/**: Utility classes, particularly `AnnotationUtil` which contains core logic for annotation detection and processing
91-
92-
### Dual Support: DocBlock Annotations and PHP 8 Attributes
93-
94-
The plugin supports both:
95-
- **DocBlock annotations**: `/** @Route("/path") */`
96-
- **PHP 8 Attributes**: `#[Route('/path')]`
97-
98-
Extension points work transparently with both formats, allowing feature implementations to support both simultaneously.
99-
100-
## Key Concepts
101-
102-
### Annotation Detection
103-
104-
Classes are recognized as annotation classes if they have `@Annotation` in their doc block:
105-
```php
106-
/**
107-
* @Annotation
108-
* @Target("METHOD", "CLASS")
109-
*/
110-
class Route {
111-
public $path;
112-
}
113-
```
114-
115-
### Target Filtering
116-
117-
The `@Target` annotation restricts where annotations can be used (METHOD, CLASS, PROPERTY, ALL). The plugin uses this for completion filtering.
118-
119-
### Property Type Detection
120-
121-
Annotation properties support type hints via doc comments:
122-
- Simple types: `@var string`, `@var bool`
123-
- Arrays: `@var array<string>`
124-
- Enums: `@Enum({"GET", "POST", "PUT"})`
125-
- Mixed: `@var mixed|string|bool`
126-
127-
### Use Alias System
128-
129-
The plugin supports configurable namespace aliases (Settings > PHP > Annotations / Attributes > Use Alias):
130-
- Maps short names to FQCNs: `ORM` => `Doctrine\ORM\Mapping`
131-
- Auto-import suggestions use these mappings
132-
- External plugins can provide their own mappings via `PhpAnnotationUseAlias` extension point
133-
134-
## Test Structure
135-
136-
Tests extend `AnnotationLightCodeInsightFixtureTestCase` which provides a test fixture framework.
137-
138-
Test data files are in `src/test/java/de/espend/idea/php/annotation/tests/fixtures/`.
139-
140-
Tests use the `myFixture` field to:
141-
- Copy test PHP files: `myFixture.copyFileToProject("classes.php")`
142-
- Check completion: `myFixture.completeBasic()`
143-
- Navigate: `myFixture.getReferenceAtCaretPosition()`
144-
- Assert index contents: `assertIndexContains(AnnotationStubIndex.KEY, "My\\Class")`
145-
146-
## Configuration
147-
148-
Build configuration is in `gradle.properties`:
149-
- `platformVersion`: Target IntelliJ/PhpStorm version (currently 2025.2.5)
150-
- `pluginSinceBuild` / `pluginUntilBuild`: Supported IDE version range
151-
- `javaVersion`: Java language level (21)
152-
153-
The plugin requires these IntelliJ plugins as dependencies:
154-
- `com.jetbrains.php` (PhpStorm PHP support)
155-
- `com.jetbrains.twig` (Twig template support)
156-
- `com.intellij.modules.json` (JSON support)
157-
158-
Optional integration:
159-
- `de.espend.idea.php.toolbox` (PHP Toolbox)
160-
161-
## Publishing
162-
163-
See `MAINTENANCE.md` for the full release process. Key steps:
164-
1. Update `CHANGELOG.md`
165-
2. Commit changes
166-
3. Tag release: `git tag X.Y.Z`
167-
4. Build: `./gradlew clean buildPlugin`
168-
5. Publish: `IJ_TOKEN=yourtoken ./gradlew publishPlugin`
7+
- You MUST include this file: @AGENTS.md

build.gradle.kts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ fun properties(key: String) = project.findProperty(key).toString()
55

66
plugins {
77
id("java")
8-
id("org.jetbrains.kotlin.jvm") version "2.2.21"
9-
id("org.jetbrains.intellij.platform") version "2.10.4"
10-
id("org.jetbrains.changelog") version "1.3.1"
11-
id("org.jetbrains.qodana") version "0.1.13"
8+
id("org.jetbrains.kotlin.jvm") version "2.3.20"
9+
id("org.jetbrains.intellij.platform") version "2.13.1"
10+
id("org.jetbrains.changelog") version "2.5.0"
1211
}
1312

1413
group = properties("pluginGroup")
@@ -75,14 +74,6 @@ changelog {
7574
groups.set(emptyList())
7675
}
7776

78-
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
79-
qodana {
80-
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
81-
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
82-
saveReport.set(true)
83-
showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
84-
}
85-
8677
tasks {
8778
// Set the JVM compatibility versions
8879
properties("javaVersion").let {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ pluginUntilBuild = 299.*
1414

1515
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
1616
platformType = IU
17-
platformVersion = 2025.2.5
17+
platformVersion = 2025.3.4
1818

1919
# Java language level used to compile sources and to generate the files for
2020
javaVersion = 21
2121

2222
# Gradle Releases -> https://github.com/gradle/gradle/releases
23-
gradleVersion = 9.2.1
23+
gradleVersion = 9.4.1
2424

2525
# Opt-out flag for bundling Kotlin standard library.
2626
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.

gradle/wrapper/gradle-wrapper.jar

5.14 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)