Skip to content

Commit e7db02d

Browse files
committed
Fix phpstan strict issues
1 parent 8c9d6ab commit e7db02d

18 files changed

+94
-94
lines changed

tests/BaseTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class BaseTestCase extends TestCase
2525
*/
2626
protected function doExpectException($class, $message = null)
2727
{
28-
if (method_exists($this, 'expectException')) {
28+
if (method_exists($this, 'expectException')) { // @phpstan-ignore-line
2929
$this->expectException($class);
3030
if (null !== $message) {
3131
$this->expectExceptionMessage($message);
@@ -70,7 +70,7 @@ protected function expectPcreEngineException($pattern)
7070
protected function expectPcreException($pattern, $error = null)
7171
{
7272
if (null === $this->pregFunction) {
73-
$this->fail('Preg function name is missing');
73+
self::fail('Preg function name is missing');
7474
}
7575

7676
if (null !== $error) {
@@ -98,7 +98,7 @@ protected function expectPcreException($pattern, $error = null)
9898
protected function expectPcreWarning($warning = null)
9999
{
100100
if (null === $this->pregFunction) {
101-
$this->fail('Preg function name is missing');
101+
self::fail('Preg function name is missing');
102102
}
103103

104104
$warning = $warning !== null ? $warning : 'No ending matching delimiter \'}\' found';

tests/PregTests/GrepTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$result = Preg::grep('{[bc]}', array('a', 'b', 'c'));
36-
$this->assertSame(array(1 => 'b', 2 => 'c'), $result);
36+
self::assertSame(array(1 => 'b', 2 => 'c'), $result);
3737
}
3838

3939
/**
@@ -42,7 +42,7 @@ public function testSuccess()
4242
public function testFailure()
4343
{
4444
$result = Preg::grep('{[de]}', array('a', 'b', 'c'));
45-
$this->assertSame(array(), $result);
45+
self::assertSame(array(), $result);
4646
}
4747

4848
/**

tests/PregTests/IsMatchAllTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$result = Preg::isMatchAll('{[aei]}', 'abcdefghijklmnopqrstuvwxyz', $matches);
36-
$this->assertSame(true, $result);
37-
$this->assertSame(array(0 => array('a', 'e', 'i')), $matches);
36+
self::assertSame(true, $result);
37+
self::assertSame(array(0 => array('a', 'e', 'i')), $matches);
3838
}
3939

4040
/**
@@ -43,7 +43,7 @@ public function testSuccess()
4343
public function testSuccessNoRef()
4444
{
4545
$result = Preg::isMatchAll('{[aei]}', 'abcdefghijklmnopqrstuvwxyz');
46-
$this->assertSame(true, $result);
46+
self::assertSame(true, $result);
4747
}
4848

4949
/**
@@ -52,8 +52,8 @@ public function testSuccessNoRef()
5252
public function testFailure()
5353
{
5454
$result = Preg::isMatchAll('{abc}', 'def', $matches);
55-
$this->assertSame(false, $result);
56-
$this->assertSame(array(array()), $matches);
55+
self::assertSame(false, $result);
56+
self::assertSame(array(array()), $matches);
5757
}
5858

5959
/**

tests/PregTests/IsMatchTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$result = Preg::isMatch('{(?P<m>[io])}', 'abcdefghijklmnopqrstuvwxyz', $matches);
36-
$this->assertSame(true, $result);
37-
$this->assertSame(array(0 => 'i', 'm' => 'i', 1 => 'i'), $matches);
36+
self::assertSame(true, $result);
37+
self::assertSame(array(0 => 'i', 'm' => 'i', 1 => 'i'), $matches);
3838
}
3939

4040
/**
@@ -43,7 +43,7 @@ public function testSuccess()
4343
public function testSuccessNoRef()
4444
{
4545
$result = Preg::isMatch('{(?P<m>[io])}', 'abcdefghijklmnopqrstuvwxyz');
46-
$this->assertSame(true, $result);
46+
self::assertSame(true, $result);
4747
}
4848

4949
/**
@@ -52,8 +52,8 @@ public function testSuccessNoRef()
5252
public function testFailure()
5353
{
5454
$result = Preg::isMatch('{abc}', 'def', $matches);
55-
$this->assertSame(false, $result);
56-
$this->assertSame(array(), $matches);
55+
self::assertSame(false, $result);
56+
self::assertSame(array(), $matches);
5757
}
5858

5959
/**

tests/PregTests/MatchAllTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$count = Preg::matchAll('{[aei]}', 'abcdefghijklmnopqrstuvwxyz', $matches);
36-
$this->assertSame(3, $count);
37-
$this->assertSame(array(0 => array('a', 'e', 'i')), $matches);
36+
self::assertSame(3, $count);
37+
self::assertSame(array(0 => array('a', 'e', 'i')), $matches);
3838
}
3939

4040
/**
@@ -43,7 +43,7 @@ public function testSuccess()
4343
public function testSuccessNoRef()
4444
{
4545
$count = Preg::matchAll('{[aei]}', 'abcdefghijklmnopqrstuvwxyz');
46-
$this->assertSame(3, $count);
46+
self::assertSame(3, $count);
4747
}
4848

4949
/**
@@ -52,8 +52,8 @@ public function testSuccessNoRef()
5252
public function testFailure()
5353
{
5454
$count = Preg::matchAll('{abc}', 'def', $matches);
55-
$this->assertSame(0, $count);
56-
$this->assertSame(array(array()), $matches);
55+
self::assertSame(0, $count);
56+
self::assertSame(array(array()), $matches);
5757
}
5858

5959
/**

tests/PregTests/MatchTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$count = Preg::match('{(?P<m>[io])}', 'abcdefghijklmnopqrstuvwxyz', $matches);
36-
$this->assertSame(1, $count);
37-
$this->assertSame(array(0 => 'i', 'm' => 'i', 1 => 'i'), $matches);
36+
self::assertSame(1, $count);
37+
self::assertSame(array(0 => 'i', 'm' => 'i', 1 => 'i'), $matches);
3838
}
3939

4040
/**
@@ -43,7 +43,7 @@ public function testSuccess()
4343
public function testSuccessNoRef()
4444
{
4545
$count = Preg::match('{(?P<m>[io])}', 'abcdefghijklmnopqrstuvwxyz');
46-
$this->assertSame(1, $count);
46+
self::assertSame(1, $count);
4747
}
4848

4949
/**
@@ -52,8 +52,8 @@ public function testSuccessNoRef()
5252
public function testFailure()
5353
{
5454
$count = Preg::match('{abc}', 'def', $matches);
55-
$this->assertSame(0, $count);
56-
$this->assertSame(array(), $matches);
55+
self::assertSame(0, $count);
56+
self::assertSame(array(), $matches);
5757
}
5858

5959
/**

tests/PregTests/ReplaceCallbackArrayTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function testSuccess()
3939
return '('.$match[0].')';
4040
}), 'abcd', -1, $count);
4141

42-
$this->assertSame(1, $count);
43-
$this->assertSame('abc(d)', $result);
42+
self::assertSame(1, $count);
43+
self::assertSame('abc(d)', $result);
4444
}
4545

4646
/**
@@ -52,7 +52,7 @@ public function testSuccessNoRef()
5252
return '('.$match[0].')';
5353
}), 'abcd');
5454

55-
$this->assertSame('abc(d)', $result);
55+
self::assertSame('abc(d)', $result);
5656
}
5757

5858
/**
@@ -64,8 +64,8 @@ public function testFailure()
6464
return '('.$match[0].')';
6565
}), 'def', -1, $count);
6666

67-
$this->assertSame(0, $count);
68-
$this->assertSame('def', $result);
67+
self::assertSame(0, $count);
68+
self::assertSame('def', $result);
6969
}
7070

7171
/**

tests/PregTests/ReplaceCallbackTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function testSuccess()
3636
return '('.$match[0].')';
3737
}, 'abcd', -1, $count);
3838

39-
$this->assertSame(1, $count);
40-
$this->assertSame('abc(d)', $result);
39+
self::assertSame(1, $count);
40+
self::assertSame('abc(d)', $result);
4141
}
4242

4343
/**
@@ -49,7 +49,7 @@ public function testSuccessNoRef()
4949
return '('.$match[0].')';
5050
}, 'abcd');
5151

52-
$this->assertSame('abc(d)', $result);
52+
self::assertSame('abc(d)', $result);
5353
}
5454

5555
/**
@@ -61,8 +61,8 @@ public function testFailure()
6161
return '('.$match[0].')';
6262
}, 'def', -1, $count);
6363

64-
$this->assertSame(0, $count);
65-
$this->assertSame('def', $result);
64+
self::assertSame(0, $count);
65+
self::assertSame('def', $result);
6666
}
6767

6868
/**

tests/PregTests/ReplaceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$result = Preg::replace('{(?P<m>d)}', 'e', 'abcd', -1, $count);
36-
$this->assertSame(1, $count);
37-
$this->assertSame('abce', $result);
36+
self::assertSame(1, $count);
37+
self::assertSame('abce', $result);
3838
}
3939

4040
/**
@@ -43,7 +43,7 @@ public function testSuccess()
4343
public function testSuccessNoRef()
4444
{
4545
$result = Preg::replace('{(?P<m>d)}', 'e', 'abcd', -1);
46-
$this->assertSame('abce', $result);
46+
self::assertSame('abce', $result);
4747
}
4848

4949
/**
@@ -52,8 +52,8 @@ public function testSuccessNoRef()
5252
public function testFailure()
5353
{
5454
$result = Preg::replace('{abc}', '123', 'def', -1, $count);
55-
$this->assertSame(0, $count);
56-
$this->assertSame('def', $result);
55+
self::assertSame(0, $count);
56+
self::assertSame('def', $result);
5757
}
5858

5959
/**

tests/PregTests/SplitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function registerFunctionName()
3333
public function testSuccess()
3434
{
3535
$result = Preg::split('{[\s,]+}', 'a, b, c');
36-
$this->assertSame(array('a', 'b', 'c'), $result);
36+
self::assertSame(array('a', 'b', 'c'), $result);
3737
}
3838

3939
/**
@@ -42,7 +42,7 @@ public function testSuccess()
4242
public function testFailure()
4343
{
4444
$result = Preg::split('{[\s,]+}', 'abc');
45-
$this->assertSame(array('abc'), $result);
45+
self::assertSame(array('abc'), $result);
4646
}
4747

4848
/**

0 commit comments

Comments
 (0)