File tree Expand file tree Collapse file tree 15 files changed +95
-49
lines changed Expand file tree Collapse file tree 15 files changed +95
-49
lines changed Original file line number Diff line number Diff line change 6
6
/.scrutinizer.yml export-ignore
7
7
/.styleci.yml export-ignore
8
8
/.travis.yml export-ignore
9
+ /phpcs.xml export-ignore
10
+ /phpstan.neon export-ignore
9
11
/phpunit.xml.dist export-ignore
10
12
/tests export-ignore
Original file line number Diff line number Diff line change 1
1
checks :
2
- php : true
2
+ php : true
3
3
4
4
filter :
5
- paths :
6
- - src/*
7
- excluded_paths :
8
- - vendor/*
9
- - tests/*
5
+ paths :
6
+ - src/*
7
+ excluded_paths :
8
+ - vendor/*
9
+ - tests/*
10
10
11
11
before_commands :
12
- - " composer install --prefer-dist"
12
+ - " composer install --prefer-dist"
Original file line number Diff line number Diff line change 1
1
preset : recommended
2
2
3
3
enabled :
4
- - combine_consecutive_unsets
5
- - linebreak_after_opening_tag
6
- - ordered_class_elements
7
- - unalign_double_arrow
4
+ - combine_consecutive_unsets
5
+ - linebreak_after_opening_tag
6
+ - ordered_class_elements
7
+ - unalign_double_arrow
8
8
9
9
disabled :
10
- - align_double_arrow
10
+ - align_double_arrow
11
11
12
12
finder :
13
13
exclude :
Original file line number Diff line number Diff line change @@ -3,27 +3,28 @@ language: php
3
3
sudo : false
4
4
5
5
php :
6
- - 7.1
7
- - 7.2
8
- - 7.3
6
+ - 7.1
7
+ - 7.2
8
+ - 7.3
9
9
10
10
before_script :
11
- - composer self-update
11
+ - composer self-update
12
12
13
13
install :
14
- - composer install --dev --no-interaction --prefer-dist
14
+ - composer install --dev --no-interaction --prefer-dist
15
15
16
16
script :
17
- - ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=PSR2
18
- - ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml
17
+ - ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml
18
+ - ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml
19
+ - ./vendor/bin/phpstan analyse -l 7 --no-progress -c phpstan.neon ./
19
20
20
21
after_success :
21
- - bash <(curl -s https://codecov.io/bash)
22
+ - bash <(curl -s https://codecov.io/bash)
22
23
23
24
cache :
24
- directories :
25
- - $COMPOSER_CACHE_DIR
25
+ directories :
26
+ - $COMPOSER_CACHE_DIR
26
27
27
28
notifications :
28
- email :
29
- - genvaldartem@gmail.com
29
+ email :
30
+ - genvaldartem@gmail.com
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ PHP library for transliteration. 🇺🇦 :uk: :ru: :abcd:
15
15
16
16
## Requirements
17
17
18
- * PHP 7.1 * and later*
18
+ * PHP 7.1.3 * and later*
19
19
20
20
## Install via Composer
21
21
Original file line number Diff line number Diff line change 17
17
"issues" : " https://github.com/fre5h/transliteration/issues"
18
18
},
19
19
"require" : {
20
- "php" : " >=7.1.0 "
20
+ "php" : " >=7.1.3 "
21
21
},
22
22
"require-dev" : {
23
- "phpunit/phpunit" : " ~6.4" ,
24
- "squizlabs/php_codesniffer" : " ~3.1"
23
+ "friendsofphp/php-cs-fixer" : " ^2.15" ,
24
+ "johnkary/phpunit-speedtrap" : " ^3.1" ,
25
+ "phpstan/phpstan" : " ^0.11" ,
26
+ "phpstan/phpstan-phpunit" : " ^0.11" ,
27
+ "phpunit/phpunit" : " ~7.5" ,
28
+ "slam/phpstan-extensions" : " ^3.4" ,
29
+ "squizlabs/php_codesniffer" : " ~3.1" ,
30
+ "thecodingmachine/phpstan-strict-rules" : " ^0.11"
25
31
},
26
32
"autoload" : {
27
33
"psr-4" : {
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <ruleset name =" Stfalcon Codding Standard"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : noNamespaceSchemaLocation =" vendor/squizlabs/php_codesniffer/phpcs.xsd"
5
+ >
6
+ <arg name =" basepath" value =" ." />
7
+ <arg name =" cache" value =" .phpcs-cache" />
8
+ <arg name =" extensions" value =" php" />
9
+ <arg name =" encoding" value =" utf-8" />
10
+ <arg name =" colors" />
11
+ <arg name =" parallel" value =" 4" />
12
+ <arg value =" p" />
13
+ <arg value =" s" />
14
+
15
+ <file >./src/</file >
16
+ <file >./tests/</file >
17
+
18
+ <rule ref =" PSR2" >
19
+ <exclude name =" Generic.Files.LineLength" />
20
+ </rule >
21
+
22
+ <!-- Don't hide tokenizer exceptions -->
23
+ <rule ref =" Internal.Tokenizer.Exception" >
24
+ <type >error</type >
25
+ </rule >
26
+ </ruleset >
Original file line number Diff line number Diff line change
1
+ includes :
2
+ - 'vendor/phpstan/phpstan-phpunit/extension.neon'
3
+ - 'vendor/phpstan/phpstan-phpunit/rules.neon'
4
+ - 'vendor/slam/phpstan-extensions/conf/slam-rules.neon'
5
+ parameters :
6
+ level : 7
7
+ excludes_analyse :
8
+ - '%rootDir%/../../../tests/*'
9
+ - '%rootDir%/../../../vendor/*'
10
+ fileExtensions :
11
+ - 'php'
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
3
3
<phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
- xsi : noNamespaceSchemaLocation =" http://schema.phpunit.de/6.4 /phpunit.xsd"
4
+ xsi : noNamespaceSchemaLocation =" http://schema.phpunit.de/7.5 /phpunit.xsd"
5
5
colors =" true"
6
6
bootstrap =" vendor/autoload.php"
7
7
>
8
8
<testsuites >
9
- <testsuite name =" Transliteration Test Suite" >
9
+ <testsuite name =" Transliteration Library Test Suite" >
10
10
<directory >./tests/</directory >
11
11
</testsuite >
12
12
</testsuites >
Original file line number Diff line number Diff line change 1
1
<?php
2
-
3
- declare (strict_types=1 );
4
2
/*
5
3
* This file is part of the Transliteration library
6
4
*
10
8
* file that was distributed with this source code.
11
9
*/
12
10
11
+ declare (strict_types=1 );
12
+
13
13
namespace Fresh \Transliteration ;
14
14
15
15
/**
23
23
*/
24
24
class RussianToEnglish implements TransliteratorInterface
25
25
{
26
- /** @const array */
26
+ /** @const string[] */
27
27
private const RUSSIAN_TO_ENGLISH_RULES = [
28
28
'а ' => 'a ' ,
29
29
'б ' => 'b ' ,
@@ -102,7 +102,7 @@ public static function transliterate(string $russianText): string
102
102
{
103
103
$ transliteratedText = '' ;
104
104
105
- if (\mb_strlen ( $ russianText ) > 0 ) {
105
+ if ('' !== $ russianText ) {
106
106
$ transliteratedText = \str_replace (
107
107
\array_keys (self ::RUSSIAN_TO_ENGLISH_RULES ),
108
108
\array_values (self ::RUSSIAN_TO_ENGLISH_RULES ),
You can’t perform that action at this time.
0 commit comments