mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
style: update code style and phpcs rules
This commit is contained in:
195
.phpcs.xml.dist
195
.phpcs.xml.dist
@@ -1,7 +1,134 @@
|
|||||||
<ruleset name="Heimerdinger">
|
<?xml version="1.0"?>
|
||||||
<description>Heimerdinger PHP CS rules for Laravel</description>
|
<ruleset name="Laravel Standards">
|
||||||
|
<description>PSR-2 The Laravel conventions</description>
|
||||||
|
<rule ref="Generic.Classes.DuplicateClassName">
|
||||||
|
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
|
||||||
|
<exclude-pattern>/app/Http/Resources/*\.php</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||||
|
<rule ref="Generic.Commenting.DocComment">
|
||||||
|
<exclude name="Generic.Commenting.DocComment.TagValueIndent"/>
|
||||||
|
<exclude name="Generic.Commenting.DocComment.NonParamGroup"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
||||||
|
<rule ref="Generic.Files.ByteOrderMark"/>
|
||||||
|
<rule ref="Generic.Files.LineEndings">
|
||||||
|
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||||
|
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
||||||
|
<rule ref="Generic.Functions.CallTimePassByReference"/>
|
||||||
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||||
|
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
||||||
|
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||||
|
<properties>
|
||||||
|
<property name="complexity" value="20"/>
|
||||||
|
<property name="absoluteComplexity" value="50"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
|
<properties>
|
||||||
|
<property name="nestingLevel" value="5"/>
|
||||||
|
<property name="absoluteNestingLevel" value="15"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||||
|
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
||||||
|
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
||||||
|
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
||||||
|
<rule ref="Generic.PHP.ForbiddenFunctions"/>
|
||||||
|
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
|
<properties>
|
||||||
|
<property name="indent" value="4"/>
|
||||||
|
<property name="tabIndent" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="MySource.PHP.EvalObjectFactory"/>
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration"/>
|
||||||
|
<rule ref="PSR1.Files.SideEffects"/>
|
||||||
|
<rule ref="PSR2.Classes.ClassDeclaration"/>
|
||||||
|
<rule ref="PSR2.Classes.PropertyDeclaration"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
|
||||||
|
<rule ref="PSR2.Files.EndFileNewline"/>
|
||||||
|
<rule ref="PSR2.Methods.MethodDeclaration"/>
|
||||||
|
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
|
||||||
|
<rule ref="PSR2.Namespaces.UseDeclaration"/>
|
||||||
|
<rule ref="PSR1">
|
||||||
|
<exclude-pattern>*.php</exclude-pattern>
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||||
|
|
||||||
<!-- Ignore normal Laravel files and folders -->
|
<exclude-pattern>database/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.Arrays.ArrayDeclaration">
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed" />
|
||||||
|
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
|
||||||
|
<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.LowercasePHPFunctions"/>
|
||||||
|
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
||||||
|
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||||
|
<rule ref="Squiz.Scope.MethodScope"/>
|
||||||
|
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
|
||||||
|
<properties>
|
||||||
|
<property name="ignoreNewlines" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
|
||||||
|
<properties>
|
||||||
|
<property name="ignoreNewlines" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||||
|
<rule ref="Zend.Files.ClosingTag"/>
|
||||||
|
|
||||||
|
<file>app</file>
|
||||||
|
<file>config</file>
|
||||||
|
<file>public</file>
|
||||||
|
<file>resources</file>
|
||||||
|
<file>routes</file>
|
||||||
|
<file->tests</file->
|
||||||
|
|
||||||
|
<exclude-pattern>*/.phpstorm.meta.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/_ide_helper.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/database/*</exclude-pattern>
|
||||||
<exclude-pattern>*/cache/*</exclude-pattern>
|
<exclude-pattern>*/cache/*</exclude-pattern>
|
||||||
<exclude-pattern>*/*.js</exclude-pattern>
|
<exclude-pattern>*/*.js</exclude-pattern>
|
||||||
<exclude-pattern>*/*.css</exclude-pattern>
|
<exclude-pattern>*/*.css</exclude-pattern>
|
||||||
@@ -12,56 +139,16 @@
|
|||||||
<exclude-pattern>*/docs/*</exclude-pattern>
|
<exclude-pattern>*/docs/*</exclude-pattern>
|
||||||
<exclude-pattern>*/vendor/*</exclude-pattern>
|
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||||
<exclude-pattern>*/migrations/*</exclude-pattern>
|
<exclude-pattern>*/migrations/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/config/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/public/index.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.blade.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Console/Kernel.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Exceptions/Handler.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Http/Kernel.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Providers/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/resources/lang/*</exclude-pattern>
|
||||||
|
|
||||||
<!-- Hard-code command-line parameters -->
|
<arg name="colors"/>
|
||||||
<arg name="colors" />
|
<arg value="spv"/>
|
||||||
<arg value="p" />
|
<ini name="memory_limit" value="128M"/>
|
||||||
|
|
||||||
<!-- PSR1 2.3 Side Effects -->
|
|
||||||
<rule ref="PSR1.Files.SideEffects">
|
|
||||||
<!-- Disable side effects for index file -->
|
|
||||||
<exclude-pattern>/public/index.php</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- PSR1 3 Namespaces and classes MUST follow PSR-0. -->
|
|
||||||
<rule ref="PSR1.Classes.ClassDeclaration" />
|
|
||||||
|
|
||||||
<!-- Disable missing namespace rule for tests and database files -->
|
|
||||||
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
|
||||||
<exclude-pattern>*/database/*</exclude-pattern>
|
|
||||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- PSR1 4.1 Class constants MUST be declared in all upper case with underscore separators. -->
|
|
||||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
|
|
||||||
|
|
||||||
<!-- PSR1 4.3 Method names MUST be declared in camelCase(). -->
|
|
||||||
<rule ref="PSR1.Methods.CamelCapsMethodName" />
|
|
||||||
|
|
||||||
<!-- Disable camel caps rule for tests -->
|
|
||||||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
|
|
||||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- No compact() and no 'dumps' -->
|
|
||||||
<rule ref="Generic.PHP.ForbiddenFunctions">
|
|
||||||
<properties>
|
|
||||||
<property name="forbiddenFunctions" type="array">
|
|
||||||
<element key="compact" value="null" />
|
|
||||||
<element key="dd" value="null" />
|
|
||||||
<element key="dump" value="null" />
|
|
||||||
<element key="var_dump" value="null" />
|
|
||||||
<element key="ray" value="null" />
|
|
||||||
</property>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- Use config() over env() -->
|
|
||||||
<rule ref="Tighten.PHP.UseConfigOverEnv">
|
|
||||||
<exclude-pattern>/config/*</exclude-pattern>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- Class name should match the file name -->
|
|
||||||
<rule ref="Squiz.Classes.ClassFileName" />
|
|
||||||
|
|
||||||
</ruleset>
|
</ruleset>
|
||||||
@@ -15,7 +15,7 @@ function getRoleIcon($roleName): string
|
|||||||
'Support' => 'gm-support.png',
|
'Support' => 'gm-support.png',
|
||||||
];
|
];
|
||||||
|
|
||||||
return asset('img/'.$roleIcons[$roleName]);
|
return asset('img/' . $roleIcons[$roleName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAverageColorFromImageUrl($imageUrl): string
|
function getAverageColorFromImageUrl($imageUrl): string
|
||||||
@@ -89,8 +89,10 @@ function getChampionImage($full_id, $type): string
|
|||||||
*/
|
*/
|
||||||
function getCommitHash(): string
|
function getCommitHash(): string
|
||||||
{
|
{
|
||||||
/** @var string $commit */
|
/**
|
||||||
$commit = Cache::remember('commit_hash', 60 * 72, fn () => trim(exec('git log --pretty="%h" -n1 HEAD')));
|
* @var string $commit
|
||||||
|
*/
|
||||||
|
$commit = Cache::remember('commit_hash', 60 * 72, fn() => trim(exec('git log --pretty="%h" -n1 HEAD')));
|
||||||
|
|
||||||
return $commit;
|
return $commit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ class StreamerPanelController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate(['champion_id' => 'required|exists:champions,champion_id',
|
$request->validate([
|
||||||
|
'champion_id' => 'required|exists:champions,champion_id',
|
||||||
'platform' => 'required|in:twitch,youtube,kick,douyu,huya',
|
'platform' => 'required|in:twitch,youtube,kick,douyu,huya',
|
||||||
'username' => 'required|string',
|
'username' => 'required|string',
|
||||||
'displayname' => 'required|string',
|
'displayname' => 'required|string',
|
||||||
|
|||||||
Reference in New Issue
Block a user