refactor: fix uses of empty() calls - #10439
Open
paulbalandan wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces PHP empty() usage with explicit comparisons and removes the corresponding PHPStan baseline.
Changes:
- Adds type-aware emptiness checks across framework components.
- Initializes database error strings and strengthens a session assertion.
- Removes 204 resolved PHPStan baseline errors.
Base branch was not provided; reviewed under develop compatibility rules. No tests were executed; CI validation remains required.
Reviewed changes
Copilot reviewed 65 out of 65 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
utils/phpstan-baseline/loader.neon |
Removes the resolved baseline include. |
utils/phpstan-baseline/empty.notAllowed.neon |
Deletes 204 suppressions. |
tests/system/Session/SessionTest.php |
Strengthens session regeneration assertions. |
system/View/Filters.php |
Adds explicit default-value detection. |
system/Validation/Rules.php |
Centralizes blank-value checks. |
system/Test/FilterTestTrait.php |
Refines filter result handling. |
system/Test/FeatureTestTrait.php |
Removes a redundant header guard. |
system/Session/Handlers/RedisHandler.php |
Explicitly validates save paths. |
system/Router/Router.php |
Validates the default controller type. |
system/Router/RouteCollection.php |
Refactors route emptiness checks. |
system/RESTful/BaseResource.php |
Refines model presence checks. |
system/Pager/Pager.php |
Explicitly checks final-page state. |
system/Images/Image.php |
Validates target filenames. |
system/Images/Handlers/BaseHandler.php |
Validates source dimensions. |
system/HTTP/Response.php |
Explicitly checks response status. |
system/HTTP/RequestTrait.php |
Refines proxy configuration validation. |
system/HTTP/Request.php |
Validates method and URI initialization. |
system/HTTP/MessageTrait.php |
Refines header population checks. |
system/HTTP/IncomingRequest.php |
Refactors forwarded HTTPS detection. |
system/HTTP/CURLRequest.php |
Refines query, header, and body checks. |
system/Honeypot/Honeypot.php |
Adds explicit content detection. |
system/Helpers/url_helper.php |
Refines popup window-name handling. |
system/Helpers/test_helper.php |
Validates mock metadata explicitly. |
system/Helpers/form_helper.php |
Refines submitted-form detection. |
system/Filters/Filters.php |
Refines before-filter result handling. |
system/Files/File.php |
Explicitly checks file extensions. |
system/Encryption/Handlers/SodiumHandler.php |
Validates key type and length. |
system/Encryption/Handlers/OpenSSLHandler.php |
Validates encryption key strings. |
system/Encryption/Encryption.php |
Refines driver and key validation. |
system/Email/Email.php |
Refactors email value checks. |
system/Debug/Toolbar.php |
Refines timeline child/query detection. |
system/Debug/Timer.php |
Refines timer state checks. |
system/Database/SQLSRV/Result.php |
Refines entity row detection. |
system/Database/SQLSRV/Forge.php |
Refactors schema attribute checks. |
system/Database/SQLSRV/Connection.php |
Refines credentials and connection checks. |
system/Database/SQLSRV/Builder.php |
Refactors SQL Server builder checks. |
system/Database/SQLite3/Table.php |
Refines prefix and foreign-key checks. |
system/Database/SQLite3/Forge.php |
Refactors cache and increment checks. |
system/Database/SQLite3/Connection.php |
Explicitly checks field results. |
system/Database/SQLite3/Builder.php |
Refines upsert constraint checks. |
system/Database/Query.php |
Initializes and checks query state. |
system/Database/Postgre/Result.php |
Refines entity row detection. |
system/Database/Postgre/Forge.php |
Refactors schema attribute checks. |
system/Database/Postgre/Connection.php |
Refines DSN and schema checks. |
system/Database/Postgre/Builder.php |
Refactors PostgreSQL builder checks. |
system/Database/OCI8/Forge.php |
Refactors schema attribute checks. |
system/Database/OCI8/Connection.php |
Refines database metadata checks. |
system/Database/OCI8/Builder.php |
Refines ordering and constraints. |
system/Database/MySQLi/Result.php |
Refines entity row detection. |
system/Database/MySQLi/Forge.php |
Refactors column attribute checks. |
system/Database/MySQLi/Connection.php |
Refines connection and SSL checks. |
system/Database/MigrationRunner.php |
Refines path and query checks. |
system/Database/Forge.php |
Refactors cache and field checks. |
system/Database/Database.php |
Refines DSN and driver validation. |
system/Database/BaseUtils.php |
Refines backup and result checks. |
system/Database/BaseResult.php |
Refines row availability checks. |
system/Database/BasePreparedQuery.php |
Initializes and checks error state. |
system/Database/BaseConnection.php |
Refactors connection and identifier checks. |
system/Database/BaseBuilder.php |
Refactors query-builder state checks. |
system/Config/Services.php |
Refines email configuration selection. |
system/Config/DotEnv.php |
Refines environment-variable checks. |
system/Config/BaseService.php |
Uses explicit service-instance checks. |
system/Commands/Database/Seed.php |
Refines missing seed-name detection. |
system/Commands/Database/MigrateStatus.php |
Explicitly checks migration results. |
system/Commands/Database/CreateDatabase.php |
Refines missing database-name detection. |
Suppressed comments (1)
system/Router/RouteCollection.php:1487
- An empty subdomain list previously imposed no restriction, but this condition treats
['subdomain' => []]as active.checkSubdomains([])then always returns false, so routes built from an empty dynamic list disappear. Keep empty arrays equivalent to the oldempty()check.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
paulbalandan
force-pushed
the
phpstan-empty-not-allowed
branch
from
August 8, 2026 06:15
993fa11 to
1150f6e
Compare
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
To fix the
empty.notAllowederrorsChecklist: