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

Commit a854b7a

Browse files
committed
Upgrade to Phony 4.x
1 parent c9611c3 commit a854b7a

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Next release
44

5+
This release uses *Phony* `4.x`. There no BC breaking API changes aside from
6+
stricter type declarations.
7+
58
- **[BC BREAK]** PHP 7.1 is no longer supported.
69

710
## 2.0.0 (2017-09-29)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
],
1414
"require": {
1515
"php": ">=7.2",
16-
"eloquent/phony": "^3",
16+
"eloquent/phony": "^4",
1717
"peridot-php/peridot": "^1"
1818
},
1919
"require-dev": {
2020
"ext-pdo": "*",
2121
"eloquent/code-style": "^1",
22-
"eloquent/phpstan-phony": "^0.6",
22+
"eloquent/phpstan-phony": "^0.7",
2323
"errors/exceptions": "^0.2",
2424
"friendsofphp/php-cs-fixer": "^2",
2525
"peridot-php/leo": "^1",
2626
"peridot-php/peridot-code-coverage-reporters": "^3",
2727
"phpstan/extension-installer": "^1",
28-
"phpstan/phpstan": "^0.11"
28+
"phpstan/phpstan": "^0.12"
2929
},
3030
"autoload": {
3131
"psr-4": {

src/PeridotPhony.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PeridotPhony
1919
*
2020
* @return self The newly created plugin.
2121
*/
22-
public static function install(EventEmitterInterface $emitter)
22+
public static function install(EventEmitterInterface $emitter): self
2323
{
2424
$instance = new self();
2525
$instance->attach($emitter);
@@ -40,7 +40,7 @@ public static function create(): self
4040
/**
4141
* Attach the plugin.
4242
*/
43-
public function attach(EventEmitterInterface $emitter)
43+
public function attach(EventEmitterInterface $emitter): void
4444
{
4545
$emitter->on('suite.define', [$this, 'onSuiteDefine']);
4646
$emitter->on('suite.start', [$this, 'onSuiteStart']);
@@ -49,7 +49,7 @@ public function attach(EventEmitterInterface $emitter)
4949
/**
5050
* Detach the plugin.
5151
*/
52-
public function detach(EventEmitterInterface $emitter)
52+
public function detach(EventEmitterInterface $emitter): void
5353
{
5454
$emitter->removeListener('suite.define', [$this, 'onSuiteDefine']);
5555
$emitter->removeListener('suite.start', [$this, 'onSuiteStart']);
@@ -60,7 +60,7 @@ public function detach(EventEmitterInterface $emitter)
6060
*
6161
* @access private
6262
*/
63-
public function onSuiteDefine(Suite $suite)
63+
public function onSuiteDefine(Suite $suite): void
6464
{
6565
$definition = new ReflectionFunction($suite->getDefinition());
6666
$parameters = $definition->getParameters();
@@ -77,7 +77,7 @@ public function onSuiteDefine(Suite $suite)
7777
*
7878
* @access private
7979
*/
80-
public function onSuiteStart(Suite $suite)
80+
public function onSuiteStart(Suite $suite): void
8181
{
8282
foreach ($suite->getTests() as $test) {
8383
$definition = new ReflectionFunction($test->getDefinition());
@@ -95,7 +95,12 @@ private function __construct()
9595
{
9696
}
9797

98-
private function parameterArguments(array $parameters)
98+
/**
99+
* @param array<mixed> $parameters
100+
*
101+
* @return array<mixed>
102+
*/
103+
private function parameterArguments(array $parameters): array
99104
{
100105
$arguments = [];
101106

test/src/Test/TestClassA.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,66 @@
66

77
class TestClassA
88
{
9-
public static function testClassAStaticMethodA()
9+
public static function testClassAStaticMethodA(): string
1010
{
1111
return implode(func_get_args());
1212
}
1313

14-
public static function testClassAStaticMethodB($first, $second)
14+
public static function testClassAStaticMethodB(string $first, string $second): string
1515
{
1616
return implode(func_get_args());
1717
}
1818

19-
public function __construct(&$first = null, &$second = null)
19+
public function __construct(string &$first = null, string &$second = null)
2020
{
2121
$this->constructorArguments = func_get_args();
2222

2323
$first = 'first';
2424
$second = 'second';
2525
}
2626

27-
public function testClassAMethodA()
27+
public function testClassAMethodA(): string
2828
{
2929
return implode(func_get_args());
3030
}
3131

32-
public function testClassAMethodB($first, $second)
32+
public function testClassAMethodB(string $first, string $second): string
3333
{
3434
return implode(func_get_args());
3535
}
3636

37-
protected static function testClassAStaticMethodC()
37+
protected static function testClassAStaticMethodC(): string
3838
{
3939
return 'protected ' . implode(func_get_args());
4040
}
4141

42-
protected static function testClassAStaticMethodD($first, $second)
42+
protected static function testClassAStaticMethodD(string $first, string $second): string
4343
{
4444
return 'protected ' . implode(func_get_args());
4545
}
4646

47-
protected function testClassAMethodC()
47+
protected function testClassAMethodC(): string
4848
{
4949
return 'protected ' . implode(func_get_args());
5050
}
5151

52-
protected function testClassAMethodD(&$first, &$second)
52+
protected function testClassAMethodD(string &$first, string &$second): string
5353
{
5454
return 'protected ' . implode(func_get_args());
5555
}
5656

57-
private static function testClassAStaticMethodE()
57+
private static function testClassAStaticMethodE(): string
5858
{
5959
return 'private ' . implode(func_get_args());
6060
}
6161

62-
private function testClassAMethodE()
62+
private function testClassAMethodE(): string
6363
{
6464
return 'private ' . implode(func_get_args());
6565
}
6666

67+
/**
68+
* @var array<string>|null
69+
*/
6770
public $constructorArguments;
6871
}

0 commit comments

Comments
 (0)