Pay down the two baselined PHPMD complexity findings in NamedParametersSniff
phpmd.baseline.xml was introduced in the chore/measure-strict-gate-2026-08-02 PR ("make composer check:strict an honest gate"). It contains exactly two entries, and this issue tracks removing both.
The two baselined findings
| rule |
location |
measured |
threshold |
WeightedMethodCount (ExcessiveClassComplexity) |
NamedParametersSniff class |
65 |
50 |
CyclomaticComplexity |
NamedParametersSniff::hasUnnamedArguments() |
20 |
15 |
Measured with ./vendor/bin/phpmd phpcs-custom-sniffs text phpmd.xml inside nextcloud:32-apache (PHP 8.3.32).
Why they were baselined rather than fixed
Neither is a defect — both are complexity/style findings, and they are largely inherent to hand-written PHP token-stream parsing, which is unavoidably branchy.
They were not fixed in that PR on purpose: reducing them means restructuring the control flow of the sniff that enforces our fleet-wide named-parameter rule, and that PR's own finding was that this file had never been linted or analysed at all (every tool was aimed at a lib/ directory that does not exist in this repo). Changing the behaviour of an unproven sniff inside a gate-repair PR would have been the wrong risk to take.
The baseline entries are pinned to a specific rule + file (+ method), so any new complexity violation still fails the gate. Verified with a positive control.
What to do
- Extract the argument-scanning branches of
hasUnnamedArguments() into small named helpers (the T_* token dispatch is the bulk of the 20).
- Re-run
./vendor/bin/phpmd phpcs-custom-sniffs text phpmd.xml.
- Delete the corresponding entries from
phpmd.baseline.xml — and delete the file entirely once both are gone.
- The sniff has no test suite. Adding one before refactoring is strongly preferable, since the sniff is what enforces the named-parameter rule across the fleet.
Related, worth doing first
phpcs-custom-sniffs/CustomSniffs/Sniffs/Functions/NamedParametersSniff.php is byte-identical across openklant, opentalk, openzaak and valtimo — and so is this debt, this baseline, and this issue. The sniff should live in one shared package consumed by all four rather than being copy-pasted; otherwise this refactor has to be done four times and the copies will drift.
Pay down the two baselined PHPMD complexity findings in
NamedParametersSniffphpmd.baseline.xmlwas introduced in thechore/measure-strict-gate-2026-08-02PR ("makecomposer check:strictan honest gate"). It contains exactly two entries, and this issue tracks removing both.The two baselined findings
WeightedMethodCount(ExcessiveClassComplexity)NamedParametersSniffclassCyclomaticComplexityNamedParametersSniff::hasUnnamedArguments()Measured with
./vendor/bin/phpmd phpcs-custom-sniffs text phpmd.xmlinsidenextcloud:32-apache(PHP 8.3.32).Why they were baselined rather than fixed
Neither is a defect — both are complexity/style findings, and they are largely inherent to hand-written PHP token-stream parsing, which is unavoidably branchy.
They were not fixed in that PR on purpose: reducing them means restructuring the control flow of the sniff that enforces our fleet-wide named-parameter rule, and that PR's own finding was that this file had never been linted or analysed at all (every tool was aimed at a
lib/directory that does not exist in this repo). Changing the behaviour of an unproven sniff inside a gate-repair PR would have been the wrong risk to take.The baseline entries are pinned to a specific rule + file (+ method), so any new complexity violation still fails the gate. Verified with a positive control.
What to do
hasUnnamedArguments()into small named helpers (theT_*token dispatch is the bulk of the 20)../vendor/bin/phpmd phpcs-custom-sniffs text phpmd.xml.phpmd.baseline.xml— and delete the file entirely once both are gone.Related, worth doing first
phpcs-custom-sniffs/CustomSniffs/Sniffs/Functions/NamedParametersSniff.phpis byte-identical acrossopenklant,opentalk,openzaakandvaltimo— and so is this debt, this baseline, and this issue. The sniff should live in one shared package consumed by all four rather than being copy-pasted; otherwise this refactor has to be done four times and the copies will drift.