Skip to content

Commit 10bb323

Browse files
Fix deprecated method usage
1 parent e2a35b2 commit 10bb323

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"captainhook/secrets": "^0.9.4",
4040
"sebastianfeldmann/camino": "^0.9.2",
4141
"sebastianfeldmann/cli": "^3.3",
42-
"sebastianfeldmann/git": "^3.13",
42+
"sebastianfeldmann/git": "^3.14",
4343
"symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
4444
"symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
4545
"symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"

src/Runner/Hook/CommitMsg.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CommitMsg extends Hook
3737
*/
3838
public function beforeHook(): void
3939
{
40-
$commentChar = $this->repository->getConfigOperator()->getSafely('core.commentchar', '#');
40+
$commentChar = $this->repository->getConfigOperator()->getSettingSafely('core.commentchar', '#');
4141
$commitMsg = Git\CommitMessage::createFromFile(
4242
$this->io->getArgument(Hooks::ARG_MESSAGE_FILE, ''),
4343
$commentChar

src/Runner/Hook/PrepareCommitMsg.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class PrepareCommitMsg extends Hook
6868
*/
6969
public function beforeHook(): void
7070
{
71-
$this->commentChar = $this->repository->getConfigOperator()->getSafely('core.commentchar', '#');
71+
$this->commentChar = $this->repository->getConfigOperator()->getSettingSafely('core.commentchar', '#');
7272
$this->file = $this->io->getArgument(Hooks::ARG_MESSAGE_FILE);
7373
$this->mode = $this->io->getArgument(Hooks::ARG_MODE);
7474
$this->hash = $this->io->getArgument(Hooks::ARG_HASH);

tests/unit/Runner/Hook/CommitMsgTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testRunHookEnabled(): void
4646
$io = $this->createIOMock();
4747
$config = $this->createConfigMock();
4848
$configOp = $this->createMock(ConfigOperator::class);
49-
$configOp->expects($this->once())->method('getSafely')->willReturn('#');
49+
$configOp->expects($this->once())->method('getSettingSafely')->willReturn('#');
5050

5151
$dummy = new DummyRepo(['hooks' => ['commit-msg' => '# hook script']]);
5252
$repo = $this->createRepositoryMock($dummy->getRoot());
@@ -78,7 +78,7 @@ public function testRunHookSkippedBecauseOfFixup(): void
7878
$io = $this->createIOMock();
7979
$config = $this->createConfigMock();
8080
$configOp = $this->createMock(ConfigOperator::class);
81-
$configOp->expects($this->once())->method('getSafely')->willReturn('#');
81+
$configOp->expects($this->once())->method('getSettingSafely')->willReturn('#');
8282

8383
$dummy = new DummyRepo(['hooks' => ['commit-msg' => '# hook script']]);
8484
$repo = $this->createRepositoryMock($dummy->getRoot());
@@ -124,7 +124,7 @@ public function testRunWithoutCommitMsgFile(): void
124124
$hookConfig->method('getActions')->willReturn([$actionConfig]);
125125
$config->method('getHookConfigToExecute')->willReturn($hookConfig);
126126
$config->expects($this->atLeastOnce())->method('isHookEnabled')->willReturn(true);
127-
$configOp->method('getSafely')->willReturn('#');
127+
$configOp->method('getSettingSafely')->willReturn('#');
128128
$repo->method('getConfigOperator')->willReturn($configOp);
129129
$io->expects($this->once())->method('getArgument')->willReturn('');
130130

tests/unit/Runner/Hook/PrepareCommitMsgTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testRunHookEnabled(): void
4646
$config->expects($this->atLeastOnce())->method('isHookEnabled')->willReturn(true);
4747

4848
$configOp = $this->createGitConfigOperator();
49-
$configOp->method('getSafely')->willReturn('#');
49+
$configOp->method('getSettingSafely')->willReturn('#');
5050
// setup fake vfs repos directory
5151
$dummy = new DummyRepo(['config' => '#config', 'hooks' => ['prepare-commit-msg' => '# hook script']]);
5252
$repo = new Repository($dummy->getRoot());
@@ -80,7 +80,7 @@ public function testRunHookNoMessageException(): void
8080
$repo->method('getHooksDir')->willReturn($dummy->getHookDir());
8181

8282
$configOp = $this->createGitConfigOperator();
83-
$configOp->method('getSafely')->willReturn('#');
83+
$configOp->method('getSettingSafely')->willReturn('#');
8484
$repo->method('getConfigOperator')->willReturn($configOp);
8585

8686
$io = $this->createIOMock();

0 commit comments

Comments
 (0)