Skip to content

Commit 1ab3afa

Browse files
Remove throws annotation for NoDataSetFromDataProviderException from methods that call hasDataFromDataProvider() before dataFromDataProvider()
1 parent 719ce8c commit 1ab3afa

19 files changed

+11
-66
lines changed

.psalm/baseline.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.17.0@c620f6e80d0abfca532b00bda366062aaedf6e5d">
2+
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
33
<file src="src/Event/Dispatcher/DirectDispatcher.php">
44
<UndefinedInterfaceMethod>
55
<code>notify</code>
@@ -149,6 +149,10 @@
149149
<code>hasDataFromDataProvider</code>
150150
<code>hasDataFromDataProvider</code>
151151
</ImpureMethodCall>
152+
<MissingThrowsDocblock>
153+
<code>dataFromDataProvider</code>
154+
<code>dataFromDataProvider</code>
155+
</MissingThrowsDocblock>
152156
</file>
153157
<file src="src/Event/Value/Test/TestMethodBuilder.php">
154158
<DeprecatedClass>
@@ -556,6 +560,9 @@
556560
<InvalidPropertyAssignmentValue>
557561
<code><![CDATA[$this->testSuiteTimes]]></code>
558562
</InvalidPropertyAssignmentValue>
563+
<MissingThrowsDocblock>
564+
<code>dataFromDataProvider</code>
565+
</MissingThrowsDocblock>
559566
<RedundantCondition>
560567
<code>assert($test instanceof TestMethod)</code>
561568
</RedundantCondition>
@@ -1126,6 +1133,9 @@
11261133
</PossiblyUndefinedArrayOffset>
11271134
</file>
11281135
<file src="src/TextUI/Output/Default/ResultPrinter.php">
1136+
<MissingThrowsDocblock>
1137+
<code>dataFromDataProvider</code>
1138+
</MissingThrowsDocblock>
11291139
<RedundantCondition>
11301140
<code>assert($test instanceof TestMethod)</code>
11311141
<code>assert($test instanceof TestMethod)</code>

src/Event/Value/Test/TestMethod.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use function assert;
1313
use function is_int;
1414
use function sprintf;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615
use PHPUnit\Event\TestData\TestDataCollection;
1716
use PHPUnit\Metadata\MetadataCollection;
1817

@@ -108,8 +107,6 @@ public function isTestMethod(): bool
108107

