coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

Feature: add a sniff to limit the number of class, trait and interface methods

Open aadmathijssen opened this issue 3 years ago • 0 comments

This PR adds the SlevomatCodingStandard.Classes.MethodPerClassLimit sniff which allows the user to limit the number of allowed methods per class, trait, interface or anonymous class. The number of allowed methods can be configured via the maxMethodCount property which defaults to 10.

This sniff can be used as a replacement for the abandoned ObjectCalisthenics.Metrics.MethodPerClassLimit sniff. However, that sniff does not support anonymous classes, or functions defined within class methods. Both are supported by the sniff in this PR.

This PR is related to issue #1099.

aadmathijssen avatar Apr 30 '21 19:04 aadmathijssen