Skip to content

Commit ef3df8d

Browse files
committed
use Opus 4.8
1 parent d71b907 commit ef3df8d

2 files changed

Lines changed: 40 additions & 40 deletions

File tree

.github/workflows/claude-pr-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ jobs:
360360
git config user.name "phpstan-bot"
361361
git config user.email "ondrej+phpstanbot@mirtes.cz"
362362
363-
claude --model claude-opus-4-6 \
363+
claude --model claude-opus-4-8 \
364364
--dangerously-skip-permissions \
365365
--output-format text \
366366
-p "$PROMPT" \

.github/workflows/claude-update-error-docs.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ jobs:
5151
git config user.name "phpstan-bot"
5252
git config user.email "ondrej+phpstanbot@mirtes.cz"
5353
54-
claude --model claude-opus-4-6 \
54+
claude --model claude-opus-4-8 \
5555
--dangerously-skip-permissions \
5656
-p "$(cat << 'PROMPT_EOF'
5757
You are generating documentation pages for PHPStan error identifiers. PHPStan is a PHP static analysis tool that finds bugs in code without running it. Each error identifier (like `argument.type`, `deadCode.unreachable`, `property.notFound`) categorizes a specific type of error.
58-
58+
5959
The goal is to create a markdown file for each identifier in `website/errors/` explaining what the error means, showing a code example, and offering ways to fix it.
60-
60+
6161
## Step 1: Find what changed
62-
62+
6363
See the checked out commit of the current repository. It should contain changes to `website/src/errorsIdentifiers.json`. See if the diff means any identifier was added or updated.
64-
64+
6565
Read `website/src/errorsIdentifiers.json`. This JSON maps each identifier to its rule classes and source code locations:
66-
66+
6767
```json
6868
{
6969
"argument.type": {
@@ -75,21 +75,21 @@ jobs:
7575
}
7676
}
7777
```
78-
78+
7979
Then list existing files in `website/errors/`. Each file is named `<identifier>.md`.
80-
80+
8181
You will document any identifiers that do not have .md file. You will also look if any identifiers involved in the diff of the checked out commit need updating the docs.
82-
82+
8383
## Step 2: Clone required repositories
84-
84+
8585
Clone only the repositories referenced by the affected identifiers. Extract the branch name from the GitHub URLs (e.g., `blob/2.2.x/` → branch `2.2.x`).
86-
86+
8787
Use shallow clones to save time:
88-
88+
8989
```bash
9090
git clone --depth 1 --branch <branch> https://github.com/phpstan/<repo>.git /tmp/repos/<repo>
9191
```
92-
92+
9393
The possible repositories are:
9494
- `phpstan/phpstan-src` (typically branch `2.2.x`)
9595
- `phpstan/phpstan-strict-rules`
@@ -98,68 +98,68 @@ jobs:
9898
- `phpstan/phpstan-symfony`
9999
- `phpstan/phpstan-phpunit`
100100
- `phpstan/phpstan-nette`
101-
101+
102102
## Step 3: Research each identifier
103-
103+
104104
For each identifier, gather the information needed to write the documentation.
105-
105+
106106
### 3a. Read the rule source code
107-
107+
108108
From the JSON URLs, extract the file path and line number. Read the source code around those lines to find:
109-
109+
110110
1. **Error message**: Look for `RuleErrorBuilder::message('...')` — this is the exact error text PHPStan shows
111111
2. **Trigger condition**: Read the surrounding `processNode()` method to understand what code pattern causes this error
112112
3. **Tips**: Look for `->tip('...')` or `->addTip('...')` calls in the same builder chain — these often contain links to blog posts or documentation pages on phpstan.org
113113
4. **Non-ignorable**: Check for `->nonIgnorable()` in the builder chain
114-
114+
115115
### 3b. Understand the identifier prefix when source uses `$location->createIdentifier()`
116-
116+
117117
When reading the rule source code in step 3a, check whether the linked source code line uses `$location->createIdentifier()`. If it does, the identifier prefix comes from `ClassNameUsageLocation` in phpstan-src, and the prefix indicates a specific PHP language feature — which may not be obvious from the prefix name alone.
118-
118+
119119
If the source code does **not** use `$location->createIdentifier()`, the prefix is set directly by the rule and typically describes its PHP feature straightforwardly.
120-
120+
121121
Consult the "Identifier prefix reference" section in `website/errors/CLAUDE.md` for the complete prefix-to-PHP-feature mapping tables.
122-
122+
123123
### 3c. Find test fixtures with code examples
124-
124+
125125
For a rule class like `PHPStan\Rules\Functions\CallToFunctionParametersRule`:
126126
- Test class: `tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php`
127127
- Test data: `tests/PHPStan/Rules/Functions/data/*.php`
128-
128+
129129
For extension repos (phpstan-doctrine, phpstan-symfony, etc.), the path pattern may differ — check `tests/Rules/` or `tests/` directories.
130-
130+
131131
Read the test class to find which data files trigger this specific identifier. Look for the error message text in the test assertions:
132-
132+
133133
```php
134134
$this->analyse([__DIR__ . '/data/someFile.php'], [
135135
['Error message text', 42],
136136
]);
137137
```
138-
138+
139139
Then read the corresponding data file to extract a minimal code example.
140-
140+
141141
### 3d. Determine if the error is ignorable
142-
142+
143143
An error identifier is **not ignorable** if:
144144
- The source code uses `->nonIgnorable()` in the error builder chain
145145
- The identifier starts with `phpstan.` (internal PHPStan errors)
146146
- The identifier starts with `phpstanPlayground.` (playground-specific)
147-
147+
148148
All other identifiers are ignorable.
149-
149+
150150
### 3e. Check for configuration options
151-
151+
152152
Some rules accept constructor parameters from PHPStan configuration. Look at the rule class constructor for injected config values. Cross-reference with `website/src/config-reference.md` to find the documented parameter name.
153-
153+
154154
Examples of configurable rules:
155155
- Rules that check strict types may be controlled by `treatPhpDocTypesAsCertain`
156156
- Dead code rules may be controlled by `checkAlwaysTrueCheckTypeFunctionCall`
157157
- Some rules are only active at certain PHPStan levels
158-
158+
159159
## Step 4: Generate markdown files
160-
160+
161161
Create `website/errors/` directory if it doesn't exist.
162-
162+
163163
For each identifier, create `website/errors/<identifier>.md` following the file format, content guidelines, and tone described in `website/errors/CLAUDE.md`. Read that file before generating any markdown.
164164
165165
Each file's frontmatter MUST include a `shortDescription` field — one sentence (ending with a period) describing when the error is reported, from a user's perspective. For example: `"Accessing a private property from outside the declaring class."` or `"Loose comparison using == will always evaluate to true."`. This description should capture the essence of the error — what code pattern triggers it — without mentioning PHPStan internals.
@@ -170,13 +170,13 @@ jobs:
170170
171171
1. /tmp/commit-message.txt - A concise commit message (first line: short summary under 72 chars, then a blank line, then a few bullet points describing key changes). Example:
172172
Update error docs - added new `new.trait` identifier
173-
173+
174174
More detailed description of the commit
175175
2. /tmp/pr-description.md - A pull request description in this format:
176176
What was the work involved in updating the docs.
177177
178178
These files are critical - they will be used for the commit message and PR description.
179-
179+
180180
PROMPT_EOF
181181
)"
182182

0 commit comments

Comments
 (0)