Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 4bc29f5

Browse files
authored
Fix partially supported callables deprecation (#55)
1 parent 2f6d26a commit 4bc29f5

10 files changed

+46
-40
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
php-version: '8.0'
4343
- phpunit-version: 8
4444
php-version: '8.1'
45+
- phpunit-version: 8
46+
php-version: '8.2'
47+
composer-flags: '--ignore-platform-req=PHP'
4548
- phpunit-version: 9
4649
php-version: '7.3'
4750
- phpunit-version: 9
@@ -50,6 +53,9 @@ jobs:
5053
php-version: '8.0'
5154
- phpunit-version: 9
5255
php-version: '8.1'
56+
- phpunit-version: 9
57+
php-version: '8.2'
58+
composer-flags: '--ignore-platform-req=PHP'
5359

5460
name: PHPUnit ${{ matrix.phpunit-version }} on PHP ${{ matrix.php-version }}
5561

src/ExpectOverSetExceptionTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function setExpectedException($exception, $message = '', $code = null)
2222
Reporter::report('Use `->expectExeption*()` methods instead of `->setExpectedException()`.');
2323
}
2424

25-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
25+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2626
}
2727
}
2828
} elseif (version_compare(PHPUnitVersionRetriever::getVersion(), '6.0') < 0) {
@@ -36,7 +36,7 @@ public function setExpectedException($exception, $message = '', $code = null)
3636
Reporter::report('Use `->expectExeption*()` methods instead of `->setExpectedException()`.');
3737
}
3838

39-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
39+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4040
}
4141

4242
public function setExpectedExceptionRegExp($exception, $message = '', $code = null)
@@ -47,7 +47,7 @@ public function setExpectedExceptionRegExp($exception, $message = '', $code = nu
4747
Reporter::report('Use `->expectExeption*()` methods instead of `->setExpectedExceptionRegExp()`.');
4848
}
4949

50-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
50+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5151
}
5252
}
5353
} else {

src/IdentityOverEqualityTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function assertEquals($expected, $actual, $message = '', $delta =
4040
Reporter::report('Use `->assertSame()` instead of `->assertEquals()`.');
4141
}
4242

43-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
43+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4444
}
4545

4646
public static function assertNotEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
@@ -52,7 +52,7 @@ public static function assertNotEquals($expected, $actual, $message = '', $delta
5252
Reporter::report('Use `->assertNotSame()` instead of `->assertNotEquals()`.');
5353
}
5454

55-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
55+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5656
}
5757

5858
public static function assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)

src/IdentityOverEqualityTrait7.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static function assertEquals($expected, $actual, string $message = '', fl
3333
Reporter::report('Use `->assertSame()` instead of `->assertEquals()`.');
3434
}
3535

36-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
36+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3737
}
3838

3939
public static function assertNotEquals($expected, $actual, string $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false): void
@@ -45,7 +45,7 @@ public static function assertNotEquals($expected, $actual, string $message = '',
4545
Reporter::report('Use `->assertNotSame()` instead of `->assertNotEquals()`.');
4646
}
4747

48-
\call_user_func_array(['parent', __FUNCTION__], \func_get_args());
48+
\call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4949
}
5050

5151
public static function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void

src/ProphecyOverMockObjectTrait.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,42 @@ public function getMockBuilder($className)
2222
{
2323
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
2424

25-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
25+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2626
}
2727

2828
public function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
2929
{
3030
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
3131

32-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
32+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3333
}
3434

3535
public function getMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
3636
{
3737
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
3838

39-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
39+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4040
}
4141

4242
protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)
4343
{
4444
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
4545

46-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
46+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4747
}
4848

4949
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = [])
5050
{
5151
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
5252

53-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
53+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5454
}
5555

5656
protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)
5757
{
5858
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
5959

60-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
60+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
6161
}
6262
}
6363
} elseif (version_compare(PHPUnitVersionRetriever::getVersion(), '6.0') < 0) {
@@ -67,42 +67,42 @@ public function getMockBuilder($className)
6767
{
6868
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
6969

70-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
70+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
7171
}
7272

7373
protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)
7474
{
7575
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
7676

77-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
77+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
7878
}
7979

