Skip to content

Commit

Permalink
Merge pull request #19 from laradumps/fix-default-handler
Browse files Browse the repository at this point in the history
Fix default ide handler
  • Loading branch information
luanfreitasdev authored Feb 24, 2024
2 parents e2f6bf0 + e76f7d8 commit 3e626de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Actions/MakeFileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public static function handle(

$filepath = self::endsWithSeparator(strval($filepath));

if ($keyHandler === false || empty($keyHandler)) {
$keyHandler = 'phpstorm://open?file={filepath}&line={line}';
}

$keyHandler = str_replace('{filepath}', $filepath . $filename, $keyHandler);

/** @phpstan-ignore-next-line */
Expand Down
4 changes: 0 additions & 4 deletions src/Support/IdeHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public function make(): array
$className = explode('/', $path);
$className = end($className);

if ($fileHandle === 'DS_FILE_HANDLER' || $fileHandle === '') {
$fileHandle = 'phpstorm://open?file={filepath}&line={line}';
}

return [
'handler' => $fileHandle,
'path' => $path,
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Actions/MakeFileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

it('returns empty string when there is no .env keys ', function () {
fixtureEnv('ds_env', ['DS_FILE_HANDLER' => null]);
expect(MakeFileHandler::handle(['file' => '/home/index.php', 'line' => 2]))->toBe('');
expect(MakeFileHandler::handle(['file' => '/home/index.php', 'line' => 2]))->toBe('phpstorm://open?file=/Users/jamesbond/bomb-disarmer/index.php&line=2');
});

it('returns empty string when no file is given ', function () {
Expand Down

0 comments on commit 3e626de

Please sign in to comment.