Skip to content

Added Constant visibility in the ruleset #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class DiscouragedDependenciesSniff implements Sniff
{
const CONSTRUCT_METHOD_NAME = '__construct';
private const CONSTRUCT_METHOD_NAME = '__construct';

/**
* String representation of warning.
Expand Down
8 changes: 4 additions & 4 deletions Magento2/Sniffs/Html/HtmlDirectiveSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/
class HtmlDirectiveSniff implements Sniff
{
const CONSTRUCTION_DEPEND_PATTERN = '/{{depend\s*(.*?)}}(.*?){{\\/depend\s*}}/si';
const CONSTRUCTION_IF_PATTERN = '/{{if\s*(.*?)}}(.*?)({{else}}(.*?))?{{\\/if\s*}}/si';
const LOOP_PATTERN = '/{{for(?P<loopItem>.*? )(in)(?P<loopData>.*?)}}(?P<loopBody>.*?){{\/for}}/si';
const CONSTRUCTION_PATTERN = '/{{([a-z]{0,10})(.*?)}}(?:(.*?)(?:{{\/(?:\\1)}}))?/si';
private const CONSTRUCTION_DEPEND_PATTERN = '/{{depend\s*(.*?)}}(.*?){{\\/depend\s*}}/si';
private const CONSTRUCTION_IF_PATTERN = '/{{if\s*(.*?)}}(.*?)({{else}}(.*?))?{{\\/if\s*}}/si';
private const LOOP_PATTERN = '/{{for(?P<loopItem>.*? )(in)(?P<loopData>.*?)}}(?P<loopBody>.*?){{\/for}}/si';
private const CONSTRUCTION_PATTERN = '/{{([a-z]{0,10})(.*?)}}(?:(.*?)(?:{{\/(?:\\1)}}))?/si';

/**
* @var array
Expand Down
6 changes: 3 additions & 3 deletions Magento2/Sniffs/Less/CommentLevelsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/
class CommentLevelsSniff implements Sniff
{
const COMMENT_STRING = '//';
private const COMMENT_STRING = '//';

const FIRST_LEVEL_COMMENT = '_____________________________________________';
private const FIRST_LEVEL_COMMENT = '_____________________________________________';

const SECOND_LEVEL_COMMENT = '--';
private const SECOND_LEVEL_COMMENT = '--';

/**
* @var array
Expand Down
18 changes: 9 additions & 9 deletions Magento2/Sniffs/Less/TokenizerSymbolsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
*/
interface TokenizerSymbolsInterface
{
const TOKENIZER_CSS = 'CSS';
public const TOKENIZER_CSS = 'CSS';

/**#@+
* Symbols for usage into Sniffers
*/
const BITWISE_AND = '&';
const COLON = ';';
const OPEN_PARENTHESIS = '(';
const CLOSE_PARENTHESIS = ')';
const NEW_LINE = "\n";
const WHITESPACE = ' ';
const DOUBLE_WHITESPACE = ' ';
const INDENT_SPACES = ' ';
public const BITWISE_AND = '&';
public const COLON = ';';
public const OPEN_PARENTHESIS = '(';
public const CLOSE_PARENTHESIS = ')';
public const NEW_LINE = "\n";
public const WHITESPACE = ' ';
public const DOUBLE_WHITESPACE = ' ';
public const INDENT_SPACES = ' ';
/**#@-*/
}
6 changes: 3 additions & 3 deletions Magento2/Sniffs/Less/ZeroUnitsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/
class ZeroUnitsSniff implements Sniff
{
const CSS_PROPERTY_UNIT_PX = 'px';
const CSS_PROPERTY_UNIT_EM = 'em';
const CSS_PROPERTY_UNIT_REM = 'rem';
private const CSS_PROPERTY_UNIT_PX = 'px';
private const CSS_PROPERTY_UNIT_EM = 'em';
private const CSS_PROPERTY_UNIT_REM = 'rem';

/**
* @var array
Expand Down
2 changes: 1 addition & 1 deletion Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class DeprecatedModelMethodSniff implements Sniff
{
const RESOURCE_METHOD = "getResource";
private const RESOURCE_METHOD = "getResource";

/**
* String representation of warning.
Expand Down
4 changes: 4 additions & 0 deletions Magento2/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity>
</rule>
<rule ref="PSR12.Properties.ConstantVisibility">
<severity>6</severity>
<type>warning</type>
</rule>

<!-- Severity 5 warnings: PHPDoc formatting and commenting issues. -->
<rule ref="Magento2.Commenting.ClassAndInterfacePHPDocFormatting">
Expand Down