Skip to content

Commit 4940b32

Browse files
✨ Add mb string sniff
1 parent 5596f47 commit 4940b32

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SymfonyCustom\Sniffs\PHP;
6+
7+
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
8+
9+
/**
10+
* Class DiscourageNonMultiBytesSniff
11+
*/
12+
class DiscourageNonMultiBytesSniff extends ForbiddenFunctionsSniff
13+
{
14+
/**
15+
* @var array
16+
*/
17+
public $forbiddenFunctions = [
18+
'chr' => 'mb_chr',
19+
'split' => 'mb_split',
20+
'str_split' => 'mb_str_split',
21+
'stripos' => 'mb_stripos',
22+
'stristr' => 'mb_stristr',
23+
'strlen' => 'mb_strlen',
24+
'strrchr' => 'mb_strrchr',
25+
'strripos' => 'mb_strripos',
26+
'strrpos' => 'mb_strrpos',
27+
'strtolower' => 'mb_strtolower',
28+
'substr_count' => 'mb_substr_count',
29+
'substr' => 'mb_substr',
30+
];
31+
32+
/**
33+
* @var bool
34+
*/
35+
public $error = false;
36+
}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"bin": ["bin/twigcs"],
1919
"require": {
2020
"php": ">=7.2",
21+
"ext-mbstring": "*",
2122
"squizlabs/php_codesniffer": "^3.5",
2223
"symfony/console": "^4.4 || ^5.0",
2324
"symfony/twig-bridge": "^4.4 || ^5.0",

0 commit comments

Comments
 (0)