Skip to content

Class Rules

Class \Klitsche\Dog\Analyzer\Rules

Constants

DEFAULT

public DEFAULT = [
    // DocBlock
    'PublicFileDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'notice', 'match' => ['getElementType' => 'File', 'isInternal' => false]],
    'PublicClassDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'warning', 'match' => ['getElementType' => 'Class', 'isInternal' => false]],
    'PublicTraitDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'warning', 'match' => ['getElementType' => 'Trait', 'isInternal' => false]],
    'PublicInterfaceDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'warning', 'match' => ['getElementType' => 'Interface', 'isInternal' => false]],
    'PublicMethodDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'warning', 'match' => ['getElementType' => 'Method', 'isPublic' => true, 'isInternal' => false]],
    'PublicPropertyDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'notice', 'match' => ['getElementType' => 'Property', 'isPublic' => true, 'isInternal' => false]],
    'PublicFunctionDocBlockMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMissingRule::class, 'issueLevel' => 'notice', 'match' => ['getElementType' => 'Function', 'isInternal' => false]],
    'PublicDocBlockSummaryMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockSummaryMissingRule::class, 'issueLevel' => 'warning', 'match' => ['isInternal' => false, 'isPublic' => true]],
    'PublicDocBlockDescriptionMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockDescriptionMissingRule::class, 'issueLevel' => 'notice', 'match' => ['isInternal' => false, 'isPublic' => true]],
    // Invalid DocBlock Tag
    'DocBlockInvalidTagsRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockInvalidTagRule::class, 'issueLevel' => 'error'],
    // @api
    'DocBlockApiNoDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockApiNoDescriptionRule::class, 'issueLevel' => 'warning'],
    'DocBlockApiNotInternalRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockApiNotInternalRule::class, 'issueLevel' => 'error'],
    'DocBlockApiVisibilityPublicRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockApiVisibilityPublicRule::class, 'issueLevel' => 'error'],
    // @author
    'DocBlockAuthorNameMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockAuthorNameMissingRule::class, 'issueLevel' => 'error'],
    'DocBlockAuthorEmailRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockAuthorEmailRule::class, 'issueLevel' => 'notice'],
    // @copyright
    'FileDocBlockCopyrightMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockCopyrightMissingRule::class, 'issueLevel' => 'notice', 'match' => ['getElementType' => 'File', 'isInternal' => false]],
    'DocBlockCopyrightYearRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockCopyrightYearRule::class, 'issueLevel' => 'warning'],
    // @deprecated
    'DocBlockDeprecatedVersionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockDeprecatedVersionRule::class, 'issueLevel' => 'warning'],
    'DocBlockDeprecatedCorrespondingSeeRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockDeprecatedCorrespondingSeeRule::class, 'issueLevel' => 'warning'],
    'DocBlockDeprecatedDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockDeprecatedDescriptionRule::class, 'issueLevel' => 'notice'],
    // @license
    'FileDocBlockLicenseMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockLicenseMissingRule::class, 'issueLevel' => 'notice', 'match' => ['getElementType' => 'File', 'isInternal' => false]],
    // @link
    'FileDocBlockLinkMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockLinkMissingRule::class, 'issueLevel' => 'ignore', 'match' => ['getElementType' => 'File', 'isInternal' => false]],
    'DocBlockLinkUrlRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockLinkUrlRule::class, 'issueLevel' => 'error', 'match' => ['isInternal' => false, 'isPublic' => true]],
    'DocBlockLinkDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockLinkDescriptionRule::class, 'issueLevel' => 'notice', 'match' => ['isInternal' => false, 'isPublic' => true]],
    // @method - see also type & description rules
    'DocBlockMethodAllowedRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockMethodAllowedRule::class, 'issueLevel' => 'error'],
    // @param
    'DocBlockParamAllowedRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockParamAllowedRule::class, 'issueLevel' => 'error'],
    'DocBlockParamNameOnlyOnceRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockParamNameOnlyOnceRule::class, 'issueLevel' => 'error'],
    'DocBlockParamTypeRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockParamTypeRule::class, 'issueLevel' => 'error'],
    'DocBlockParamUnknownRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockParamUnknownRule::class, 'issueLevel' => 'error'],
    'PublicDocBlockParamDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockParamDescriptionRule::class, 'issueLevel' => 'notice', 'match' => ['isInternal' => false, 'isPublic' => true]],
    // @return
    'DocBlockReturnAllowedRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockReturnAllowedRule::class, 'issueLevel' => 'error'],
    'DocBlockReturnOnlyOnceRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockReturnOnlyOnceRule::class, 'issueLevel' => 'error'],
    'PublicDocBlockReturnDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockReturnDescriptionRule::class, 'issueLevel' => 'notice', 'match' => ['isPublic' => true, 'isInternal' => false]],
    // @see
    'DocBlockSeeDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockSeeDescriptionRule::class, 'issueLevel' => 'warning'],
    // @since
    'DocBlockSinceDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockSinceDescriptionRule::class, 'issueLevel' => 'notice'],
    'DocBlockSinceVersionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockSinceVersionRule::class, 'issueLevel' => 'warning'],
    // @version
    'DocBlockVersionDescriptionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockVersionDescriptionRule::class, 'issueLevel' => 'notice'],
    'DocBlockVersionVersionRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\DocBlockVersionVersionRule::class, 'issueLevel' => 'warning'],
    // element
    'TypeMissingRule' => ['class' => \Klitsche\Dog\Analyzer\Rules\TypeMissingRule::class, 'issueLevel' => 'warning'],
]

Methods

__construct()

public __construct ( 
    \Klitsche\Dog\Analyzer\RuleInterface $rules
 ): 
Parameters
rules \Klitsche\Dog\Analyzer\RuleInterface

analyze()

public analyze ( 
    \Klitsche\Dog\Elements\ElementInterface $element
 ): \Klitsche\Dog\Analyzer\Issue[]
Parameters
element \Klitsche\Dog\Elements\ElementInterface
Returns
\Klitsche\Dog\Analyzer\Issue[]

createFromConfig()

public static createFromConfig ( 
    \Klitsche\Dog\ConfigInterface $config
 ): mixed
Parameters
config \Klitsche\Dog\ConfigInterface
Returns
mixed

getRules()

public getRules (  ): \Klitsche\Dog\Analyzer\RuleInterface[]
Returns
\Klitsche\Dog\Analyzer\RuleInterface[]

Test Coverage 💚

  • 💚 Lines: 100% (73 / 73)
  • 💚 Methods: 100% (7 / 7)