Skip to content

Commit b98d71e

Browse files
Carlos Garciaclaude
andcommitted
Complete PHP 8.0 compatibility fixes for tests
- Replace PHPUnit Attributes with docblock annotations for broader compatibility - Fix all remaining ReflectionClass method chaining syntax issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 47fa11c commit b98d71e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/src/InitEditorTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
use fsmaker\InitEditor;
66
use PHPUnit\Framework\TestCase;
7-
use PHPUnit\Framework\Attributes\CoversClass;
87

9-
#[CoversClass(InitEditor::class)]
8+
/**
9+
* @covers \fsmaker\InitEditor
10+
*/
1011
final class InitEditorTest extends TestCase
1112
{
1213
// Comprobar si detecta correctamente 1 existencia
@@ -507,14 +508,16 @@ private function isInvisibleChar(string $char): mixed
507508

508509
private function getRealStrPosFromNoSpaceStrPos(string $string, int $noSpacesPos, int $noSpaceWordsLength): mixed
509510
{
510-
$getRealStrPosFromNoSpaceStrPos = new ReflectionClass(InitEditor::class)->getMethod('getRealStrPosFromNoSpaceStrPos');
511+
$reflection = new ReflectionClass(InitEditor::class);
512+
$getRealStrPosFromNoSpaceStrPos = $reflection->getMethod('getRealStrPosFromNoSpaceStrPos');
511513

512514
return $getRealStrPosFromNoSpaceStrPos->invoke(null, $string, $noSpacesPos, $noSpaceWordsLength);
513515
}
514516

515517
private function getBracesAnalysis(string $str): mixed
516518
{
517-
$getBracesAnalysis = new ReflectionClass(InitEditor::class)->getMethod('getBracesAnalysis');
519+
$reflection = new ReflectionClass(InitEditor::class);
520+
$getBracesAnalysis = $reflection->getMethod('getBracesAnalysis');
518521

519522
return $getBracesAnalysis->invoke(null, $str);
520523
}
@@ -560,14 +563,16 @@ private function putUseInstruction(string $str, string $fileName): mixed
560563

561564
private function getCurrentIndentation(string $str, int $indentEndPos): mixed
562565
{
563-
$getCurrentIndentation = new ReflectionClass(InitEditor::class)->getMethod('getCurrentIndentation');
566+
$reflection = new ReflectionClass(InitEditor::class);
567+
$getCurrentIndentation = $reflection->getMethod('getCurrentIndentation');
564568

565569
return $getCurrentIndentation->invoke(null, $str, $indentEndPos);
566570
}
567571

568572
private function formatTextWithIndentation(string $str, string $indention): mixed
569573
{
570-
$formatTextWithIndentation = new ReflectionClass(InitEditor::class)->getMethod('formatTextWithIndentation');
574+
$reflection = new ReflectionClass(InitEditor::class);
575+
$formatTextWithIndentation = $reflection->getMethod('formatTextWithIndentation');
571576

572577
return $formatTextWithIndentation->invoke(null, $str, $indention);
573578
}

0 commit comments

Comments
 (0)