Skip to content

Commit d513d7e

Browse files
Add return types to tests and final|internal|private methods
1 parent f8fe899 commit d513d7e

File tree

8 files changed

+14
-16
lines changed

8 files changed

+14
-16
lines changed

Tests/Definition/Builder/ExprBuilderTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Config\Tests\Definition\Builder;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Config\Definition\Builder\ExprBuilder;
1516
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1617

1718
class ExprBuilderTest extends TestCase
@@ -201,10 +202,8 @@ public function testEndThenPartNotSpecified()
201202

202203
/**
203204
* Create a test treebuilder with a variable node, and init the validation.
204-
*
205-
* @return TreeBuilder
206205
*/
207-
protected function getTestBuilder()
206+
protected function getTestBuilder(): ExprBuilder
208207
{
209208
$builder = new TreeBuilder('test');
210209

@@ -225,7 +224,7 @@ protected function getTestBuilder()
225224
*
226225
* @return array The finalized config values
227226
*/
228-
protected function finalizeTestBuilder($testBuilder, $config = null)
227+
protected function finalizeTestBuilder($testBuilder, $config = null): array
229228
{
230229
return $testBuilder
231230
->end()
@@ -240,10 +239,8 @@ protected function finalizeTestBuilder($testBuilder, $config = null)
240239
* Return a closure that will return the given value.
241240
*
242241
* @param mixed $val The value that the closure must return
243-
*
244-
* @return \Closure
245242
*/
246-
protected function returnClosure($val)
243+
protected function returnClosure($val): \Closure
247244
{
248245
return function ($v) use ($val) {
249246
return $val;

Tests/Fixtures/Builder/BarNodeDefinition.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
1313

1414
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
15+
use Symfony\Component\Config\Definition\NodeInterface;
1516
use Symfony\Component\Config\Tests\Fixtures\BarNode;
1617

1718
class BarNodeDefinition extends NodeDefinition
1819
{
19-
protected function createNode()
20+
protected function createNode(): NodeInterface
2021
{
2122
return new BarNode($this->name);
2223
}

Tests/Fixtures/Builder/NodeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function barNode($name)
2020
return $this->node($name, 'bar');
2121
}
2222

23-
protected function getNodeClass($type)
23+
protected function getNodeClass($type): string
2424
{
2525
switch ($type) {
2626
case 'variable':

Tests/Fixtures/Configuration/ExampleConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class ExampleConfiguration implements ConfigurationInterface
1818
{
19-
public function getConfigTreeBuilder()
19+
public function getConfigTreeBuilder(): TreeBuilder
2020
{
2121
$treeBuilder = new TreeBuilder('acme_root');
2222

Tests/Loader/FileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function load($resource, $type = null)
103103
return $resource;
104104
}
105105

106-
public function supports($resource, $type = null)
106+
public function supports($resource, $type = null): bool
107107
{
108108
return $this->supports;
109109
}

Tests/Loader/LoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function load($resource, $type = null)
105105
{
106106
}
107107

108-
public function supports($resource, $type = null)
108+
public function supports($resource, $type = null): bool
109109
{
110110
return \is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION);
111111
}

Tests/Resource/ReflectionClassResourceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class TestEventSubscriber implements EventSubscriberInterface
204204
{
205205
public static $subscribedEvents = [];
206206

207-
public static function getSubscribedEvents()
207+
public static function getSubscribedEvents(): array
208208
{
209209
return self::$subscribedEvents;
210210
}
@@ -228,7 +228,7 @@ class TestServiceSubscriber implements ServiceSubscriberInterface
228228
{
229229
public static $subscribedServices = [];
230230

231-
public static function getSubscribedServices()
231+
public static function getSubscribedServices(): array
232232
{
233233
return self::$subscribedServices;
234234
}

Tests/Resource/ResourceStub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public function setFresh($isFresh)
2222
$this->fresh = $isFresh;
2323
}
2424

25-
public function __toString()
25+
public function __toString(): string
2626
{
2727
return 'stub';
2828
}
2929

30-
public function isFresh($timestamp)
30+
public function isFresh($timestamp): bool
3131
{
3232
return $this->fresh;
3333
}

0 commit comments

Comments
 (0)