8080
protected function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
8181
{
8282
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
8383

84-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
84+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
8585
}
8686

8787
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = [])
8888
{
8989
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
9090

91-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
91+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
9292
}
9393

9494
protected function getMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
9595
{
9696
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
9797

98-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
98+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
9999
}
100100

101101
protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)
102102
{
103103
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
104104

105-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
105+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
106106
}
107107
}
108108
} elseif (version_compare(PHPUnitVersionRetriever::getVersion(), '7.0.0') < 0) {
@@ -112,42 +112,42 @@ public function getMockBuilder($className)
112112
{
113113
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
114114

115-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
115+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
116116
}
117117

118118
protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)
119119
{
120120
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
121121

122-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
122+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
123123
}
124124

125125
protected function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
126126
{
127127
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
128128

129-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
129+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
130130
}
131131

132132
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = [])
133133
{
134134
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
135135

136-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
136+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
137137
}
138138

139139
protected function getMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false)
140140
{
141141
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
142142

143-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
143+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
144144
}
145145

146146
protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true)
147147
{
148148
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
149149

150-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
150+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
151151
}
152152
}
153153
} elseif (version_compare(PHPUnitVersionRetriever::getVersion(), '9.0.0') < 0) {

src/ProphecyOverMockObjectTrait7.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,41 @@ public function getMockBuilder($className): \PHPUnit\Framework\MockObject\MockBu
1919
{
2020
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
2121

22-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
22+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2323
}
2424

2525
protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false): string
2626
{
2727
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
2828

29-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
29+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3030
}
3131

3232
protected function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): \PHPUnit\Framework\MockObject\MockObject
3333
{
3434
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
3535

36-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
36+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3737
}
3838

3939
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = []): \PHPUnit\Framework\MockObject\MockObject
4040
{
4141
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
4242

43-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
43+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4444
}
4545

4646
protected function ggetMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): \PHPUnit\Framework\MockObject\MockObject
4747
{
4848
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
4949

50-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
50+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5151
}
5252

5353
protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true)
5454
{
5555
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
5656

57-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
57+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5858
}
5959
}

src/ProphecyOverMockObjectTrait9.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,41 @@ public function getMockBuilder($className): \PHPUnit\Framework\MockObject\MockBu
1919
{
2020
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
2121

22-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
22+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2323
}
2424

2525
protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false): string
2626
{
2727
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
2828

29-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
29+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3030
}
3131

3232
protected function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): \PHPUnit\Framework\MockObject\MockObject
3333
{
3434
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
3535

36-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
36+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
3737
}
3838

3939
protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = []): \PHPUnit\Framework\MockObject\MockObject
4040
{
4141
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
4242

43-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
43+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
4444
}
4545

4646
protected function ggetMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): \PHPUnit\Framework\MockObject\MockObject
4747
{
4848
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
4949

50-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
50+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5151
}
5252

5353
protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true): object
5454
{
5555
Reporter::report('Use `Prophecy` instead of basic `MockObject`.');
5656

57-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
57+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
5858
}
5959
}

src/ProphesizeOnlyInterfaceTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function prophesize($classOrInterface = null)
2424
Reporter::report('Prophecy shall be created only for (existing) interfaces.');
2525
}
2626

27-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
27+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2828
}
2929
}
3030
} else {

src/ProphesizeOnlyInterfaceTrait7.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ protected function prophesize($classOrInterface = null): \Prophecy\Prophecy\Obje
1919
Reporter::report('Prophecy shall be created only for (existing) interfaces.');
2020
}
2121

22-
return \call_user_func_array(['parent', __FUNCTION__], \func_get_args());
22+
return \call_user_func_array([parent::class, __FUNCTION__], \func_get_args());
2323
}
2424
}

tests/IdentityOverEqualityTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function assertAssertionExecution($assertionMethod, array $callArgs, $sho
4242
Reporter::setCustomReporter(function () {});
4343

4444
try {
45-
\call_user_func_array(['parent', $assertionMethod], $callArgs);
45+
\call_user_func_array([parent::class, $assertionMethod], $callArgs);
4646
} catch (ExpectationFailedException $e) {
4747
$shouldFail = true;
4848
}

0 commit comments

Comments
 (0)