Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit fc2abd0

Browse files
committed
#41 hardening PropertyGeneratorTest method return types
1 parent eb4964e commit fc2abd0

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

test/Generator/PropertyGeneratorTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
*/
2525
class PropertyGeneratorTest extends TestCase
2626
{
27-
public function testPropertyConstructor()
27+
public function testPropertyConstructor() : void
2828
{
2929
$codeGenProperty = new PropertyGenerator();
3030
self::assertInstanceOf(PropertyGenerator::class, $codeGenProperty);
3131
}
3232

3333
/**
34-
* @return array
34+
* @return bool[][]|string[][]|int[][]|null[][]
3535
*/
36-
public function dataSetTypeSetValueGenerate()
36+
public function dataSetTypeSetValueGenerate() : array
3737
{
3838
return [
3939
['string', 'foo', "'foo';"],
@@ -56,7 +56,7 @@ public function dataSetTypeSetValueGenerate()
5656
* @param mixed $value
5757
* @param string $code
5858
*/
59-
public function testSetTypeSetValueGenerate($type, $value, $code)
59+
public function testSetTypeSetValueGenerate(string $type, $value, string $code) : void
6060
{
6161
$defaultValue = new PropertyValueGenerator();
6262
$defaultValue->setType($type);
@@ -72,9 +72,9 @@ public function testSetTypeSetValueGenerate($type, $value, $code)
7272
* @param mixed $value
7373
* @param string $code
7474
*/
75-
public function testSetBogusTypeSetValueGenerateUseAutoDetection($type, $value, $code)
75+
public function testSetBogusTypeSetValueGenerateUseAutoDetection(string $type, $value, string $code) : void
7676
{
77-
if ($type == 'constant') {
77+
if ('constant' === $type) {
7878
return; // constant can only be detected explicitly
7979
}
8080

@@ -85,13 +85,13 @@ public function testSetBogusTypeSetValueGenerateUseAutoDetection($type, $value,
8585
self::assertEquals($code, $defaultValue->generate());
8686
}
8787

88-
public function testPropertyReturnsSimpleValue()
88+
public function testPropertyReturnsSimpleValue() : void
8989
{
9090
$codeGenProperty = new PropertyGenerator('someVal', 'some string value');
9191
self::assertEquals(' public $someVal = \'some string value\';', $codeGenProperty->generate());
9292
}
9393

94-
public function testPropertyMultilineValue()
94+
public function testPropertyMultilineValue() : void
9595
{
9696
$targetValue = [
9797
5,
@@ -121,7 +121,7 @@ public function testPropertyMultilineValue()
121121
self::assertEquals($expectedSource, $targetSource);
122122
}
123123

124-
public function testPropertyCanProduceContstantModifier()
124+
public function testPropertyCanProduceContstantModifier() : void
125125
{
126126
$codeGenProperty = new PropertyGenerator('someVal', 'some string value', PropertyGenerator::FLAG_CONSTANT);
127127
self::assertEquals(' const someVal = \'some string value\';', $codeGenProperty->generate());
@@ -130,14 +130,14 @@ public function testPropertyCanProduceContstantModifier()
130130
/**
131131
* @group PR-704
132132
*/
133-
public function testPropertyCanProduceContstantModifierWithSetter()
133+
public function testPropertyCanProduceContstantModifierWithSetter() : void
134134
{
135135
$codeGenProperty = new PropertyGenerator('someVal', 'some string value');
136136
$codeGenProperty->setConst(true);
137137
self::assertEquals(' const someVal = \'some string value\';', $codeGenProperty->generate());
138138
}
139139

140-
public function testPropertyCanProduceStaticModifier()
140+
public function testPropertyCanProduceStaticModifier() : void
141141
{
142142
$codeGenProperty = new PropertyGenerator('someVal', 'some string value', PropertyGenerator::FLAG_STATIC);
143143
self::assertEquals(' public static $someVal = \'some string value\';', $codeGenProperty->generate());
@@ -146,7 +146,7 @@ public function testPropertyCanProduceStaticModifier()
146146
/**
147147
* @group ZF-6444
148148
*/
149-
public function testPropertyWillLoadFromReflection()
149+
public function testPropertyWillLoadFromReflection() : void
150150
{
151151
$reflectionClass = new ClassReflection(TestAsset\TestClassWithManyProperties::class);
152152

@@ -173,7 +173,7 @@ public function testPropertyWillLoadFromReflection()
173173
/**
174174
* @group ZF-6444
175175
*/
176-
public function testPropertyWillEmitStaticModifier()
176+
public function testPropertyWillEmitStaticModifier() : void
177177
{
178178
$codeGenProperty = new PropertyGenerator(
179179
'someVal',
@@ -186,7 +186,7 @@ public function testPropertyWillEmitStaticModifier()
186186
/**
187187
* @group ZF-7205
188188
*/
189-
public function testPropertyCanHaveDocBlock()
189+
public function testPropertyCanHaveDocBlock() : void
190190
{
191191
$codeGenProperty = new PropertyGenerator(
192192
'someVal',
@@ -205,7 +205,7 @@ public function testPropertyCanHaveDocBlock()
205205
self::assertEquals($expected, $codeGenProperty->generate());
206206
}
207207

208-
public function testOtherTypesThrowExceptionOnGenerate()
208+
public function testOtherTypesThrowExceptionOnGenerate() : void
209209
{
210210
$codeGenProperty = new PropertyGenerator('someVal', new \stdClass());
211211

@@ -215,7 +215,7 @@ public function testOtherTypesThrowExceptionOnGenerate()
215215
$codeGenProperty->generate();
216216
}
217217

218-
public function testCreateFromArray()
218+
public function testCreateFromArray() : void
219219
{
220220
$propertyGenerator = PropertyGenerator::fromArray([
221221
'name' => 'SampleProperty',
@@ -241,9 +241,9 @@ public function testCreateFromArray()
241241
}
242242

243243
/**
244-
* @3491
244+
* @group 3491
245245
*/
246-
public function testPropertyDocBlockWillLoadFromReflection()
246+
public function testPropertyDocBlockWillLoadFromReflection() : void
247247
{
248248
$reflectionClass = new ClassReflection(TestAsset\TestClassWithManyProperties::class);
249249

@@ -268,7 +268,7 @@ public function testPropertyDocBlockWillLoadFromReflection()
268268
* @param string $type
269269
* @param mixed $value
270270
*/
271-
public function testSetDefaultValue($type, $value)
271+
public function testSetDefaultValue(string $type, $value) : void
272272
{
273273
$property = new PropertyGenerator();
274274
$property->setDefaultValue($value, $type);

0 commit comments

Comments
 (0)