109108
/**
110109
* @psalm-return non-empty-string
111-
*
112-
* @throws NoDataSetFromDataProviderException
113110
*/
114111
public function id(): string
115112
{
@@ -124,8 +121,6 @@ public function id(): string
124121

125122
/**
126123
* @psalm-return non-empty-string
127-
*
128-
* @throws NoDataSetFromDataProviderException
129124
*/
130125
public function nameWithClass(): string
131126
{
@@ -134,8 +129,6 @@ public function nameWithClass(): string
134129

135130
/**
136131
* @psalm-return non-empty-string
137-
*
138-
* @throws NoDataSetFromDataProviderException
139132
*/
140133
public function name(): string
141134
{

src/Framework/TestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
use PHPUnit\Event;
6464
use PHPUnit\Event\NoPreviousThrowableException;
6565
use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException;
66-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
6766
use PHPUnit\Framework\Constraint\Exception as ExceptionConstraint;
6867
use PHPUnit\Framework\Constraint\ExceptionCode;
6968
use PHPUnit\Framework\Constraint\ExceptionMessageIsOrContains;
@@ -487,7 +486,6 @@ final public function status(): TestStatus
487486
* @throws CodeCoverageException
488487
* @throws Exception
489488
* @throws MoreThanOneDataSetFromDataProviderException
490-
* @throws NoDataSetFromDataProviderException
491489
* @throws NoPreviousThrowableException
492490
* @throws ProcessIsolationException
493491
* @throws StaticAnalysisCacheNotConfiguredException

src/Framework/TestRunner.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use PHPUnit\Event;
2727
use PHPUnit\Event\NoPreviousThrowableException;
2828
use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException;
29-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
3029
use PHPUnit\Metadata\Api\CodeCoverage as CodeCoverageMetadataApi;
3130
use PHPUnit\Metadata\Parser\Registry as MetadataRegistry;
3231
use PHPUnit\Runner\CodeCoverage;
@@ -62,7 +61,6 @@ public function __construct()
6261
* @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException
6362
* @throws CodeCoverageException
6463
* @throws MoreThanOneDataSetFromDataProviderException
65-
* @throws NoDataSetFromDataProviderException
6664
* @throws UnintentionallyCoveredCodeException
6765
*/
6866
public function run(TestCase $test): void

src/Logging/JUnit/JunitXmlLogger.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use PHPUnit\Event\Test\PreparationStarted;
3232
use PHPUnit\Event\Test\Prepared;
3333
use PHPUnit\Event\Test\Skipped;
34-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
3534
use PHPUnit\Event\TestSuite\Started;
3635
use PHPUnit\Event\UnknownSubscriberTypeException;
3736
use PHPUnit\TextUI\Output\Printer;
@@ -176,7 +175,6 @@ public function testSuiteFinished(): void
176175

177176
/**
178177
* @throws InvalidArgumentException
179-
* @throws NoDataSetFromDataProviderException
180178
*/
181179
public function testPreparationStarted(PreparationStarted $event): void
182180
{
@@ -185,7 +183,6 @@ public function testPreparationStarted(PreparationStarted $event): void
185183

186184
/**
187185
* @throws InvalidArgumentException
188-
* @throws NoDataSetFromDataProviderException
189186
*/
190187
public function testPreparationFailed(): void
191188
{
@@ -194,7 +191,6 @@ public function testPreparationFailed(): void
194191

195192
/**
196193
* @throws InvalidArgumentException
197-
* @throws NoDataSetFromDataProviderException
198194
*/
199195
public function testPrepared(): void
200196
{
@@ -215,7 +211,6 @@ public function testFinished(Finished $event): void
215211

216212
/**
217213
* @throws InvalidArgumentException
218-
* @throws NoDataSetFromDataProviderException
219214
*/
220215
public function testMarkedIncomplete(MarkedIncomplete $event): void
221216
{
@@ -224,7 +219,6 @@ public function testMarkedIncomplete(MarkedIncomplete $event): void
224219

225220
/**
226221
* @throws InvalidArgumentException
227-
* @throws NoDataSetFromDataProviderException
228222
*/
229223
public function testSkipped(Skipped $event): void
230224
{
@@ -233,7 +227,6 @@ public function testSkipped(Skipped $event): void
233227

234228
/**
235229
* @throws InvalidArgumentException
236-
* @throws NoDataSetFromDataProviderException
237230
*/
238231
public function testErrored(Errored $event): void
239232
{
@@ -244,7 +237,6 @@ public function testErrored(Errored $event): void
244237

245238
/**
246239
* @throws InvalidArgumentException
247-
* @throws NoDataSetFromDataProviderException
248240
*/
249241
public function testFailed(Failed $event): void
250242
{
@@ -319,7 +311,6 @@ private function createDocument(): void
319311

320312
/**
321313
* @throws InvalidArgumentException
322-
* @throws NoDataSetFromDataProviderException
323314
*/
324315
private function handleFault(Errored|Failed $event, string $type): void
325316
{
@@ -353,7 +344,6 @@ private function handleFault(Errored|Failed $event, string $type): void
353344

354345
/**
355346
* @throws InvalidArgumentException
356-
* @throws NoDataSetFromDataProviderException
357347
*/
358348
private function handleIncompleteOrSkipped(MarkedIncomplete|Skipped $event): void
359349
{
@@ -376,7 +366,6 @@ private function handleIncompleteOrSkipped(MarkedIncomplete|Skipped $event): voi
376366

377367
/**
378368
* @throws InvalidArgumentException
379-
* @throws NoDataSetFromDataProviderException
380369
*/
381370
private function testAsString(Test $test): string
382371
{
@@ -396,7 +385,6 @@ private function testAsString(Test $test): string
396385

397386
/**
398387
* @throws InvalidArgumentException
399-
* @throws NoDataSetFromDataProviderException
400388
*/
401389
private function name(Test $test): string
402390
{
@@ -429,7 +417,6 @@ private function name(Test $test): string
429417

430418
/**
431419
* @throws InvalidArgumentException
432-
* @throws NoDataSetFromDataProviderException
433420
*
434421
* @psalm-assert !null $this->currentTestCase
435422
*/

src/Logging/JUnit/Subscriber/TestErroredSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPUnit\Event\InvalidArgumentException;
1313
use PHPUnit\Event\Test\Errored;
1414
use PHPUnit\Event\Test\ErroredSubscriber;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615

1716
/**
1817
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -21,7 +20,6 @@ final class TestErroredSubscriber extends Subscriber implements ErroredSubscribe
2120
{
2221
/**
2322
* @throws InvalidArgumentException
24-
* @throws NoDataSetFromDataProviderException
2523
*/
2624
public function notify(Errored $event): void
2725
{

src/Logging/JUnit/Subscriber/TestFailedSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPUnit\Event\InvalidArgumentException;
1313
use PHPUnit\Event\Test\Failed;
1414
use PHPUnit\Event\Test\FailedSubscriber;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615

1716
/**
1817
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -21,7 +20,6 @@ final class TestFailedSubscriber extends Subscriber implements FailedSubscriber
2120
{
2221
/**
2322
* @throws InvalidArgumentException
24-
* @throws NoDataSetFromDataProviderException
2523
*/
2624
public function notify(Failed $event): void
2725
{

src/Logging/JUnit/Subscriber/TestFinishedSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPUnit\Event\InvalidArgumentException;
1313
use PHPUnit\Event\Test\Finished;
1414
use PHPUnit\Event\Test\FinishedSubscriber;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615

1716
/**
1817
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -21,7 +20,6 @@ final class TestFinishedSubscriber extends Subscriber implements FinishedSubscri
2120
{
2221
/**
2322
* @throws InvalidArgumentException
24-
* @throws NoDataSetFromDataProviderException
2523
*/
2624
public function notify(Finished $event): void
2725
{

src/Logging/JUnit/Subscriber/TestMarkedIncompleteSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPUnit\Event\InvalidArgumentException;
1313
use PHPUnit\Event\Test\MarkedIncomplete;
1414
use PHPUnit\Event\Test\MarkedIncompleteSubscriber;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615

1716
/**
1817
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -21,7 +20,6 @@ final class TestMarkedIncompleteSubscriber extends Subscriber implements MarkedI
2120
{
2221
/**
2322
* @throws InvalidArgumentException
24-
* @throws NoDataSetFromDataProviderException
2523
*/
2624
public function notify(MarkedIncomplete $event): void
2725
{

src/Logging/JUnit/Subscriber/TestPreparationFailedSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPUnit\Event\InvalidArgumentException;
1313
use PHPUnit\Event\Test\PreparationFailed;
1414
use PHPUnit\Event\Test\PreparationFailedSubscriber;
15-
use PHPUnit\Event\TestData\NoDataSetFromDataProviderException;
1615

1716
/**
1817
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -21,7 +20,6 @@ final class TestPreparationFailedSubscriber extends Subscriber implements Prepar
2120
{
2221
/**
2322
* @throws InvalidArgumentException
24-
* @throws NoDataSetFromDataProviderException
2523
*/
2624
public function notify(PreparationFailed $event): void
2725
{

0 commit comments

Comments
 (0)