Repository navigation
Conversation
…Symfony among those the packages bring
…ich init proposes for a project formatted by Pint PER Coding Style with what Pint 1.32 decides otherwise and without what it leaves to the author: the concatenation without spaces, `! $x`, `new Foo`, `fn ($x) =>`, the trailing comma in arrays alone, a blank line before `return` and `continue`, the enum cases kept together, the names in doc comments imported, and no construct spread for its width. A standard of the core beside the others, so the reference, explain and init list it with them; init writes it where the project requires laravel/pint, the standard of the preset a pint.json names, laravel without one.
dresscode init measures the code of a project and writes the configuration that fits it, each decision with its description.
… in the style the project keeps dresscode upgrade lays the set deprecations, with --modernize also modernizations, over the presets the configuration uses and beneath its own decisions and overrides, so that what the project keeps stays kept, lets in the plugins of the packages of upgrading data, adds the types of the code and fixes. Without a configuration file it takes the directory as a whole and no style. With one it keeps the scope, the target, the types, fixRisky, the baseline and the maps, and of the style only the decisions the code keeps: a check without the types and the sets runs first, every decision it finds violated anywhere is left out, and the run is narrowed by only to the rest, the sets and the packages whose data reach the project, which a worker gets through --only. It takes --only, --fix-risky and --ask-risky, and the summary names upgrade --ask-risky for the risky fixes left. The upgrade goes to the lowest versions of PHP and of the libraries the project allows; the console says which libraries it takes, which packages are installed newer than that, whose declarations then say nothing of what it deprecates, advising composer update --prefer-lowest, and, where it rewrote a file, to run it again.
…beside DressCode A package of upgrading data says which packages it is about under extra.dresscode.packages, and UpgradingTester::collectPackageProblems() refuses a list that is not exactly the packages its upgrading files are about. upgrade learns of the packages from Packagist, asked once a day and remembered in the cache directory, for now of the vendor dresscode alone, and PackageDiscovery finds those installed beside DressCode by their type dresscode-plugin, not only those of the project. A project requiring one of their libraries itself, not one where it comes with another library, gets a missing package installed first: composer require into the installation of DressCode, or require --dev into the project where its lock holds DressCode, in a terminal after asking and without one only with --yes, otherwise it refuses with the command to run. The command then runs anew in a new process, whose autoloader knows the installed packages and the plugin dresscode/upgrade-nette brings.
The configurations and the suppressions of PHP CS Fixer, PHP_CodeSniffer and Slevomat translated to the decisions of DressCode.
… the workers included `--profile <file>` writes as JSON where the time of a run went, in nanoseconds: the phases (the start of the process, the start of the container of PHPStan or of a derived one and its scopes, the parse, the passes, the gaps, the print, the cycle collection, the run as a whole), every rule by the time of its callbacks, how often they ran and how often they changed the tree, every gap rule by the time of its claims, every file with its size, rounds and passes, and the peak memory of every process. A worker measures its own files and hands that over with every result and the parent adds it up, so the totals do not depend on the number of workers. A run with the option leaves the result cache out, a file served from the cache having nothing to measure. It says where the time of a run goes, not only how much of it: a comparison of two revisions then names the rule or the claim that moved. Without the option the engine only asks whether there is a profiler, and wraps a claim in a measurement only when there is one.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the doc-comment placement changes.
No open issues 🎉
What changed in this PR
Extends DressCode’s phpdoc.aboveAttributes rule to move doc comments found between attribute groups above the first attribute, preserving their order.
Changes:
- Inspect later attribute groups as well as the declaration for misplaced doc comments.
- Extract comment placement into a helper.
- Add fixtures covering interleaved doc comments, trailing attribute comments, and same-line attribute groups.
| File | Description |
|---|---|
| tests/DressCode/Rules/fixtures/phpdocAboveAttributes/between.violations | Records expected diagnostic locations. |
| tests/DressCode/Rules/fixtures/phpdocAboveAttributes/between.expected | Defines expected doc-comment placement. |
| tests/DressCode/Rules/fixtures/phpdocAboveAttributes/between.code | Adds attribute and doc-comment test cases. |
| src/Rules/PhpDoc/PhpdocAboveAttributesRule.php | Expands doc-comment detection and extracts placement logic. |
Review effort: Balanced
…ve them too, the doc comments of a declaration keeping their order Co-Authored-By: Claude Code Claude-Session: https://claude.ai/code/session_01D1mfZTuCXTAaFC39NM1xdk
JanTvrdik
force-pushed
the
jt-phpdoc-between-attributes
branch
from
October 28, 2026 22:18
41f6a6b to
d64900a
Compare
dg
force-pushed
the
master
branch
2 times, most recently
from
October 29, 2026 01:55
89af10b to
332227b
Compare
Owner
|
Thank you, merged into master. |
dg
pushed a commit
that referenced
this pull request
Oct 30, 2026
…ve them too, the doc comments of a declaration keeping their order (#4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
phpdoc.aboveAttributes: requiredmoved a doc comment only when it stood between the last attribute and the declaration. A doc comment between two attributes stayed where it was:PER Coding Style (§12.2) wants the docblock first, then the attributes, then the structure.
SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment, which translates to this decision, reports this case too. The rule now also reads the leading trivia of every attribute group after the first one, and moves each doc comment it finds there above the first attribute.It moves them all in one pass and keeps their order. This changes one case on
master, which moved only the last doc comment in a pass and so reversed two of them,#[A] /** one */ /** two */ public $xbecoming/** two */ /** one */ #[A] public $x. That also changed whatgetDocComment()returns, from/** two */to/** one */.What stays as before: a doc comment on the line of an attribute (
#[A] /** d */ #[B]) is trailing trivia of the], and the rule leaves it, as the#[Attr] /** inline */case ofbasic.codeshows. Slevomat reports that one-line case as well, so the decision stays narrower than the sniff there.Fixture:
phpdocAboveAttributes/between: a doc comment between attribute groups, with a comment after an attribute, after two groups on one line, two doc comments keeping their order, one between the groups and one before the declaration, one above the attributes and one between them, the one-line case staying, and a class constant, a promoted parameter and an enum case.Locally, all checks give the same results as on
master: theforbiddenPhpdocLinesfixture fails, and PHPStan reports the error intests/bootstrap.php, plus three errors inNativeType.phpandPhpdocTypeNotationVisitor.phpwith a freshcomposer install(phpstan/phpdoc-parser2.4.0). Upstream CI has not run on this PR yet.Co-Authored-By: Claude Code
https://claude.ai/code/session_01D1mfZTuCXTAaFC39NM1xdk