Giter Club home page Giter Club logo

psr12ext's People

Contributors

roslov avatar sinkcup avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

sinkcup

psr12ext's Issues

Enable `UnusedUse`

SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse was disabled now because of the false positive.

To check whether it is fixed now, and enable it if working.

Add ReferenceUsedNamesOnly

SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly excludes fully qualified namespace references from the class body.

  1. Add the sniff.
  2. Enable searchAnnotations.
  3. Consider not using of FullyQualifiedExceptions.

`Generic.WhiteSpace.ScopeIndent` with `exact`=`true` does not require indentation for ternaries and multiline strings

This

$where = in_array($cISO, ['PT', 'MX', 'ES', 'IT', 'LV', 'LT', 'DK', 'CH', 'CZ'], true)
    ? ' and cc.is_act=1'
    : ' and cc.is_vis=1';

fails and is fixed to

$where = in_array($cISO, ['PT', 'MX', 'ES', 'IT', 'LV', 'LT', 'DK', 'CH', 'CZ'], true)
? ' and cc.is_act=1'
: ' and cc.is_vis=1';

It can be fixed by

    <rule ref="Generic.WhiteSpace.ScopeIndent">
        <properties>
            <property name="exact" value="true" />
            <property name="ignoreIndentationTokens" type="array">
                <element value="T_COMMENT"/>
                <element value="T_DOC_COMMENT_OPEN_TAG"/>
                <element value="T_INLINE_THEN"/>
                <element value="T_INLINE_ELSE"/>
            </property>
        </properties>
    </rule>

But it also allows

$where = in_array($cISO, ['PT', 'MX', 'ES', 'IT', 'LV', 'LT', 'DK', 'CH', 'CZ'], true)
        ? ' and cc.is_act=1'
    : ' and cc.is_vis=1';

that is not good.

See also squizlabs/PHP_CodeSniffer#3711

Remove `MissingConstantVisibility`

Remove SlevomatCodingStandard.Classes.ClassConstantVisibility.MissingConstantVisibility as a duplicate of PSR12.Properties.ConstantVisibility.NotFound.

Remove `MultipleTraitsPerDeclaration`

Remove SlevomatCodingStandard.Classes.TraitUseDeclaration.MultipleTraitsPerDeclaration as a duplicate of PSR12.Traits.UseDeclaration.MultipleImport.

`final` for non-abstract classes

Add final to all non-abstract classes.

Probably the Entity folder should be excluded from the search to comply the Symfony framework (under discussion).

Limit to a single blank line between methods and lines in code

Disable more than one new line between methods, functions, lines of code, etc.

Incorrect:

$a = 10;


return $a;

Correct:

$a = 10;

return $a;

or

$a = 10;
return $a;

Incorrect:

}


public function someMethod(): void
{

Correct:

}

public function someMethod(): void
{

Enable `IncorrectLinesCountBeforeNamespace`

SlevomatCodingStandard.Namespaces.NamespaceSpacing.IncorrectLinesCountBeforeNamespace was disabled now because of the false positive.

To check whether it is fixed now, and enable it if working.

Set exact indentation for ternaries and multiline strings

By #40, I disabled the exact indentation for ternaries and multiline strings.

But now, we have such a problem:

$where = in_array($cISO, ['PT', 'MX', 'ES', 'IT', 'LV', 'LT', 'DK', 'CH', 'CZ'], true)
        ? ' and cc.is_act=1'
    : ' and cc.is_vis=1';

$string = 'abcdefg'
        . 'abcdefg'
. 'abcdefg'
  . 'abcdefg';

Therefore, we have to find out a way to set the exact indentation for ternaries and multiline strings. Probably there should be written a custom sniff or found an existing one.

Added versioning rules

Add info how to change version if a new external sniff is added. Major version increase?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.