Skip to content

Commit 8ca475c

Browse files
authored
Apply fixes from StyleCI (#113)
1 parent 3bf903b commit 8ca475c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Pinyin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
define('PINYIN_KEEP_PUNCTUATION', 256);
3535

3636
/**
37-
* Class Pinyin
37+
* Class Pinyin.
3838
*
3939
* @author overtrue <[email protected]>
4040
*/
@@ -62,7 +62,7 @@ class Pinyin
6262
'' => '"',
6363
'' => "'",
6464
'' => "'",
65-
'_' => "_",
65+
'_' => '_',
6666
);
6767

6868
/**
@@ -180,7 +180,7 @@ public function sentence($string, $delimiter = ' ', $option = \PINYIN_NO_TONE)
180180
list($option, $delimiter) = array($delimiter, ' ');
181181
}
182182

183-
return implode($delimiter, $this->convert($string, $option | \PINYIN_KEEP_PUNCTUATION | \PINYIN_KEEP_ENGLISH | \PINYIN_KEEP_NUMBER));;
183+
return implode($delimiter, $this->convert($string, $option | \PINYIN_KEEP_PUNCTUATION | \PINYIN_KEEP_ENGLISH | \PINYIN_KEEP_NUMBER));
184184
}
185185

186186
/**
@@ -325,7 +325,7 @@ protected function prepare($string, $option = \PINYIN_DEFAULT)
325325
\array_push($regex, preg_quote(implode(array_merge(array_keys($this->punctuations), $this->punctuations)), '~'));
326326
}
327327

328-
return preg_replace(\sprintf("~[^%s]~u", join($regex)), '', $string);
328+
return preg_replace(\sprintf('~[^%s]~u', implode($regex)), '', $string);
329329
}
330330

331331
/**
@@ -351,7 +351,7 @@ protected function formatTone($pinyin, $option = \PINYIN_NO_TONE)
351351
$umlaut = $replacement[0];
352352

353353
// https://zh.wikipedia.org/wiki/%C3%9C
354-
if ($this->hasOption($option, \PINYIN_UMLAUT_V) && $umlaut == 'yu') {
354+
if ($this->hasOption($option, \PINYIN_UMLAUT_V) && 'yu' == $umlaut) {
355355
$umlaut = 'v';
356356
}
357357

tests/AbstractDictLoaderTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testConvert()
2121
{
2222
$pinyin = $this->pinyin;
2323

24-
$this->assertSame(array('nin', 'hao', '2018i', 'New', 'Year'), $pinyin->convert('您好&^2018i New Year!√ç', \PINYIN_KEEP_NUMBER|\PINYIN_KEEP_ENGLISH));
24+
$this->assertSame(array('nin', 'hao', '2018i', 'New', 'Year'), $pinyin->convert('您好&^2018i New Year!√ç', \PINYIN_KEEP_NUMBER | \PINYIN_KEEP_ENGLISH));
2525
$this->assertSame(array('nin', 'hao', 'i', 'New', 'Year'), $pinyin->convert('您好&^2018i New Year!√ç', \PINYIN_KEEP_ENGLISH));
2626
$this->assertSame(array('nin', 'hao', '2018'), $pinyin->convert('您好&^2018i New Year!√ç', \PINYIN_KEEP_NUMBER));
2727

0 commit comments

Comments
 (0)