-
Notifications
You must be signed in to change notification settings - Fork 9
Fix/php84 nullable deprecation / phpunit update to 12.2 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Main
Are you sure you want to change the base?
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: