Skip to content

Commit

Permalink
feat: 添加sentenceFull,支持保留其他字符
Browse files Browse the repository at this point in the history
  • Loading branch information
libook committed Oct 24, 2023
1 parent 3c13cbb commit 76120d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
26 changes: 14 additions & 12 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticProperties="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"

processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="overtrue/pinyin Test Suite (All PHP version)">
<directory>./tests/</directory>
<exclude>./tests/*.php</exclude>
</testsuite>
</testsuites>
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
cacheDirectory=".phpunit.result.cache"
>
<testsuites>
<testsuite name="overtrue/pinyin Test Suite (All PHP version)">
<directory>./tests/</directory>
<exclude>./tests/*.php</exclude>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function offsetGet(mixed $offset): mixed

public function offsetSet(mixed $offset, mixed $value): void
{
if (null === $offset) {
if ($offset === null) {
$this->items[] = $value;
} else {
$this->items[$offset] = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function convert(string $string, callable $beforeSplit = null): Collectio
}, $string);

// 过滤掉不保留的字符
if (!$this->keepOtherCharacters) {
if (! $this->keepOtherCharacters) {
$string = \preg_replace(\sprintf('~[^%s]~u', \implode($this->regexps)), '', $string);
}

Expand Down
1 change: 1 addition & 0 deletions tests/benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require __DIR__.'/../vendor/autoload.php';

use Overtrue\Pinyin\Pinyin;

use function Termwind\{render};

$totalStart = microtime(true);
Expand Down

0 comments on commit 76120d7

Please sign in to comment.