Skip to content

Commit 50ff431

Browse files
committed
PHP6616: optimize native function invocation
1 parent e9af64d commit 50ff431

File tree

11 files changed

+33
-33
lines changed

11 files changed

+33
-33
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.28
1+
2.0.29

resources/autoload.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
*
1515
* This file is part of tc-lib-unicode-data software library.
1616
*/
17-
spl_autoload_register(
17+
\spl_autoload_register(
1818
function ($class) {
1919
$prefix = 'Com\\Tecnick\\';
20-
$len = strlen($prefix);
21-
if (strncmp($prefix, $class, $len) !== 0) {
20+
$len = \strlen($prefix);
21+
if (\strncmp($prefix, $class, $len) !== 0) {
2222
return;
2323
}
24-
$relative_class = substr($class, $len);
25-
$file = dirname(dirname(__DIR__)).'/'.str_replace('\\', '/', $relative_class).'.php';
26-
if (file_exists($file)) {
24+
$relative_class = \substr($class, $len);
25+
$file = \dirname(\dirname(__DIR__)).'/'.\str_replace('\\', '/', $relative_class).'.php';
26+
if (\file_exists($file)) {
2727
require $file;
2828
}
2929
}

test/ArabicTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ class ArabicTest extends TestCase
3333
{
3434
public function testDiacritic(): void
3535
{
36-
$this->assertEquals(5, count(\Com\Tecnick\Unicode\Data\Arabic::DIACRITIC));
36+
$this->assertEquals(5, \count(\Com\Tecnick\Unicode\Data\Arabic::DIACRITIC));
3737
}
3838

3939
public function testlaa(): void
4040
{
41-
$this->assertEquals(4, count(\Com\Tecnick\Unicode\Data\Arabic::LAA));
41+
$this->assertEquals(4, \count(\Com\Tecnick\Unicode\Data\Arabic::LAA));
4242
}
4343

4444
public function testSubstitute(): void
4545
{
46-
$this->assertEquals(76, count(\Com\Tecnick\Unicode\Data\Arabic::SUBSTITUTE));
46+
$this->assertEquals(76, \count(\Com\Tecnick\Unicode\Data\Arabic::SUBSTITUTE));
4747
}
4848
}

test/BracketTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testOpenClose(): void
3535
{
3636
$this->assertEquals(
3737
\Com\Tecnick\Unicode\Data\Bracket::OPEN,
38-
array_flip(\Com\Tecnick\Unicode\Data\Bracket::CLOSE)
38+
\array_flip(\Com\Tecnick\Unicode\Data\Bracket::CLOSE)
3939
);
4040
}
4141
}

test/ConstantTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ class ConstantTest extends TestCase
3434
public function testConstants(): void
3535
{
3636
$reflectionClass = new \ReflectionClass('\\' . \Com\Tecnick\Unicode\Data\Constant::class);
37-
$this->assertEquals(14, count($reflectionClass->getConstants()));
37+
$this->assertEquals(14, \count($reflectionClass->getConstants()));
3838
}
3939
}

test/EncodingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class EncodingTest extends TestCase
3333
{
3434
public function testMap(): void
3535
{
36-
$this->assertEquals(22, count(\Com\Tecnick\Unicode\Data\Encoding::MAP));
37-
$this->assertEquals(256, count(\Com\Tecnick\Unicode\Data\Encoding::MAP['iso-8859-1']));
36+
$this->assertEquals(22, \count(\Com\Tecnick\Unicode\Data\Encoding::MAP));
37+
$this->assertEquals(256, \count(\Com\Tecnick\Unicode\Data\Encoding::MAP['iso-8859-1']));
3838
}
3939
}

test/IdentityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class IdentityTest extends TestCase
3333
{
3434
public function testConstants(): void
3535
{
36-
$this->assertEquals('a3f30375025e8570745ff463479522b6', md5(\Com\Tecnick\Unicode\Data\Identity::CIDHMAP));
36+
$this->assertEquals('a3f30375025e8570745ff463479522b6', \md5(\Com\Tecnick\Unicode\Data\Identity::CIDHMAP));
3737
}
3838
}

test/LatinTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class LatinTest extends TestCase
3333
{
3434
public function testMap(): void
3535
{
36-
$this->assertEquals(27, count(\Com\Tecnick\Unicode\Data\Latin::SUBSTITUTE));
36+
$this->assertEquals(27, \count(\Com\Tecnick\Unicode\Data\Latin::SUBSTITUTE));
3737
}
3838
}

test/MirrorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class MirrorTest extends TestCase
3333
{
3434
public function testMap(): void
3535
{
36-
$this->assertEquals(352, count(\Com\Tecnick\Unicode\Data\Mirror::UNI));
36+
$this->assertEquals(352, \count(\Com\Tecnick\Unicode\Data\Mirror::UNI));
3737
}
3838
}

test/PatternTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ class PatternTest extends TestCase
3434
public function testPatterns(): void
3535
{
3636
$str = 'hello world';
37-
$this->assertEquals(0, preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
38-
$this->assertEquals(0, preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
37+
$this->assertEquals(0, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
38+
$this->assertEquals(0, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
3939

4040
$str = 'مرحبا بالعالم';
41-
$this->assertEquals(1, preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
41+
$this->assertEquals(1, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
4242

4343
$str = 'שלום עולם';
44-
$this->assertEquals(0, preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
45-
$this->assertEquals(1, preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
44+
$this->assertEquals(0, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::ARABIC, $str));
45+
$this->assertEquals(1, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
4646

47-
$str = json_decode('"\u2067"'); // RLI
48-
$this->assertEquals(1, preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
47+
$str = \json_decode('"\u2067"'); // RLI
48+
$this->assertEquals(1, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
4949

50-
$str = json_decode('"\u202B"'); // RLE
51-
$this->assertEquals(1, preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
50+
$str = \json_decode('"\u202B"'); // RLE
51+
$this->assertEquals(1, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
5252

53-
$str = json_decode('"\u202E"'); // RLO
54-
$this->assertEquals(1, preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
53+
$str = \json_decode('"\u202E"'); // RLO
54+
$this->assertEquals(1, \preg_match(\Com\Tecnick\Unicode\Data\Pattern::RTL, $str));
5555
}
5656
}

0 commit comments

Comments
 (0)