Symfony-coding-standard icon indicating copy to clipboard operation
Symfony-coding-standard copied to clipboard

new standards

Open wickedOne opened this issue 6 years ago • 3 comments

did a quick compare between current sniffs and symfony's current standards and noticed the following new rules (which i'll try to provide a sniff for next weekend):

Structure:

  • [ ] Add a use statement for every class that is not part of the global namespace.

Documentation

  • [ ] Don't inline PHPDoc blocks, even when they contain just one tag (e.g. don't put /** {@inheritdoc} */ in a single line);
  • [ ] When adding a new class or when making significant changes to an existing class, an @author tag with personal contact information may be added, or expanded. Please note it is possible to have the personal contact information updated or removed per request to the doc:core team.

for the last one i think we at most can throw a warning

wickedOne avatar Jun 25 '18 22:06 wickedOne

@wickedOne For the first one, could you try the following with slevomat/coding-standard?

    <rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
        <properties>
            <property name="allowFullyQualifiedGlobalClasses" value="true"/>
            <property name="allowFullyQualifiedGlobalConstants" value="true"/>
            <property name="allowFullyQualifiedGlobalFunctions" value="true"/>
            <property name="searchAnnotations" type="boolean" value="true"/>
        </properties>
    </rule>

mmoll avatar Nov 19 '20 00:11 mmoll

i'm not entirely sure what would be the purpose of trying another coding standard within this one; are you suggesting to copy slevomat's code into this repository?

wickedOne avatar Dec 27 '20 02:12 wickedOne

@wickedOne I'd use it as a dependency, see https://github.com/djoos/Symfony-coding-standard/pull/183/files#diff-ab8597c76d04ad91201fc5cb1ea17cad514970360d740fe3d4bf016cdc88e70d for how it would look like to use slevomat sniffs instead of some homegrown ones in this standard.

For testing the snippet above, you'd need to add it to your setup in some way (composer and auto-registration with https://github.com/DealerDirect/phpcodesniffer-composer-installer is what I use in such cases) and add the code in vendor/escapestudios/symfony2-coding-standard/Symfony/ruleset.xml.

mmoll avatar Dec 27 '20 02:12 mmoll