Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
static
framework
Magento
Sniffs
Variables
GlobalVariablesSniff.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Sniffs\Variables
;
8
9
use PHP_CodeSniffer\Sniffs\Sniff;
10
use PHP_CodeSniffer\Files\File;
11
15
class
GlobalVariablesSniff
implements
Sniff
16
{
20
public
function
register
()
21
{
22
return
[T_VARIABLE];
23
}
24
28
public
function
process
(File $phpcsFile, $stackPtr)
29
{
30
$tokens
= $phpcsFile->getTokens();
31
if
(preg_match(
'/^\$[_A-Z0-9]+$/'
,
$tokens
[$stackPtr][
'content'
])) {
32
$phpcsFile->addError(
33
'Usage of global variables is not allowed: '
.
$tokens
[$stackPtr][
'content'
],
34
$stackPtr,
35
'ERROR'
36
);
37
return
;
38
}
39
}
40
}
Magento\Sniffs\Variables\GlobalVariablesSniff\process
process(File $phpcsFile, $stackPtr)
Definition:
GlobalVariablesSniff.php:28
Magento\Sniffs\Variables\GlobalVariablesSniff
Definition:
GlobalVariablesSniff.php:15
Magento\Sniffs\Variables
Definition:
GlobalVariablesSniff.php:7
$tokens
$tokens
Definition:
cards_list.phtml:9