Fix/php84 nullable deprecation / phpunit update to 12.2#12
Open
g-i-kala wants to merge 14 commits intoapprovals:Mainfrom
Open
Fix/php84 nullable deprecation / phpunit update to 12.2#12g-i-kala wants to merge 14 commits intoapprovals:Mainfrom
g-i-kala wants to merge 14 commits intoapprovals:Mainfrom
Conversation
Reviewer's GuideThis PR upgrades PHPUnit to 12.2 with config and coverage support, cleans up deprecation issues by introducing nullable type hints, extracts a FileComparatorInterface with related refactoring, and modernizes the test suite with new tests and improved error‐handling cleanup. Class diagram for FileComparatorInterface extraction and refactoringclassDiagram
class FileComparatorInterface {
+checkFiles(string $approvedFilename, string $receivedFilename)
+clean(string $contents)
}
class FileApprover {
+checkFiles(string $approvedFilename, string $receivedFilename): bool
+clean(string $contents): string
}
FileApprover --|> FileComparatorInterface
class Approvals {
<<static>>
+fileComparator: ?FileComparatorInterface
+setFileComparator(?FileComparatorInterface $comparator)
+verifyString($received, ?Reporter $reporter = null)
+verifyStringWithFileExtension($received, $extensionWithoutDot, ?Reporter $reporter = null)
+verify(Writer $writer, Namer $namer, ?Reporter $reporter = null)
-filesMatch(string $approvedFilename, string $receivedFilename)
}
Approvals --> FileComparatorInterface : uses
Approvals --> FileApprover : default implementation
Class diagram for updated Namer interfaceclassDiagram
class Namer {
<<interface>>
+getApprovedFile($extension)
+getReceivedFile($extension)
+getCallingTestClassName()
+getCallingTestClassNameWithoutNamespace()
+getCallingTestMethodName()
+getCallingTestDirectory()
+getApprovalsDirectory()
}
Class diagram for updated DiffInfo constructorclassDiagram
class DiffInfo {
+__construct(string $diffProgram, array $fileExtensions, ?string $parameters = null)
+diffProgram
+parameters
+fileExtensions
}
Class diagram for CombinationApprovals nullable reporter refactorclassDiagram
class CombinationApprovals {
+verifyAllCombinations1($param, array $values, ?Reporter $reporter = null)
+verifyAllCombinations2($param, array $values1, array $values2, ?Reporter $reporter = null)
+verifyAllCombinations3($param, array $values1, array $values2, array $values3, ?Reporter $reporter = null)
+verifyAllCombinations4($param, array $values1, array $values2, array $values3, array $values4, ?Reporter $reporter = null)
+verifyAllCombinations5($param, array $values1, array $values2, array $values3, array $values4, array $values5, ?Reporter $reporter = null)
+verifyAllCombinations6($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, ?Reporter $reporter = null)
+verifyAllCombinations7($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, ?Reporter $reporter = null)
+verifyAllCombinations8($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, ?Reporter $reporter = null)
+verifyAllCombinations9($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, array $values9, ?Reporter $reporter = null)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request updates PHPUnit to the latest versions and aligns the test suite with modern expectations. It improves test reliability, resolves deprecations, and enhances local developer tooling.
The solution
e Upgraded PHPUnit to 10.5, then to 12.2, including config file migration and compatibility adjustments.
e Integrated PHPUnit coverage reporting with VSCode using Coverage Gutters.
e Cleaned .gitignore to remove phpcache and test report noise.
t Updated multiple test cases, including ErrorHandlerTest::testEWarning, to follow best practices and verify error conversion behavior.
R!! Added explicit nullable type hints for several classes and interfaces to fix deprecation warnings.
R!! Extracted FileComparatorInterface and declared getApprovalsDirectory to improve interface clarity.
t Validated functionality with targeted test updates like VerifyTransformedList and writeEmpty behavior.
Notation
All commits are prefixed using Arlo's Git Notation with a mix of:
e for environment/config changes
t for test updates
R!! for structural refactoring
Summary by Sourcery
Upgrade to PHPUnit 12.2, modernize test configuration and suite, fix PHP 8.4 deprecation warnings with nullable hints, and refactor approval comparison to use a pluggable FileComparatorInterface
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Tests:
Chores: