Skip to content

Commit 9be490d

Browse files
authored
Merge pull request #6946 from kenjis/fix-4.3-TransactionTest
[4.3] test: fix failed TransactionTest
2 parents d995c54 + b40ddb5 commit 9be490d

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

rector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
3030
use Rector\Config\RectorConfig;
3131
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
32+
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
3233
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
3334
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
3435
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
@@ -129,6 +130,11 @@
129130

130131
// buggy on union mixed type, new class extends SomeClass marked as object in union, and false replaced with bool in Union
131132
TypedPropertyFromAssignsRector::class,
133+
134+
// rector mistakenly removes `@return true`
135+
RemoveUselessReturnTagRector::class => [
136+
__DIR__ . '/system/Debug/Exceptions.php',
137+
],
132138
]);
133139

134140
// auto import fully qualified class names

system/Debug/Exceptions.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,6 @@ private function isDeprecationError(int $error): bool
379379
}
380380

381381
/**
382-
* @noRector \Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector
383-
*
384382
* @return true
385383
*/
386384
private function handleDeprecationError(string $message, ?string $file = null, ?int $line = null): bool

tests/system/Database/Live/TransactionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
namespace CodeIgniter\Database\Live;
1313

14+
use CodeIgniter\Database\Exceptions\DatabaseException;
1415
use CodeIgniter\Test\CIUnitTestCase;
1516
use CodeIgniter\Test\DatabaseTestTrait;
1617
use Config\Database;
17-
use Exception;
1818
use Tests\Support\Database\Seeds\CITestSeeder;
1919

2020
/**
@@ -78,7 +78,7 @@ public function testTransStartDBDebugTrue()
7878
$builder->insert($jobData);
7979

8080
$this->db->transComplete();
81-
} catch (Exception $e) {
81+
} catch (DatabaseException $e) {
8282
// Do nothing.
8383

8484
// MySQLi
@@ -99,7 +99,7 @@ public function testTransStartDBDebugTrue()
9999
// ErrorException: oci_execute(): ORA-00001: unique constraint (ORACLE.pk_db_job) violated
100100
}
101101

102-
$this->assertInstanceOf(Exception::class, $e);
102+
$this->assertInstanceOf(DatabaseException::class, $e);
103103
$this->dontSeeInDatabase('job', ['name' => 'Grocery Sales']);
104104
}
105105

0 commit comments

Comments
 (0)