Issue/481 enum exception coverage#484
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (23)
📝 WalkthroughWalkthroughThis pull request normalizes enum and exception coverage conventions across the codebase by: (1) making enum-like constant-holder classes Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 33 minutes and 4 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 18
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
tests/Unit/Session/Exceptions/SessionExceptionTest.php (1)
1-29:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The test coverage looks correct, but CI is still failing this file on PHP CS Fixer.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Session/Exceptions/SessionExceptionTest.php` around lines 1 - 29, Run PHP CS Fixer on the tests file and fix formatting issues in the SessionExceptionTest class (SessionExceptionTest, testSessionNotStarted, testSessionNotDestroyed) so it complies with project coding standards; re-run the fixer until no changes are suggested and commit the formatted file.tests/Unit/Csrf/Exceptions/CsrfExceptionTest.php (1)
1-29:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The factory coverage is correct, but this file is still not CS-compliant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Csrf/Exceptions/CsrfExceptionTest.php` around lines 1 - 29, This test file isn’t PHP-CS-Fixer compliant; run the project's PHP CS Fixer (or the configured linter) and apply the automatic fixes to CsrfExceptionTest (ensure file header spacing, indentation, blank lines between methods, and PSR-12 conforming braces/whitespace in the class and methods testTokenNotFound and testTokenNotMatched are corrected) so the file matches the repo coding standards before merging.tests/Unit/Storage/Exceptions/FileSystemExceptionTest.php (1)
1-32:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The assertions look fine, but CI is still reporting this file as not CS-compliant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Storage/Exceptions/FileSystemExceptionTest.php` around lines 1 - 32, Run PHP CS Fixer to make this test file comply with project coding standards; specifically reformat tests in the FileSystemExceptionTest class (methods testDirectoryNotExists, testDirectoryNotWritable, testFileAlreadyExists) by running the project's php-cs-fixer configuration (e.g., php-cs-fixer fix) and commit the resulting whitespace/formatting changes so CI passes.tests/Unit/Environment/Exceptions/EnvExceptionTest.php (1)
1-29:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The assertions align with the exception factories, but this file is still not CS-compliant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Environment/Exceptions/EnvExceptionTest.php` around lines 1 - 29, This test file (EnvExceptionTest class, methods testEnvironmentImmutable and testEnvironmentNotLoaded) is not PHP CS Fixer compliant; re-run php-cs-fixer (or the project's fixer command) on this file to fix formatting/spacing/namespace/import order and ensure it follows PSR-12 so the file passes CI linting before merging.tests/Unit/Di/Exceptions/DiExceptionTest.php (1)
1-53:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The tests cover the factory behavior well, but CI is still reporting this file as not CS-compliant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Di/Exceptions/DiExceptionTest.php` around lines 1 - 53, Re-run PHP CS Fixer (using the project config) and apply fixes to this test file so it meets coding standards; run the fixer (e.g. php-cs-fixer fix . --config=.php_cs.dist) or your repo's configured command, then re-check and commit the updated DiExceptionTest.php changes (class DiExceptionTest and its test methods testDependencyFactories, testAbstractAndCircularFactories, testInvalidCallableFactory) before merging so CI no longer flags CS violations.tests/Unit/Storage/Exceptions/FileUploadExceptionTest.php (1)
1-25:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The assertions look in line with the exception factories, but CI is still failing this file on PHP CS Fixer.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Storage/Exceptions/FileUploadExceptionTest.php` around lines 1 - 25, Re-run the project's PHP CS Fixer on the test file and fix any style issues so it passes CI: run the formatter against the file containing the FileUploadExceptionTest class (methods testFileTypeNotAllowed and testIncorrectMimeTypesConfig) and ensure formatting/spacing/braces follow the repository rules; verify resulting file compiles and assertions referencing FileUploadException factory methods still match after formatting.tests/Unit/View/Exceptions/ViewExceptionTest.php (1)
1-29:⚠️ Potential issue | 🟡 MinorRe-run PHP CS Fixer before merge.
The coverage is correct, but CI is still reporting this file as not CS-compliant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/View/Exceptions/ViewExceptionTest.php` around lines 1 - 29, Re-run PHP CS Fixer and apply the project coding standards to this test file (class ViewExceptionTest and its methods testNoLayoutSet and testViewNotRendered) so it becomes CS-compliant; run the configured php-cs-fixer command (or your pre-commit formatter) against this file and commit the resulting formatting changes (spacing, imports, and PSR-12 style fixes) before merging.
🧹 Nitpick comments (1)
src/Loader/Exceptions/LoaderException.php (1)
21-26: Fix mismatched class name in docblock.At Line 22, the docblock says
DatabaseException class, but this class isLoaderException. Please correct it to avoid misleading generated docs.Suggested patch
- * DatabaseException class + * Class LoaderException🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Loader/Exceptions/LoaderException.php` around lines 21 - 26, The docblock above the LoaderException class incorrectly labels it "DatabaseException class"; update the docblock summary to correctly refer to LoaderException so generated docs match the class. Locate the docblock for the LoaderException class in LoaderException.php and replace the "DatabaseException class" text with "LoaderException class" (or an appropriate description referencing LoaderException) so the class name and docblock are consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Captcha/Exceptions/CaptchaException.php`:
- Around line 21-24: Update the docblock to accurately reflect the defined class
name: change the line that reads "Class CacheException" to "Class
CaptchaException" in the CaptchaException class file so the docblock matches the
actual class (CaptchaException) and keep the `@package` and other annotations
unchanged.
In `@tests/Unit/App/Exceptions/AppExceptionTest.php`:
- Around line 1-18: Run the project's PHP formatter on the new test file to
apply coding standards fixes: open the AppExceptionTest class
(tests/Unit/App/Exceptions/AppExceptionTest.php) and run the repository's
formatter (e.g., php-cs-fixer fix or composer run format) so the
testMissingAppKeyFactory method and surrounding whitespace/formatting are
adjusted to the project's CS rules; commit the formatted file so CI no longer
reports PHP CS Fixer violations.
In `@tests/Unit/App/Exceptions/BaseExceptionTest.php`:
- Around line 1-61: Run php-cs-fixer on the changed test file (the
BaseExceptionTest and BaseExceptionStub definitions and their test methods such
as testMethodNotSupportedFactory, testAdapterAndDriverFactories,
testLookupAndConnectionFactories, testConfigAndRequestMethodFactories) to
normalize formatting/whitespace according to project rules, apply the fixes it
suggests, stage the updated file and re-run the test/CI pipeline so the PHP CS
Fixer violations are resolved before merging.
In `@tests/Unit/Asset/Exceptions/AssetExceptionTest.php`:
- Around line 1-27: Formatter fixes are required for AssetExceptionTest: run the
project's PHP CS Fixer (or php-cs-fixer fix) and apply its changes to the
AssetExceptionTest class so the file adheres to coding standards; ensure
spacing, imports, and line endings are corrected for the class
AssetExceptionTest and its methods testPositionInUse and testNameInUse and
commit the formatted file.
In `@tests/Unit/Auth/Exceptions/AuthExceptionTest.php`:
- Around line 1-44: Run PHP-CS-Fixer on the test file and commit the formatting
fixes so CI passes: apply PSR-12 formatting (or your project's php-cs-fixer
config) to tests/Unit/Auth/Exceptions/AuthExceptionTest.php — e.g., run
vendor/bin/php-cs-fixer fix (or your project equivalent) and commit the updated
file; ensure the AuthExceptionTest class (and its test methods like
testIncorrectCredentials, testInactiveAccount, etc.) are formatted according to
the fixer rules.
In `@tests/Unit/Config/Exceptions/ConfigExceptionTest.php`:
- Around line 1-18: The test file ConfigExceptionTest (class
ConfigExceptionTest, method testConfigCollision) is failing PHP CS Fixer; run
the project's formatter (e.g., php-cs-fixer fix . or the repository's configured
formatter command) against this file, apply the fixer output, and commit the
reformatted ConfigExceptionTest.php so it complies with PHP CS Fixer rules
before merging.
In `@tests/Unit/Encryption/Exceptions/CryptorExceptionTest.php`:
- Around line 1-36: The file CryptorExceptionTest contains PHP CS Fixer
formatting violations; run php-cs-fixer (or your project's pre-commit formatter)
against this file or the whole repo to normalize formatting, then commit the
updated file so the class CryptorExceptionTest and its test methods
(testPublicKeyNotProvided, testPrivateKeyNotProvided, testInvalidCipher) pass CI
linting; ensure you stage the formatted changes before pushing.
In `@tests/Unit/Hasher/Exceptions/HasherExceptionTest.php`:
- Around line 1-25: This file fails PHP CS Fixer rules; run php-cs-fixer (e.g.,
php-cs-fixer fix) and reformat the test class HasherExceptionTest so it complies
with project coding standards — ensure spacing, indentation, imports and
trailing newlines are fixed for the class and its methods
testAlgorithmNotSupported and testInvalidBcryptCost, then re-run tests/CI to
confirm the style violations are resolved.
In `@tests/Unit/Hook/Exceptions/HookExceptionTest.php`:
- Around line 1-27: Run PHP-CS-Fixer on this test file to normalize formatting
before merging; specifically apply the project's coding style to
HookExceptionTest (affecting methods testHookDuplicateName and
testUnregisteredHookName) and ensure spacing/line breaks and phpdoc/namespace
formatting conform to the fixer rules so the assertions around
HookException::hookDuplicateName and HookException::unregisteredHookName remain
unchanged, then commit the formatted file.
In `@tests/Unit/HttpClient/Exceptions/HttpClientExceptionTest.php`:
- Around line 1-18: Run the project's PHP CS Fixer/formatter and commit the
resulting changes for this test file: format
tests/Unit/HttpClient/Exceptions/HttpClientExceptionTest.php (the class
HttpClientExceptionTest and method testRequestNotCreated) so it adheres to the
repo coding standards; specifically run the configured fixer (e.g., php-cs-fixer
fix or composer run format), review and stage the updated file, and push the
formatted file so CI no longer reports style violations.
In `@tests/Unit/Jwt/Exceptions/JwtExceptionTest.php`:
- Around line 1-18: Run the PHP formatter/CS fixer and apply its changes to this
test file: open the JwtExceptionTest class and the testPayloadNotFound method,
run your project's PHP CS Fixer (e.g., php-cs-fixer fix or composer cs:fix) to
reformat according to the repo rules, review the modified JwtExceptionTest.php
to ensure spacing/imports follow the fixer output, and commit the formatted file
so CI no longer flags the file as non-compliant.
In `@tests/Unit/Lang/Exceptions/LangExceptionTest.php`:
- Around line 1-27: Run the PHP CS Fixer/formatter over the test file and commit
the fixed formatting so CI passes: open the LangExceptionTest class (methods
testTranslationsNotFound and testMisconfiguredDefaultConfig) and apply your
project formatter (e.g., run vendor/bin/php-cs-fixer fix
tests/Unit/Lang/Exceptions/LangExceptionTest.php or the repository's configured
php cbf/php-cs-fixer command), then stage the modified file and push the commit
containing only the formatting changes.
In `@tests/Unit/Logger/Exceptions/LoggerExceptionTest.php`:
- Around line 1-27: The file LoggerExceptionTest (class LoggerExceptionTest with
methods testLogPathIsNotDirectory and testLogPathIsNotFile) fails PHP-CS-Fixer
checks; run the project's php-cs-fixer configuration against this file (or run
the repo-wide fixer) to normalize formatting, then stage the formatted changes
and update the PR so CI passes — ensure you do not change test logic, only
formatting/PSR rules that php-cs-fixer enforces.
In `@tests/Unit/Middleware/Exceptions/MiddlewareExceptionTest.php`:
- Around line 1-18: The file MiddlewareExceptionTest::testMiddlewareNotFound is
failing PHP CS Fixer; run your formatter (e.g., vendor/bin/php-cs-fixer fix
tests/Unit/Middleware/Exceptions/MiddlewareExceptionTest.php or the project's
configured fixer) and commit the resulting changes so the file follows the
project's coding standards (apply PSR-12 spacing, use statement ordering,
trailing newline, and any other fixer edits) before merging.
In `@tests/Unit/Migration/Exceptions/MigrationExceptionTest.php`:
- Around line 1-45: The test file MigrationExceptionTest has PHP CS Fixer
formatting issues; run php-cs-fixer (e.g. php-cs-fixer fix) on the file
containing class MigrationExceptionTest and its test methods
(testWrongDirection, testUnsupportedAction, testNothingToMigrate,
testInvalidMigrationClass), apply the suggested formatting fixes, and commit the
corrected file so CI no longer fails on PHP CS Fixer violations.
In `@tests/Unit/Module/Exceptions/ModuleExceptionTest.php`:
- Around line 1-58: The file ModuleExceptionTest contains PHP CS Fixer style
violations; run php-cs-fixer (or your project's formatting command) against this
file (or the whole repository) and commit the reformatted output so tests pass
CI; specifically reformat the class ModuleExceptionTest and its methods (e.g.,
testModuleRoutesNotFound, testModuleConfigNotFound,
testModuleCreationIncomplete, testMissingModuleTemplate,
testMissingModuleDirectory, testModuleAlreadyExists, testDirectoryListingFailed)
to conform to the project's PHP CS Fixer rules before merging.
In `@tests/Unit/Paginator/Exceptions/PaginatorExceptionTest.php`:
- Around line 1-18: The test file PaginatorExceptionTest (method
testMissingRequiredParams) is failing PHP CS Fixer/formatter checks; run the
project's code formatter (e.g., php-cs-fixer or the repo's preconfigured
formatter) on that file or across the repo and apply the changes so the file
complies with the coding standards — then re-run tests/CI, ensuring
PaginatorExceptionTest and its assertions remain unchanged while only
whitespace/formatting are corrected.
In `@tests/Unit/Router/Exceptions/RouteExceptionTest.php`:
- Around line 10-34: Add assertions that verify the PHP error code (getCode())
for every RouteException factory used in this test: for each call to
RouteException::{incompleteControllerRoute, nestedGroups,
middlewaresOutsideRoute, controllerWithoutModule, cacheableOutsideRoute,
closureHandlerMissing, notClosure, nameBeforeDefinition, paramNameNotValid,
moduleRoutesNotClosure, nonUniqueNameInModule, actionNotFound,
invalidHandlerResponse, paramNameNotAvailable} add an
assertSame(<expected_code>, RouteException::...()->getCode()) following the
existing pattern used for noHttpMethods() and closureWithController(); determine
the correct expected code (E_ERROR or E_WARNING) by checking the corresponding
constants in the RouteException implementation and use that value in the
assertion.
---
Outside diff comments:
In `@tests/Unit/Csrf/Exceptions/CsrfExceptionTest.php`:
- Around line 1-29: This test file isn’t PHP-CS-Fixer compliant; run the
project's PHP CS Fixer (or the configured linter) and apply the automatic fixes
to CsrfExceptionTest (ensure file header spacing, indentation, blank lines
between methods, and PSR-12 conforming braces/whitespace in the class and
methods testTokenNotFound and testTokenNotMatched are corrected) so the file
matches the repo coding standards before merging.
In `@tests/Unit/Di/Exceptions/DiExceptionTest.php`:
- Around line 1-53: Re-run PHP CS Fixer (using the project config) and apply
fixes to this test file so it meets coding standards; run the fixer (e.g.
php-cs-fixer fix . --config=.php_cs.dist) or your repo's configured command,
then re-check and commit the updated DiExceptionTest.php changes (class
DiExceptionTest and its test methods testDependencyFactories,
testAbstractAndCircularFactories, testInvalidCallableFactory) before merging so
CI no longer flags CS violations.
In `@tests/Unit/Environment/Exceptions/EnvExceptionTest.php`:
- Around line 1-29: This test file (EnvExceptionTest class, methods
testEnvironmentImmutable and testEnvironmentNotLoaded) is not PHP CS Fixer
compliant; re-run php-cs-fixer (or the project's fixer command) on this file to
fix formatting/spacing/namespace/import order and ensure it follows PSR-12 so
the file passes CI linting before merging.
In `@tests/Unit/Session/Exceptions/SessionExceptionTest.php`:
- Around line 1-29: Run PHP CS Fixer on the tests file and fix formatting issues
in the SessionExceptionTest class (SessionExceptionTest, testSessionNotStarted,
testSessionNotDestroyed) so it complies with project coding standards; re-run
the fixer until no changes are suggested and commit the formatted file.
In `@tests/Unit/Storage/Exceptions/FileSystemExceptionTest.php`:
- Around line 1-32: Run PHP CS Fixer to make this test file comply with project
coding standards; specifically reformat tests in the FileSystemExceptionTest
class (methods testDirectoryNotExists, testDirectoryNotWritable,
testFileAlreadyExists) by running the project's php-cs-fixer configuration
(e.g., php-cs-fixer fix) and commit the resulting whitespace/formatting changes
so CI passes.
In `@tests/Unit/Storage/Exceptions/FileUploadExceptionTest.php`:
- Around line 1-25: Re-run the project's PHP CS Fixer on the test file and fix
any style issues so it passes CI: run the formatter against the file containing
the FileUploadExceptionTest class (methods testFileTypeNotAllowed and
testIncorrectMimeTypesConfig) and ensure formatting/spacing/braces follow the
repository rules; verify resulting file compiles and assertions referencing
FileUploadException factory methods still match after formatting.
In `@tests/Unit/View/Exceptions/ViewExceptionTest.php`:
- Around line 1-29: Re-run PHP CS Fixer and apply the project coding standards
to this test file (class ViewExceptionTest and its methods testNoLayoutSet and
testViewNotRendered) so it becomes CS-compliant; run the configured php-cs-fixer
command (or your pre-commit formatter) against this file and commit the
resulting formatting changes (spacing, imports, and PSR-12 style fixes) before
merging.
---
Nitpick comments:
In `@src/Loader/Exceptions/LoaderException.php`:
- Around line 21-26: The docblock above the LoaderException class incorrectly
labels it "DatabaseException class"; update the docblock summary to correctly
refer to LoaderException so generated docs match the class. Locate the docblock
for the LoaderException class in LoaderException.php and replace the
"DatabaseException class" text with "LoaderException class" (or an appropriate
description referencing LoaderException) so the class name and docblock are
consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9d9697c1-1ed4-41c9-8352-c75c5f09ff13
📒 Files selected for processing (44)
src/Auth/Enums/AuthKeys.phpsrc/Cache/Exceptions/CacheException.phpsrc/Captcha/Exceptions/CaptchaException.phpsrc/Cron/Enums/ExceptionMessages.phpsrc/Database/Enums/Key.phpsrc/Database/Enums/Relation.phpsrc/Database/Enums/Type.phpsrc/Environment/Enums/Env.phpsrc/Http/Enums/ContentType.phpsrc/Http/Enums/StatusCode.phpsrc/Http/Exceptions/HttpException.phpsrc/Loader/Exceptions/LoaderException.phpsrc/Mailer/Exceptions/MailerException.phpsrc/Paginator/Enums/Pagination.phpsrc/Renderer/Exceptions/RendererException.phpsrc/ResourceCache/Exceptions/ResourceCacheException.phpsrc/Service/Exceptions/ServiceException.phptests/Unit/App/Exceptions/AppExceptionTest.phptests/Unit/App/Exceptions/BaseExceptionTest.phptests/Unit/Archive/Exceptions/ArchiveExceptionTest.phptests/Unit/Asset/Exceptions/AssetExceptionTest.phptests/Unit/Auth/Exceptions/AuthExceptionTest.phptests/Unit/Config/Exceptions/ConfigExceptionTest.phptests/Unit/Csrf/Exceptions/CsrfExceptionTest.phptests/Unit/Database/Exceptions/DatabaseExceptionTest.phptests/Unit/Di/Exceptions/DiExceptionTest.phptests/Unit/Encryption/Exceptions/CryptorExceptionTest.phptests/Unit/Environment/Exceptions/EnvExceptionTest.phptests/Unit/Hasher/Exceptions/HasherExceptionTest.phptests/Unit/Hook/Exceptions/HookExceptionTest.phptests/Unit/HttpClient/Exceptions/HttpClientExceptionTest.phptests/Unit/Jwt/Exceptions/JwtExceptionTest.phptests/Unit/Lang/Exceptions/LangExceptionTest.phptests/Unit/Logger/Exceptions/LoggerExceptionTest.phptests/Unit/Middleware/Exceptions/MiddlewareExceptionTest.phptests/Unit/Migration/Exceptions/MigrationExceptionTest.phptests/Unit/Model/Exceptions/ModelExceptionTest.phptests/Unit/Module/Exceptions/ModuleExceptionTest.phptests/Unit/Paginator/Exceptions/PaginatorExceptionTest.phptests/Unit/Router/Exceptions/RouteExceptionTest.phptests/Unit/Session/Exceptions/SessionExceptionTest.phptests/Unit/Storage/Exceptions/FileSystemExceptionTest.phptests/Unit/Storage/Exceptions/FileUploadExceptionTest.phptests/Unit/View/Exceptions/ViewExceptionTest.php
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #484 +/- ##
============================================
+ Coverage 83.19% 85.28% +2.09%
Complexity 2903 2903
============================================
Files 249 249
Lines 7651 7651
============================================
+ Hits 6365 6525 +160
+ Misses 1286 1126 -160 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #481
Summary by CodeRabbit
Tests
Chores