Minimum version changed to PHP 8.5 - #1
Merged
Merged
Conversation
added 9 commits
September 11, 2026 16:30
There was a problem hiding this comment.
🟡 Changes recommended
The CPF assertion regex must be corrected to reject arbitrary text before or after a valid CPF.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates the CPF validation package to require PHP 8.5, modernizes typing and PHPUnit tests, and refreshes documentation and dependencies.
Changes:
- Raises PHP and PHPUnit requirements.
- Adds strict typing and nullable CPF signatures.
- Updates tests, documentation, and dependency metadata.
File summaries
| File | Reviewed changes |
|---|---|
tests/IsValidCpfTest.php |
Modernizes tests with strict typing and PHPUnit attributes. |
tests/CpfTestCase.php |
Expands invalid input coverage, including null. |
tests/AssertCpfTest.php |
Updates assertion tests with strict typing and attributes. |
src/is_valid_cpf.func.php |
Adds strict typing and nullable input handling. |
src/assert_cpf.func.php |
Adds nullable assertion typing. Critical (3 votes): the regex alternatives are not fully grouped and anchored, allowing arbitrary surrounding text. |
README.md |
Documents PHP 8.5 requirements and updated signatures. |
composer.lock |
Locks updated dependency versions. |
composer.json |
Updates requirements and package metadata. |
Review details
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified; only a minor wording nit remains.
Review details
Suppressed comments (1)
src/assert_cpf.func.php:11
- Because this signature now explicitly permits
null,assert_cpf(null)reaches theempty()branch, but the exception still says only that the CPF must not be an empty string. Update the validation branch and message to distinguishnulland an empty string so callers can understand why nullable input was rejected.
function assert_cpf(?string $cpf): void {
if (empty($cpf)) {
throw new InvalidArgumentException('The CPF must not be an empty string.');
- Files reviewed: 7/8 changed files
- Comments generated: 0 new
- Review effort level: Lite
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.
This pull request updates the CPF validation package to require PHP 8.5 or greater and improves type safety and test coverage. It also modernizes the codebase with stricter typing, updates documentation, and enhances test practices. The most important changes are summarized below:
PHP Version and Dependency Updates:
composer.jsonand documentation. Updated PHPUnit dependency to version 13.3. [1] [2]Type Safety and Function Signatures:
is_valid_cpfandassert_cpffunctions to accept nullable string arguments (?string $cpf) and addeddeclare(strict_types=1);for strict type enforcement in all PHP files. [1] [2]Documentation Improvements:
README.mdto reflect new function signatures, PHP version requirements, and improved descriptions for clarity and accuracy. [1] [2] [3] [4]Testing Enhancements:
nullas an invalid CPF and ensuring string casting where appropriate in test loops. [1] [2]Internationalization and Consistency:
composer.jsonand documentation.These changes modernize the codebase, improve reliability, and ensure better compatibility with recent PHP and PHPUnit versions.