0

I've read the documentation from PhpStan and Psalm, and i couldn't find the rules where it checks the Cyclomatic Complexity like Phpmd does here

Also, is it possible to cusomise rules within levels for PhpStan and Psalm? Looking for a source.

Mali C.
  • 11
  • 4
  • 1
    PHPStan does not check cyclomatic complexity but [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) does, there's a sniff called `Generic.Metrics.CyclomaticComplexity` with configurable trigger levels. – Alex Howansky May 22 '23 at 19:54

1 Answers1

0

Psalm has a ComplexMethod check. Internally, it uses two metrics for this: "method graph size" and "average path length". Not sure if that corresponds to the cyclomatic complexity though

orklah
  • 81
  • 2
  • can you please share more details? on which level psalm does that and which rule is that? – Mali C. May 23 '23 at 07:43
  • 2
    It is opt-in. You can enable it in `psalm.xml` by adding the `limitMethodComplexity="true"` attribute to the root `` element. – weirdan May 23 '23 at 11:16