xml DOCT

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml DOCT相关的知识,希望对你有一定的参考价值。

<?xml version="1.0"?>
<ruleset
    name="Doctrine"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
    <description>The Doctrine coding standard.</description>

    <!-- Import PSR-2 coding standard (base) -->
    <rule ref="PSR2">
        <!-- checked by SlevomatCodingStandard.Namespaces.UseSpacing -->
        <exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
        <!-- checked by SlevomatCodingStandard.Namespaces.NamespaceSpacing -->
        <exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
    </rule>

    <!-- Force array element indentation with 4 spaces -->
    <rule ref="Generic.Arrays.ArrayIndent"/>
    <!-- Forbid `array(...)` -->
    <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
    <!-- Forbid duplicate classes -->
    <rule ref="Generic.Classes.DuplicateClassName"/>
    <!-- Forbid empty statements -->
    <rule ref="Generic.CodeAnalysis.EmptyStatement">
        <!-- But allow empty catch -->
        <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
    </rule>
    <!-- Forbid final methods in final classes -->
    <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
    <!-- Forbid useless empty method overrides -->
    <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
    <!-- Forbid inline HTML in PHP code -->
    <rule ref="Generic.Files.InlineHTML"/>
    <!-- Align corresponding assignment statement tokens -->
    <rule ref="Generic.Formatting.MultipleStatementAlignment">
        <properties>
            <property name="error" value="true"/>
        </properties>
    </rule>
    <!-- Force whitespace after a type cast -->
    <rule ref="Generic.Formatting.SpaceAfterCast"/>
    <!-- Force whitespace after `!` -->
    <rule ref="Generic.Formatting.SpaceAfterNot"/>
    <!-- Forbid PHP 4 constructors -->
    <rule ref="Generic.NamingConventions.ConstructorName"/>
    <!-- Forbid any content before opening tag -->
    <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
    <!-- Forbid deprecated functions -->
    <rule ref="Generic.PHP.DeprecatedFunctions"/>
    <!-- Forbid alias functions, i.e. `sizeof()`, `delete()` -->
    <rule ref="Generic.PHP.ForbiddenFunctions">
        <properties>
            <property
                name="forbiddenFunctions"
                type="array"
                value="
                    chop => rtrim,
                    close => closedir,
                    compact => null,
                    delete => unset,
                    doubleval => floatval,
                    extract => null,
                    fputs => fwrite,
                    ini_alter => ini_set,
                    is_double => is_float,
                    is_integer => is_int,
                    is_long => is_int,
                    is_null => null,
                    is_real => is_float,
                    is_writeable => is_writable,
                    join => implode,
                    key_exists => array_key_exists,
                    pos => current,
                    settype => null,
                    show_source => highlight_file,
                    sizeof => count,
                    strchr => strstr
                "/>
        </properties>
    </rule>
    <!-- Forbid useless inline string concatenation -->
    <rule ref="Generic.Strings.UnnecessaryStringConcat">
        <!-- But multiline is useful for readability -->
        <properties>
            <property name="allowMultiline" value="true"/>
        </properties>
    </rule>
    <!-- Forbid backtick operator -->
    <rule ref="Generic.PHP.BacktickOperator"/>
    <!-- Forbid `php_sapi_name()` function -->
    <rule ref="Generic.PHP.SAPIUsage"/>
    <!-- Forbid comments starting with # -->
    <rule ref="PEAR.Commenting.InlineComment"/>
    <!-- Disallow else if in favor of elseif -->
    <rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
        <type>error</type>
    </rule>
    <!-- Require comma after last element in multi-line array -->
    <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
    <!-- Require presence of constant visibility -->
    <rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">
        <properties>
            <property name="fixable" type="boolean" value="true"/>
        </properties>
    </rule>
    <!-- Forbid dead code -->
    <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/>
    <!-- Forbid suffix "Abstract" for abstract classes -->
    <rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
    <!-- Forbid suffix "Exception" for exception classes -->
    <rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
    <!-- Forbid suffix "Interface" for interfaces -->
    <rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
    <!-- Forbid useless annotations - Git and LICENCE file provide more accurate information -->
    <rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
        <properties>
            <property
                name="forbiddenAnnotations"
                type="array"
                value="
                    @api,
                    @author,
                    @category,
                    @copyright,
                    @created,
                    @license,
                    @package,
                    @since,
                    @subpackage,
                    @version
                "
            />
        </properties>
    </rule>
    <!-- Forbid empty comments -->
    <rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
    <!-- Forbid useless comments -->
    <rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
        <properties>
            <property
                name="forbiddenCommentPatterns"
                type="array"
                value="
                    ~^(?:(?!private|protected|static)\S+ )?(?:con|de)structor\.\z~i,
                    ~^Created by \S+\.\z~i,
                    ~^\S+ [gs]etter\.\z~i,
                " />
        </properties>
    </rule>
    <!-- report invalid format of inline phpDocs with @var -->
    <rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
    <!-- Require comments with single line written as one-liners -->
    <rule ref="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
    <!-- Forbid assignments in conditions -->
    <rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
    <!-- Forbid fancy yoda conditions -->
    <rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
    <!-- Forbid weak comparisons -->
    <rule ref="SlevomatCodingStandard.ControlStructures.DisallowEqualOperators"/>
    <!-- Require usage of early exit -->
    <rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
    <!-- Require language constructs without parentheses -->
    <rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses"/>
    <!-- Require new instances with parentheses -->
    <rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
    <!-- Require usage of null coalesce operator when possible -->
    <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
    <!-- Forbid useless unreachable catch blocks -->
    <rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
    <!-- Require using Throwable instead of Exception -->
    <rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
    <!-- Require use statements to be alphabetically sorted -->
    <rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
    <!-- Forbid fancy group uses -->
    <rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
    <!-- Forbid multiple use statements on same line -->
    <rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
    <!-- Require newlines around namespace declaration -->
    <rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing"/>
    <!-- Forbid using absolute class name references (except global ones) -->
    <rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
        <properties>
            <property name="allowFallbackGlobalConstants" type="boolean" value="false"/>
            <property name="allowFallbackGlobalFunctions" type="boolean" value="false"/>
            <property name="allowFullyQualifiedGlobalClasses" type="boolean" value="false"/>
            <property name="allowFullyQualifiedGlobalConstants" type="boolean" value="false"/>
            <property name="allowFullyQualifiedGlobalFunctions" type="boolean" value="false"/>
            <property name="allowFullyQualifiedNameForCollidingClasses" type="boolean" value="true"/>
            <property name="allowFullyQualifiedNameForCollidingConstants" type="boolean" value="true"/>
            <property name="allowFullyQualifiedNameForCollidingFunctions" type="boolean" value="true"/>
            <property name="searchAnnotations" type="boolean" value="true"/>
        </properties>
    </rule>
    <!-- Forbid unused use statements -->
    <rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
        <properties>
            <property name="searchAnnotations" type="boolean" value="true"/>
        </properties>
    </rule>
    <!-- Forbid superfluous leading backslash in use statements -->
    <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
    <!-- Forbid useless uses of the same namespace -->
    <rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
    <!-- Require empty newlines before and after uses -->
    <rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
        <properties>
            <property name="linesCountAfterLastUse" value="1"/>
            <property name="linesCountBeforeFirstUse" value="1"/>
            <property name="linesCountBetweenUseTypes" value="0"/>
        </properties>
    </rule>
    <!-- Forbid `list(...)` syntax -->
    <rule ref="SlevomatCodingStandard.PHP.ShortList"/>
    <!-- Forbid use of longhand cast operators -->
    <rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
    <!-- Require presence of declare(strict_types=1) -->
    <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
        <properties>
            <property
                name="newlinesCountBetweenOpenTagAndDeclare"
                value="2"
            />
            <property
                name="spacesCountAroundEqualsSign"
                value="0"
            />
            <property
                name="newlinesCountAfterDeclare"
                value="2"
            />
        </properties>
    </rule>
    <!-- Require use of short versions of scalar types (i.e. int instead of integer) -->
    <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
    <!-- Require ? when default value is null -->
    <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
    <!-- Require one space between typehint and variable, require no space between nullability sign and typehint -->
    <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
    <!-- Require space around colon in return types -->
    <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
        <properties>
            <property name="spacesCountBeforeColon" value="1"/>
        </properties>
    </rule>
    <!-- Require types to be written as natively if possible;
         require iterable types to specify phpDoc with their content;
         forbid useless/duplicated information in phpDoc -->
    <rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
        <properties>
            <property name="enableEachParameterAndReturnInspection" value="true"/>
            <property name="traversableTypeHints" type="array" value="Doctrine\Common\Collections\Collection"/>
            <property
                name="usefulAnnotations"
                type="array"
                value="
                    @after,
                    @afterClass,
                    @AfterMethods,
                    @Attribute,
                    @Attributes,
                    @before,
                    @beforeClass,
                    @BeforeMethods,
                    @covers,
                    @coversDefaultClass,
                    @coversNothing,
                    @dataProvider,
                    @depends,
                    @deprecated,
                    @doesNotPerformAssertions,
                    @Enum,
                    @expectedDeprecation,
                    @expectedException,
                    @expectedExceptionCode,
                    @expectedExceptionMessage,
                    @expectedExceptionMessageRegExp,
                    @group,
                    @Groups,
                    @IgnoreAnnotation,
                    @internal,
                    @Iterations,
                    @link,
                    @ODM\,
                    @ORM\,
                    @requires,
                    @Required,
                    @Revs,
                    @runInSeparateProcess,
                    @runTestsInSeparateProcesses,
                    @see,
                    @Target,
                    @test,
                    @throws,
                    @uses
                "
            />
        </properties>
    </rule>
    <!-- Forbid empty lines around type declarations -->
    <rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces">
        <properties>
            <property name="linesCountAfterOpeningBrace" value="0"/>
            <property name="linesCountBeforeClosingBrace" value="0"/>
        </properties>
    </rule>
    <!-- Forbid spaces around square brackets -->
    <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
    <!-- Force array declaration structure -->
    <rule ref="Squiz.Arrays.ArrayDeclaration">
        <!-- Disable arrow alignment -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
        <!-- Uses indentation of only single space -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
        <!-- Allow multiple values on a single line -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
        <!-- Disable alignment of braces -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
        <!-- Disable alignment of values with opening brace -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
        <!-- Checked by SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma -->
        <exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
    </rule>
    <!-- Forbid class being in a file with different name -->
    <rule ref="Squiz.Classes.ClassFileName"/>
    <!-- Force `self::` for self-reference, force lower-case self, forbid spaces around `::` -->
    <rule ref="Squiz.Classes.SelfMemberReference"/>
    <!-- Force phpDoc alignment -->
    <rule ref="Squiz.Commenting.DocCommentAlignment">
        <!-- Allow extra spaces after star, i.e. for indented annotations -->
        <exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar"/>
    </rule>
    <!-- Force rules for function phpDoc -->
    <rule ref="Squiz.Commenting.FunctionComment">
        <!-- Allow `@throws` without description -->
        <exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
        <!-- Does not work properly with PHP 7 / short-named types -->
        <exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
        <!-- Does not support collections, i.e. `string[]` -->
        <exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
        <!-- Forces incorrect types -->
        <exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
        <!-- Breaks with compound return types, i.e. `string|null` -->
        <exclude name="Squiz.Commenting.FunctionComment.InvalidReturnNotVoid"/>
        <!-- Breaks when all params are not documented -->
        <exclude name="Squiz.Commenting.FunctionComment.InvalidTypeHint"/>
        <!-- Doc comment is not required for every method -->
        <exclude name="Squiz.Commenting.FunctionComment.Missing"/>
        <!-- Do not require comments for `@param` -->
        <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
        <!-- Do not require `@param` for all parameters -->
        <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
        <!-- Do not require `@return` for void methods -->
        <exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
        <!-- Comments don't have to be sentences -->
        <exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
        <!-- Comments don't have to be sentences -->
        <exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
        <!-- Breaks when all params are not documented -->
        <exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
        <!-- Doesn't respect inheritance -->
        <exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
        <!-- Doesn't work with self as typehint -->
        <exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
    </rule>
    <!-- Forbid global functions -->
    <rule ref="Squiz.Functions.GlobalFunction"/>
    <!-- Forbid `AND` and `OR`, require `&&` and `||` -->
    <rule ref="Squiz.Operators.ValidLogicalOperators"/>
    <!-- Forbid `global` -->
    <rule ref="Squiz.PHP.GlobalKeyword"/>
    <!-- Forbid functions inside functions -->
    <rule ref="Squiz.PHP.InnerFunctions"/>
    <!-- Require PHP function calls in lowercase -->
    <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
    <!-- Forbid dead code -->
    <rule ref="Squiz.PHP.NonExecutableCode"/>
    <!-- Forbid `$this` inside static function -->
    <rule ref="Squiz.Scope.StaticThisUsage"/>
    <!-- Force whitespace before and after concatenation -->
    <rule ref="Squiz.Strings.ConcatenationSpacing">
        <properties>
            <property name="spacing" value="1"/>
            <property name="ignoreNewlines" value="true"/>
        </properties>
    </rule>
    <!-- Forbid strings in `"` unless necessary -->
    <rule ref="Squiz.Strings.DoubleQuoteUsage"/>
    <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
        <message>Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead</message>
    </rule>
    <!-- Forbid braces around string in `echo` -->
    <rule ref="Squiz.Strings.EchoedStrings"/>
    <!-- Forbid spaces in type casts -->
    <rule ref="Squiz.WhiteSpace.CastSpacing"/>
    <!-- Forbid blank line after function opening brace -->
    <rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
    <!-- Require space after language constructs -->
    <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
    <!-- Require space around logical operators -->
    <rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
    <!-- Forbid spaces around `->` operator -->
    <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
        <properties>
            <property name="ignoreNewlines" value="true"/>
        </properties>
    </rule>
    <!-- Forbid spaces before semicolon `;` -->
    <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
    <!-- Forbid superfluous whitespaces -->
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
        <properties>
            <!-- turned on by PSR2 -> turning back off -->
            <property name="ignoreBlankLines" value="false"/>
        </properties>
    </rule>
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
        <!-- turned off by PSR2 -> turning back on -->
        <severity>5</severity>
    </rule>
</ruleset>

以上是关于xml DOCT的主要内容,如果未能解决你的问题,请参考以下文章

python基本数据结果及用法(str,list,tuple,doct,set) 笔记

Hibernate的关联关系映射

hibernate的helloworld实现

Jquery立即隐藏元素

jsp写分页

获取DOM元素样式