Files
web/phpcs.xml
2025-12-09 22:17:50 +08:00

436 lines
19 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0"?>
<!--
~ Copyright (c) 2025, Антон Аксенов
~ This file is part of m3u.su project
~ MIT License: https://git.axenov.dev/IPTV/web/src/branch/master/LICENSE
-->
<!--
https://github.com/PHPCSStandards/PHP_CodeSniffer/tree/master/src/Standards
https://github.com/PHPCSStandards/PHPCSExtra?tab=readme-ov-file#sniffs
https://kalimah-apps.com/phpcs/docs/
https://github.com/slevomat/coding-standard
-->
<ruleset name="m3u.su Coding Standards">
<description>m3u.su Coding Standards</description>
<arg name="extensions" value="php"/>
<!--<arg name="report" value="summary"/>-->
<arg name="colors"/>
<arg name="parallel" value="5"/>
<arg name="tab-width" value="4"/>
<arg value="p"/>
<arg value="s"/>
<file>app/</file>
<file>config/</file>
<file>public/index.php</file>
<exclude-pattern>cache/</exclude-pattern>
<exclude-pattern>views/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<!-- ============================================================================================= -->
<!--<rule ref="Generic.Arrays.ArrayIndent">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Generic.Arrays.DisallowLongArraySyntax" />-->
<!--<rule ref="Generic.Classes.DuplicateClassName" />-->
<!--<rule ref="Generic.CodeAnalysis.AssignmentInCondition" />-->
<!--<rule ref="Generic.CodeAnalysis.EmptyPHPStatement" />-->
<!--<rule ref="Generic.CodeAnalysis.EmptyStatement" />-->
<!--<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />-->
<!--<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />-->
<!--<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />-->
<!--<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />-->
<!--<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />-->
<!--<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />-->
<rule ref="Generic.ControlStructures.DisallowYodaConditions" />
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="false" />
</properties>
</rule>
<rule ref="Generic.Files.ByteOrderMark" />
<rule ref="Generic.Files.EndFileNewline" />
<!--<rule ref="Generic.Files.InlineHTML" />-->
<!--<rule ref="Generic.Files.LineEndings">-->
<!-- <properties>-->
<!-- <property name="eolChar" value="\n" />-->
<!-- </properties>-->
<!--</rule>-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120" />
<property name="absoluteLineLimit" value="120" />
<property name="ignoreComments" value="false" />
</properties>
</rule>
<rule ref="Generic.Files.OneClassPerFile" />
<rule ref="Generic.Files.OneInterfacePerFile" />
<rule ref="Generic.Files.OneObjectStructurePerFile" />
<rule ref="Generic.Files.OneTraitPerFile" />
<!--<rule ref="Generic.Formatting.NoSpaceAfterCast" />-->
<!--<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />-->
<!--<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman">-->
<!-- <properties>-->
<!-- <property name="checkFunctions" value="false" />-->
<!-- <property name="checkClosures" value="false" />-->
<!-- </properties>-->
<!--</rule>-->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<!-- https://ru.wikipedia.org/wiki/Цикломатическая_сложность -->
<properties>
<!-- TODO это высокие настройки, надо понижать -->
<property name="complexity" value="7" />
<property name="absoluteComplexity" value="10" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="7" />
<property name="absoluteNestingLevel" value="10" />
</properties>
</rule>
<!--<rule ref="Generic.NamingConventions.CamelCapsFunctionName">-->
<!-- <properties>-->
<!-- <property name="strict" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<rule ref="Generic.NamingConventions.ConstructorName" />
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<rule ref="Generic.PHP.BacktickOperator" />
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />
<rule ref="Generic.PHP.DeprecatedFunctions" />
<rule ref="Generic.PHP.DisallowAlternativePHPTags" />
<rule ref="Generic.PHP.DisallowRequestSuperglobal" />
<rule ref="Generic.PHP.DisallowShortOpenTag" />
<rule ref="Generic.PHP.DiscourageGoto" />
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="eval" value="null"/>
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="join" value="implode"/>
<element key="create_function" value="null"/>
<element key="var_dump" value="null"/>
<element key="dd" value="null"/>
<element key="dump" value="null"/>
<element key="print" value="null"/>
<!--<element key="echo" value="null"/>-->
<!--<element key="print_r" value="null"/>-->
<!--<element key="var_export" value="null"/>-->
</property>
</properties>
</rule>
<rule ref="Generic.PHP.RequireStrictTypes" />
<rule ref="Generic.PHP.SAPIUsage" />
<rule ref="Generic.PHP.Syntax" />
<rule ref="Generic.VersionControl.GitMergeConflict" />
<!--<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">-->
<!-- <properties>-->
<!-- <property name="ignoreNewlines" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<!-- ============================================================================================= -->
<!--<rule ref="PEAR.Classes.ClassDeclaration" />-->
<!--<rule ref="PEAR.Commenting.InlineComment" />-->
<!--<rule ref="PEAR.ControlStructures.ControlSignature">-->
<!-- <properties>-->
<!-- <property name="ignoreComments" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PEAR.ControlStructures.MultiLineCondition">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!-- &lt;!&ndash; первый операнд в мультистроковых ифах должен быть на новой строке &ndash;&gt;-->
<!-- <exclude name="PEAR.ControlStructures.MultiLineCondition.SpacingAfterOpenBrace" />-->
<!-- &lt;!&ndash; не каждый операнд в мультистроковых ифах должен начинаться с булева оператора &ndash;&gt;-->
<!-- <exclude name="PEAR.ControlStructures.MultiLineCondition.StartWithBoolean" />-->
<!--</rule>-->
<!--<rule ref="PEAR.Functions.FunctionCallSignature">-->
<!-- &lt;!&ndash;конфликтует с PEAR.WhiteSpace.ObjectOperatorIndent&ndash;&gt;-->
<!-- <properties>-->
<!-- <property name="allowMultipleArguments" value="true" />-->
<!-- <property name="indent" value="4" />-->
<!-- <property name="requiredSpacesAfterOpen" value="0" />-->
<!-- <property name="requiredSpacesBeforeClose" value="0" />-->
<!-- </properties>-->
<!-- &lt;!&ndash; ругается на открывающие скобки в одной строке &ndash;&gt;-->
<!-- <exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />-->
<!-- &lt;!&ndash; ругается на закрывающие скобки в одной строке &ndash;&gt;-->
<!-- <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />-->
<!--</rule>-->
<!--<rule ref="PEAR.Functions.FunctionDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PEAR.Functions.ValidDefaultValue" />-->
<!--<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- <property name="multilevel" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PEAR.WhiteSpace.ScopeClosingBrace">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PEAR.WhiteSpace.ScopeIndent">-->
<!-- &lt;!&ndash; конфликтует с Generic.WhiteSpace.ScopeIndent &ndash;&gt;-->
<!-- <properties>-->
<!-- <property name="exact" value="false" />-->
<!-- <property name="tabIndent" value="false" />-->
<!-- <property name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT_OPEN_TAG,T_CASE" />-->
<!-- </properties>-->
<!--</rule>-->
<!-- ============================================================================================= -->
<!--<rule ref="PSR1.Classes.ClassDeclaration" />-->
<!--<rule ref="PSR1.Files.SideEffects" />-->
<!--<rule ref="PSR1.Methods.CamelCapsMethodName" />-->
<!-- ============================================================================================= -->
<!--<rule ref="PSR2.Classes.ClassDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR2.Classes.PropertyDeclaration" />-->
<rule ref="PSR2.ControlStructures.ControlStructureSpacing">
<!-- первый операнд в мультистроковых ифах должен быть на новой строке -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
</rule>
<!--<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />-->
<!--<rule ref="PSR2.ControlStructures.SwitchDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR2.Files.ClosingTag" />-->
<!--<rule ref="PSR2.Files.EndFileNewline" />-->
<!--<rule ref="PSR2.Methods.FunctionCallSignature">-->
<!-- <properties>-->
<!-- <property name="allowMultipleArguments" value="true" />-->
<!-- <property name="indent" value="4" />-->
<!-- <property name="requiredSpacesAfterOpen" value="0" />-->
<!-- <property name="requiredSpacesBeforeClose" value="0" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR2.Methods.FunctionClosingBrace" />-->
<!--<rule ref="PSR2.Methods.MethodDeclaration" />-->
<!--<rule ref="PSR2.Namespaces.NamespaceDeclaration" />-->
<!--<rule ref="PSR2.Namespaces.UseDeclaration" />-->
<!-- ============================================================================================= -->
<!--<rule ref="PSR12.Classes.AnonClassDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR12.Classes.ClassInstantiation" />-->
<!--<rule ref="PSR12.Classes.ClosingBrace" />-->
<!--<rule ref="PSR12.Classes.OpeningBraceSpace" />-->
<!--<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">-->
<!-- <properties>-->
<!-- <property name="allowOnly" value="first" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR12.ControlStructures.ControlStructureSpacing">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="PSR12.Files.DeclareStatement" />-->
<!--<rule ref="PSR12.Files.ImportStatement" />-->
<!--<rule ref="PSR12.Files.OpenTag" />-->
<!--<rule ref="PSR12.Functions.NullableTypeDeclaration" />-->
<!--<rule ref="PSR12.Functions.ReturnTypeDeclaration" />-->
<!--<rule ref="PSR12.Keywords.ShortFormTypeKeywords" />-->
<!--<rule ref="PSR12.Operators.OperatorSpacing" />-->
<!--<rule ref="PSR12.Properties.ConstantVisibility" />-->
<!--<rule ref="PSR12.Traits.UseDeclaration" />-->
<!-- ============================================================================================= -->
<!--<rule ref="Squiz.Arrays.ArrayBracketSpacing" />-->
<!--<rule ref="Squiz.Classes.ClassDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.Classes.ClassFileName" />-->
<!--<rule ref="Squiz.Classes.LowercaseClassKeywords" />-->
<!--<rule ref="Squiz.Classes.SelfMemberReference" />-->
<!--<rule ref="Squiz.Classes.ValidClassName" />-->
<!--<rule ref="Squiz.Commenting.DocCommentAlignment" />-->
<!--<rule ref="Squiz.Commenting.EmptyCatchComment" />-->
<!--<rule ref="Squiz.Commenting.FunctionCommentThrowTag">-->
<!-- &lt;!&ndash; не умеет считать выбросы исключений из глубины &ndash;&gt;-->
<!-- <exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber" />-->
<!--</rule>-->
<!--<rule ref="Squiz.Commenting.VariableComment">-->
<!-- &lt;!&ndash; требует длинное название типа (integer, boolean, ...) вместо нормального (int, bool, ..) &ndash;&gt;-->
<!-- <exclude name="Squiz.Commenting.VariableComment.IncorrectVarType" />-->
<!-- &lt;!&ndash; не понимает наличие аннотации между докблоком и декларацией &ndash;&gt;-->
<!-- <exclude name="Squiz.Commenting.VariableComment.WrongStyle" />-->
<!-- <exclude name="Squiz.WhiteSpace.MemberVarSpacing.Incorrect" />-->
<!--</rule>-->
<!--<rule ref="Squiz.ControlStructures.ControlSignature">-->
<!-- <properties>-->
<!-- <property name="requiredSpacesBeforeColon" value="0" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />-->
<!--<rule ref="Squiz.ControlStructures.ForLoopDeclaration">-->
<!-- <properties>-->
<!-- <property name="ignoreNewlines" value="false" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />-->
<!--<rule ref="Squiz.ControlStructures.SwitchDeclaration">-->
<!-- <properties>-->
<!-- <property name="indent" value="4" />-->
<!-- </properties>-->
<!-- &lt;!&ndash; требует выход из кейса на 1 уровне с кейсом &ndash;&gt;-->
<!-- <exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent" />-->
<!--</rule>-->
<!--<rule ref="Squiz.Functions.FunctionDeclaration">-->
<!-- <properties>-->
<!-- <property name="ignoreComments" value="false" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">-->
<!-- <properties>-->
<!-- <property name="equalsSpacing" value="1" />-->
<!-- <property name="requiredSpacesAfterOpen" value="0" />-->
<!-- <property name="requiredSpacesBeforeClose" value="0" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.Functions.FunctionDuplicateArgument" />-->
<!--<rule ref="Squiz.Functions.GlobalFunction" />-->
<!--<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />-->
<!--<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />-->
<!--<rule ref="Squiz.NamingConventions.ValidFunctionName">-->
<!-- &lt;!&ndash; требует _ в начале приватных методов &ndash;&gt;-->
<!-- <exclude name="Squiz.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />-->
<!--</rule>-->
<!--<rule ref="Squiz.Objects.DisallowObjectStringIndex" />-->
<!--<rule ref="Squiz.Objects.ObjectMemberComma" />-->
<!--<rule ref="Squiz.Operators.IncrementDecrementUsage" />-->
<!--<rule ref="Squiz.Operators.ValidLogicalOperators" />-->
<!--TODO проблема с комментариями //, которые занимают полную строку -->
<!-- <rule ref="Squiz.PHP.CommentedOutCode" /> -->
<!--<rule ref="Squiz.PHP.DiscouragedFunctions">-->
<!-- <properties>-->
<!-- <property name="error" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.PHP.Eval" />-->
<!--<rule ref="Squiz.PHP.GlobalKeyword" />-->
<!--<rule ref="Squiz.PHP.InnerFunctions" />-->
<!--<rule ref="Squiz.PHP.LowercasePHPFunctions" />-->
<!--<rule ref="Squiz.PHP.NonExecutableCode" />-->
<!--<rule ref="Squiz.Scope.MemberVarScope" />-->
<!--<rule ref="Squiz.Scope.MethodScope" />-->
<!--<rule ref="Squiz.Scope.StaticThisUsage" />-->
<!--<rule ref="Squiz.Strings.EchoedStrings" />-->
<!--<rule ref="Squiz.WhiteSpace.CastSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.ControlStructureSpacing">-->
<!-- &lt;!&ndash; первый операнд в мультистроковых ифах должен быть на новой строке &ndash;&gt;-->
<!-- <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace" />-->
<!--</rule>-->
<!--<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace" />-->
<!--<rule ref="Squiz.WhiteSpace.FunctionSpacing">-->
<!-- <properties>-->
<!-- <property name="spacing" value="1" />-->
<!-- <property name="spacingBeforeFirst" value="0" />-->
<!-- <property name="spacingAfterLast" value="0" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.MemberVarSpacing">-->
<!-- <properties>-->
<!-- <property name="spacing" value="1" />-->
<!-- <property name="spacingBeforeFirst" value="0" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">-->
<!-- <properties>-->
<!-- <property name="ignoreNewlines" value="true" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.WhiteSpace.OperatorSpacing">-->
<!-- <properties>-->
<!-- <property name="ignoreNewlines" value="true" />-->
<!-- <property name="ignoreSpacingBeforeAssignments" value="false" />-->
<!-- </properties>-->
<!--</rule>-->
<!--<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />-->
<!--<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />-->
<!--<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">-->
<!-- <properties>-->
<!-- <property name="ignoreBlankLines" value="false" />-->
<!-- </properties>-->
<!--</rule>-->
<!-- ============================================================================================= -->
</ruleset>