roslov / psr12ext Goto Github PK
View Code? Open in Web Editor NEWPSR-12 Extended Coding Standard
License: MIT License
PSR-12 Extended Coding Standard
License: MIT License
SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
was disabled now because of the false positive.
To check whether it is fixed now, and enable it if working.
SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
excludes fully qualified namespace references from the class body.
searchAnnotations
.FullyQualifiedExceptions
.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 SlevomatCodingStandard.Classes.ClassConstantVisibility.MissingConstantVisibility
as a duplicate of PSR12.Properties.ConstantVisibility.NotFound
.
Remove SlevomatCodingStandard.Classes.TraitUseDeclaration.MultipleTraitsPerDeclaration
as a duplicate of PSR12.Traits.UseDeclaration.MultipleImport
.
PHP 7.1 support were removed in Slevomat Coding Standard v7.1.0.
Add final
to all non-abstract classes.
Probably the Entity
folder should be excluded from the search to comply the Symfony framework (under discussion).
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
{
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="exact" value="true" />
</properties>
</rule>
This fix will improve indentation:
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties#genericwhitespacescopeindent
SlevomatCodingStandard.Namespaces.NamespaceSpacing.IncorrectLinesCountBeforeNamespace
was disabled now because of the false positive.
To check whether it is fixed now, and enable it if working.
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.
Add info how to change version if a new external sniff is added. Major version increase?
Remove squizlabs/php_codesniffer
from the require
section of composer.json
as it is required in squizlabs/php_codesniffer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.