Skip to content

Commit ff2e37e

Browse files
committed
fix: phpstan error
1 parent 056e26a commit ff2e37e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/Commands/UserModelGeneratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ protected function tearDown(): void
2525
stream_filter_remove($this->streamFilter);
2626
$result = str_replace(["\033[0;32m", "\033[0m", "\n"], '', CITestStreamFilter::$buffer);
2727

28-
$file = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
29-
if (is_file($file)) {
30-
unlink($file);
28+
$filepath = str_replace('APPPATH' . DIRECTORY_SEPARATOR, APPPATH, trim(substr($result, 14)));
29+
if (is_file($filepath)) {
30+
unlink($filepath);
3131
}
3232
}
3333

@@ -57,6 +57,7 @@ public function testGenerateUserModel(): void
5757
public function testGenerateUserModelCustomNamespace(): void
5858
{
5959
command('shield:model MyUserModel --namespace CodeIgniter\\\\Shield');
60+
$filepath = VENDORPATH . 'codeigniter4/shield/src/Models/MyUserModel.php';
6061

6162
$this->assertStringContainsString('File created: ', CITestStreamFilter::$buffer);
6263
$this->assertFileExists($filepath);
@@ -66,7 +67,6 @@ public function testGenerateUserModelCustomNamespace(): void
6667
$this->assertStringContainsString('use CodeIgniter\Shield\Models\UserModel;', $this->getFileContents($filepath));
6768
$this->assertStringContainsString('protected function initialize(): void', $this->getFileContents($filepath));
6869

69-
$filepath = VENDORPATH . 'codeigniter4/shield/src/Models/MyUserModel.php';
7070
if (is_file($filepath)) {
7171
unlink($filepath);
7272
}
@@ -79,9 +79,9 @@ public function testGenerateUserModelWithForce(): void
7979
command('shield:model MyUserModel --force');
8080
$this->assertStringContainsString('File overwritten: ', CITestStreamFilter::$buffer);
8181

82-
$file = APPPATH . 'Models/MyUserModel.php';
83-
if (is_file($file)) {
84-
unlink($file);
82+
$filepath = APPPATH . 'Models/MyUserModel.php';
83+
if (is_file($filepath)) {
84+
unlink($filepath);
8585
}
8686
}
8787

0 commit comments

Comments
 (0)