Skip to content

Commit 67a48da

Browse files
Rename methods
1 parent 03050de commit 67a48da

File tree

5 files changed

+135
-135
lines changed

5 files changed

+135
-135
lines changed

src/Framework/Constraint/String/StringContains.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ public function toString(): string
5353
return sprintf(
5454
'contains "%s" [%s](length: %s)',
5555
$needle,
56-
$this->getDetectedEncoding($needle),
56+
$this->detectedEncoding($needle),
5757
strlen($needle),
5858
);
5959
}
6060

6161
public function failureDescription(mixed $other): string
6262
{
6363
$stringifiedHaystack = Exporter::export($other);
64-
$haystackEncoding = $this->getDetectedEncoding($other);
65-
$haystackLength = $this->getHaystackLength($other);
64+
$haystackEncoding = $this->detectedEncoding($other);
65+
$haystackLength = $this->haystackLength($other);
6666

6767
$haystackInformation = sprintf(
6868
'%s [%s](length: %s) ',
@@ -115,7 +115,7 @@ protected function matches(mixed $other): bool
115115
return str_contains($haystack, $this->needle);
116116
}
117117

118-
private function getDetectedEncoding(mixed $other): string
118+
private function detectedEncoding(mixed $other): string
119119
{
120120
if ($this->ignoreCase) {
121121
return 'Encoding ignored';
@@ -134,7 +134,7 @@ private function getDetectedEncoding(mixed $other): string
134134
return $detectedEncoding;
135135
}
136136

137-
private function getHaystackLength(mixed $haystack): int
137+
private function haystackLength(mixed $haystack): int
138138
{
139139
if (!is_string($haystack)) {
140140
return 0;

src/Framework/MockObject/Generator/Generator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function testDouble(string $type, bool $mockObject, bool $markAsMockObjec
151151
$callOriginalMethods,
152152
);
153153

154-
$object = $this->getObject(
154+
$object = $this->instantiate(
155155
$mock,
156156
$type,
157157
$callOriginalConstructor,
@@ -386,7 +386,7 @@ public function objectForTrait(string $traitName, string $traitClassName = '', b
386386
],
387387
);
388388

389-
return $this->getObject(
389+
return $this->instantiate(
390390
new MockTrait(
391391
$classTemplate->render(),
392392
$className['className'],
@@ -602,7 +602,7 @@ private function userDefinedInterfaceMethods(string $interfaceName): array
602602
* @throws ReflectionException
603603
* @throws RuntimeException
604604
*/
605-
private function getObject(MockType $mockClass, string $type = '', bool $callOriginalConstructor = false, array $arguments = [], bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $returnValueGeneration = true): object
605+
private function instantiate(MockType $mockClass, string $type = '', bool $callOriginalConstructor = false, array $arguments = [], bool $callOriginalMethods = false, ?object $proxyTarget = null, bool $returnValueGeneration = true): object
606606
{
607607
$className = $mockClass->generate();
608608

src/Framework/TestCase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,14 +1902,14 @@ private function stopOutputBuffering(): bool
19021902

19031903
private function snapshotGlobalErrorExceptionHandlers(): void
19041904
{
1905-
$this->backupGlobalErrorHandlers = $this->getActiveErrorHandlers();
1906-
$this->backupGlobalExceptionHandlers = $this->getActiveExceptionHandlers();
1905+
$this->backupGlobalErrorHandlers = $this->activeErrorHandlers();
1906+
$this->backupGlobalExceptionHandlers = $this->activeExceptionHandlers();
19071907
}
19081908

19091909
private function restoreGlobalErrorExceptionHandlers(): void
19101910
{
1911-
$activeErrorHandlers = $this->getActiveErrorHandlers();
1912-
$activeExceptionHandlers = $this->getActiveExceptionHandlers();
1911+
$activeErrorHandlers = $this->activeErrorHandlers();
1912+
$activeExceptionHandlers = $this->activeExceptionHandlers();
19131913

19141914
$message = null;
19151915

@@ -1972,7 +1972,7 @@ private function restoreGlobalErrorExceptionHandlers(): void
19721972
/**
19731973
* @return list<callable>
19741974
*/
1975-
private function getActiveErrorHandlers(): array
1975+
private function activeErrorHandlers(): array
19761976
{
19771977
$activeErrorHandlers = [];
19781978

@@ -2018,7 +2018,7 @@ private function getActiveErrorHandlers(): array
20182018
/**
20192019
* @return list<callable>
20202020
*/
2021-
private function getActiveExceptionHandlers(): array
2021+
private function activeExceptionHandlers(): array
20222022
{
20232023
$res = [];
20242024

src/Runner/PHPT/PhptTestCase.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function run(): void
228228
$diff = $e->getMessage();
229229
}
230230

231-
$hint = $this->getLocationHintFromDiff($diff, $sections);
231+
$hint = $this->locationHintFromDiff($diff, $sections);
232232
$trace = array_merge($hint, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
233233
$failure = new PhptAssertionFailedError(
234234
$e->getMessage(),
@@ -695,7 +695,7 @@ private function render(string $code): string
695695
/**
696696
* @return array{coverage: non-empty-string, job: non-empty-string}
697697
*/
698-
private function getCoverageFiles(): array
698+
private function coverageFiles(): array
699699
{
700700
$baseDir = dirname(realpath($this->filename)) . DIRECTORY_SEPARATOR;
701701
$basename = basename($this->filename, 'phpt');
@@ -715,7 +715,7 @@ private function getCoverageFiles(): array
715715
*/
716716
private function renderForCoverage(string &$job, bool $pathCoverage, ?string $codeCoverageCacheDirectory): void
717717
{
718-
$files = $this->getCoverageFiles();
718+
$files = $this->coverageFiles();
719719

720720
$template = new Template(
721721
__DIR__ . '/templates/phpt.tpl',
@@ -769,7 +769,7 @@ private function renderForCoverage(string &$job, bool $pathCoverage, ?string $co
769769
private function cleanupForCoverage(): RawCodeCoverageData
770770
{
771771
$coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]);
772-
$files = $this->getCoverageFiles();
772+
$files = $this->coverageFiles();
773773

774774
$buffer = false;
775775

@@ -821,7 +821,7 @@ private function stringifyIni(array $ini): array
821821
*
822822
* @return non-empty-list<array{file: non-empty-string, line: int}>
823823
*/
824-
private function getLocationHintFromDiff(string $message, array $sections): array
824+
private function locationHintFromDiff(string $message, array $sections): array
825825
{
826826
$needle = '';
827827
$previousLine = '';
@@ -840,13 +840,13 @@ private function getLocationHintFromDiff(string $message, array $sections): arra
840840

841841
if ($block === 'diff') {
842842
if (str_starts_with($line, '+')) {
843-
$needle = $this->getCleanDiffLine($previousLine);
843+
$needle = $this->cleanDiffLine($previousLine);
844844

845845
break;
846846
}
847847

848848
if (str_starts_with($line, '-')) {
849-
$needle = $this->getCleanDiffLine($line);
849+
$needle = $this->cleanDiffLine($line);
850850

851851
break;
852852
}
@@ -857,10 +857,10 @@ private function getLocationHintFromDiff(string $message, array $sections): arra
857857
}
858858
}
859859

860-
return $this->getLocationHint($needle, $sections);
860+
return $this->locationHint($needle, $sections);
861861
}
862862

863-
private function getCleanDiffLine(string $line): string
863+
private function cleanDiffLine(string $line): string
864864
{
865865
if (preg_match('/^[\-+]([\'\"]?)(.*)\1$/', $line, $matches)) {
866866
$line = $matches[2];
@@ -874,7 +874,7 @@ private function getCleanDiffLine(string $line): string
874874
*
875875
* @return non-empty-list<array{file: non-empty-string, line: int}>
876876
*/
877-
private function getLocationHint(string $needle, array $sections): array
877+
private function locationHint(string $needle, array $sections): array
878878
{
879879
$needle = trim($needle);
880880

0 commit comments

Comments
 (0)