Skip to content

Commit 8018433

Browse files
nicolas-grekasjderusse
authored andcommitted
Adopt @PHPUnit55Migration:risky rule of php-cs-fixer
1 parent 8173daf commit 8018433

File tree

12 files changed

+11
-72
lines changed

12 files changed

+11
-72
lines changed

.php_cs.dist

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ return PhpCsFixer\Config::create()
88
->setRules([
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
11-
'@PHPUnit48Migration:risky' => true,
12-
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
11+
'@PHPUnit75Migration:risky' => true,
12+
'php_unit_dedicate_assert' => ['target' => '3.5'],
13+
'phpdoc_no_empty_return' => false, // triggers almost always false positive
1314
'array_syntax' => ['syntax' => 'short'],
1415
'fopen_flags' => false,
1516
'ordered_imports' => true,

src/Symfony/Bridge/PhpUnit/Legacy/ForwardCompatTestTraitForV5.php

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,41 @@ trait ForwardCompatTestTraitForV5
2222
private $forwardCompatExpectedExceptionMessage = '';
2323
private $forwardCompatExpectedExceptionCode = null;
2424

25-
/**
26-
* @return void
27-
*/
2825
public static function setUpBeforeClass()
2926
{
3027
self::doSetUpBeforeClass();
3128
}
3229

33-
/**
34-
* @return void
35-
*/
3630
public static function tearDownAfterClass()
3731
{
3832
self::doTearDownAfterClass();
3933
}
4034

41-
/**
42-
* @return void
43-
*/
4435
protected function setUp()
4536
{
4637
self::doSetUp();
4738
}
4839

49-
/**
50-
* @return void
51-
*/
5240
protected function tearDown()
5341
{
5442
self::doTearDown();
5543
}
5644

57-
/**
58-
* @return void
59-
*/
6045
private static function doSetUpBeforeClass()
6146
{
6247
parent::setUpBeforeClass();
6348
}
6449

65-
/**
66-
* @return void
67-
*/
6850
private static function doTearDownAfterClass()
6951
{
7052
parent::tearDownAfterClass();
7153
}
7254

73-
/**
74-
* @return void
75-
*/
7655
private function doSetUp()
7756
{
7857
parent::setUp();
7958
}
8059

81-
/**
82-
* @return void
83-
*/
8460
private function doTearDown()
8561
{
8662
parent::tearDown();
@@ -107,8 +83,6 @@ protected function createMock($originalClassName)
10783

10884
/**
10985
* @param string $message
110-
*
111-
* @return void
11286
*/
11387
public static function assertIsArray($actual, $message = '')
11488
{
@@ -117,8 +91,6 @@ public static function assertIsArray($actual, $message = '')
11791

11892
/**
11993
* @param string $message
120-
*
121-
* @return void
12294
*/
12395
public static function assertIsBool($actual, $message = '')
12496
{
@@ -127,8 +99,6 @@ public static function assertIsBool($actual, $message = '')
12799

128100
/**
129101
* @param string $message
130-
*
131-
* @return void
132102
*/
133103
public static function assertIsFloat($actual, $message = '')
134104
{
@@ -137,8 +107,6 @@ public static function assertIsFloat($actual, $message = '')
137107

138108
/**
139109
* @param string $message
140-
*
141-
* @return void
142110
*/
143111
public static function assertIsInt($actual, $message = '')
144112
{
@@ -147,8 +115,6 @@ public static function assertIsInt($actual, $message = '')
147115

148116
/**
149117
* @param string $message
150-
*
151-
* @return void
152118
*/
153119
public static function assertIsNumeric($actual, $message = '')
154120
{
@@ -157,8 +123,6 @@ public static function assertIsNumeric($actual, $message = '')
157123

158124
/**
159125
* @param string $message
160-
*
161-
* @return void
162126
*/
163127
public static function assertIsObject($actual, $message = '')
164128
{
@@ -167,8 +131,6 @@ public static function assertIsObject($actual, $message = '')
167131

168132
/**
169133
* @param string $message
170-
*
171-
* @return void
172134
*/
173135
public static function assertIsResource($actual, $message = '')
174136
{
@@ -177,8 +139,6 @@ public static function assertIsResource($actual, $message = '')
177139

178140
/**
179141
* @param string $message
180-
*
181-
* @return void
182142
*/
183143
public static function assertIsString($actual, $message = '')
184144
{
@@ -187,8 +147,6 @@ public static function assertIsString($actual, $message = '')
187147

188148
/**
189149
* @param string $message
190-
*
191-
* @return void
192150
*/
193151
public static function assertIsScalar($actual, $message = '')
194152
{
@@ -197,8 +155,6 @@ public static function assertIsScalar($actual, $message = '')
197155

198156
/**
199157
* @param string $message
200-
*
201-
* @return void
202158
*/
203159
public static function assertIsCallable($actual, $message = '')
204160
{
@@ -207,8 +163,6 @@ public static function assertIsCallable($actual, $message = '')
207163

208164
/**
209165
* @param string $message
210-
*
211-
* @return void
212166
*/
213167
public static function assertIsIterable($actual, $message = '')
214168
{
@@ -217,8 +171,6 @@ public static function assertIsIterable($actual, $message = '')
217171

218172
/**
219173
* @param string $exception
220-
*
221-
* @return void
222174
*/
223175
public function expectException($exception)
224176
{
@@ -231,9 +183,6 @@ public function expectException($exception)
231183
parent::setExpectedException($exception, $this->forwardCompatExpectedExceptionMessage, $this->forwardCompatExpectedExceptionCode);
232184
}
233185

234-
/**
235-
* @return void
236-
*/
237186
public function expectExceptionCode($code)
238187
{
239188
if (method_exists(TestCase::class, 'expectExceptionCode')) {
@@ -248,8 +197,6 @@ public function expectExceptionCode($code)
248197

249198
/**
250199
* @param string $message
251-
*
252-
* @return void
253200
*/
254201
public function expectExceptionMessage($message)
255202
{
@@ -265,8 +212,6 @@ public function expectExceptionMessage($message)
265212

266213
/**
267214
* @param string $messageRegExp
268-
*
269-
* @return void
270215
*/
271216
public function expectExceptionMessageRegExp($messageRegExp)
272217
{
@@ -281,8 +226,6 @@ public function expectExceptionMessageRegExp($messageRegExp)
281226

282227
/**
283228
* @param string $exceptionMessage
284-
*
285-
* @return void
286229
*/
287230
public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = null)
288231
{
@@ -294,8 +237,6 @@ public function setExpectedException($exceptionName, $exceptionMessage = '', $ex
294237

295238
/**
296239
* @param string $exceptionMessageRegExp
297-
*
298-
* @return void
299240
*/
300241
public function setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = '', $exceptionCode = null)
301242
{

src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function testObjectCastToString()
165165
if (method_exists($this, 'createPartialMock')) {
166166
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
167167
} else {
168-
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
168+
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
169169
}
170170
$dummy->method('__toString')->willReturn('DUMMY');
171171

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function () {},
256256

257257
// assertEquals() does not like NAN values.
258258
$this->assertEquals($array[$i][0], 'float');
259-
$this->assertTrue(is_nan($array[$i++][1]));
259+
$this->assertNan($array[$i++][1]);
260260
}
261261

262262
public function testRecursionInArguments()

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ public function getAlias($id)
946946
* This methods allows for simple registration of service definition
947947
* with a fluid interface.
948948
*
949-
* @param string $id The service identifier
950-
* @param string $class|null The service class
949+
* @param string $id The service identifier
950+
* @param string|null $class The service class
951951
*
952952
* @return Definition A Definition instance
953953
*/

src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
16-
use Symfony\Component\DependencyInjection\Alias;
1716
use Symfony\Component\DependencyInjection\Container;
1817
use Symfony\Component\DependencyInjection\ContainerInterface;
1918
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ public function testReverseTransformExpectsValidNumber()
509509

510510
/**
511511
* @dataProvider nanRepresentationProvider
512+
*
512513
* @see https://github.com/symfony/symfony/issues/3161
513514
*/
514515
public function testReverseTransformDisallowsNaN($nan)

src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function testCreateButtonInstances()
2828
}
2929

3030
/**
31-
*
3231
* @param string $emptyData
3332
* @param null $expectedData
3433
*/

src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testObjectCastToString()
142142
if (method_exists($this, 'createPartialMock')) {
143143
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
144144
} else {
145-
$dummy = $this->getMock(DummyTest::class, ['__toString']);
145+
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
146146
}
147147
$dummy->expects($this->atLeastOnce())
148148
->method('__toString')

src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public function extractDateOptions($matched, $length)
9292
*
9393
* @return string A timezone identifier
9494
*
95-
* @see http://php.net/manual/en/timezones.others.php
96-
* @see http://www.twinsun.com/tz/tz-link.htm
95+
* @see http://php.net/manual/en/timezones.others.php
96+
* @see http://www.twinsun.com/tz/tz-link.htm
9797
*
9898
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
9999
* @throws \InvalidArgumentException When the value can not be matched with pattern

src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1514
use Symfony\Component\Lock\Exception\LockExpiredException;
1615
use Symfony\Component\Lock\Key;
1716
use Symfony\Component\Lock\StoreInterface;

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
16-
use Symfony\Component\Yaml\Exception\ParseException;
1716
use Symfony\Component\Yaml\Parser;
1817
use Symfony\Component\Yaml\Tag\TaggedValue;
1918
use Symfony\Component\Yaml\Yaml;

0 commit comments

Comments
 (0)