Skip to content

Commit

Permalink
Merge pull request #363 from Yoast/JRF/yoastcs-more-namespace-import-…
Browse files Browse the repository at this point in the history
…use-rules

YoastCS: more namespace/import use rules
  • Loading branch information
jrfnl authored Dec 14, 2023
2 parents 39e325a + 2de2688 commit 89ffdf4
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Yoast/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,45 @@
</rule>


<!-- NAMESPACED FILES AND IMPORT USE STATEMENTS -->

<!-- CS/QA: Enforce all classes to be imported. -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="searchAnnotations" value="true"/>
<property name="allowFullyQualifiedGlobalConstants" value="true"/>
<property name="allowFullyQualifiedGlobalFunctions" value="true"/>
</properties>
</rule>

<!-- CS: Enforce alphabetically ordered import use statements. -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="psr12Compatible" value="true"/>
<property name="caseSensitive" value="false"/>
</properties>
</rule>

<!-- CS/QA: Disallow unused import use statements. -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<!-- Allow import use statements for classes only referenced in documentation. -->
<property name="searchAnnotations" value="true"/>
</properties>
</rule>

<!-- CS/QA: Disallow import use statements for structures in the same namespace. -->
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>

<!-- CS: For namespaced functions/constants: import the namespace, not the function/constant. -->
<rule ref="Universal.UseStatements.DisallowUseConst"/>
<rule ref="Universal.UseStatements.DisallowUseFunction"/>

<!-- CS: For global functions/constants: use fully qualified inline names. -->
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants"/>
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions"/>


<!--
#############################################################################
SNIFFS RELATED TO COMMENTS AND DOCBLOCKS
Expand Down

0 comments on commit 89ffdf4

Please sign in to comment.