Skip to content

refactor: fix the latent LSP violations in HTTP - #10463

Open
paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:http-lsp-fixes
Open

refactor: fix the latent LSP violations in HTTP#10463
paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:http-lsp-fixes

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Two changes that could break implementations:

  1. UploadedFileInterface::move() and UploadedFile::move() now returns static to be return-type compatible with the extended File::move() also returning static. The enforcement was in phpdocs only so phpstan only enforces this.
  2. OutgoingRequest::__construct()'s $uri parameter is now required (previously nullable) since (1) all concrete classes passes a URI, (2) OutgoingRequestInterface::getUri() should return URI and never nullable, and (3) the constructor calls $this->uri->getHost() which doesn't use a null-coalesce so non-null is almost always intended.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan added refactor Pull requests that refactor code breaking change Pull requests that may break existing functionalities labels Aug 14, 2026
@github-actions github-actions Bot added the 4.8 PRs that target the `4.8` branch. label Aug 14, 2026
@michalsn
michalsn requested a balanced review from Copilot August 14, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns HTTP PHPDoc contracts and runtime behavior for CodeIgniter 4.8.

Changes:

  • Requires a non-null URI for outgoing requests.
  • Changes uploaded-file moves to return the instance.
  • Removes resolved PHPStan baseline entries and documents compatibility changes.

Validation: Source review only; focused tests and PHPStan remain for CI.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
utils/phpstan-baseline/property.phpDocType.neon Removes resolved URI property error.
utils/phpstan-baseline/method.childReturnType.neon Removes resolved return-type baseline.
utils/phpstan-baseline/loader.neon Drops the obsolete baseline include.
user_guide_src/source/changelogs/v4.8.0.rst Documents HTTP compatibility changes.
system/HTTP/OutgoingRequest.php Makes URI required and non-null.
system/HTTP/IncomingRequest.php Inherits the parent URI documentation.
system/HTTP/Files/UploadedFileInterface.php Changes the documented move return type.
system/HTTP/Files/UploadedFile.php Returns the moved upload instance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

$this->name = basename($destination);

return true;
return $this;
- **Cache:** ``CodeIgniter\Cache\CacheInterface::remember()`` now accepts a TTL callable. Custom implementations of ``CacheInterface`` must update the ``$ttl`` parameter type from ``int`` to ``callable|int``.
- **Database:** ``CodeIgniter\Database\ConnectionInterface`` now requires the ``afterCommit()``, ``afterRollback()``, ``inTransaction()``, and ``transaction()`` methods.
- **HTTP:** ``CodeIgniter\HTTP\ResponseInterface`` now requires the ``stream()`` and ``eventStream()`` methods, which create streaming and SSE responses. See :ref:`streaming-responses`.
- **HTTP:** ``CodeIgniter\HTTP\Files\UploadedFileInterface::move()`` now returns ``static`` instead of ``bool``. The previous ``bool`` return was incompatible with ``CodeIgniter\Files\File::move()``, which ``UploadedFile`` extends, so no implementation could satisfy both.
- **Config:** ``CodeIgniter\Config\Services::request()`` no longer accepts any parameter.
- **Database:** The following methods have had their signatures updated to remove deprecated parameters:
- ``CodeIgniter\Database\Forge::_createTable()`` no longer accepts the deprecated ``$ifNotExists`` parameter. The method signature is now ``_createTable(string $table, array $attributes)``.
- **HTTP:** ``CodeIgniter\HTTP\OutgoingRequest::__construct()`` now requires the ``$uri`` parameter, which was previously ``?URI $uri = null``. Omitting it never worked, as the constructor dereferences the URI to set the ``Host`` header. Consequently ``OutgoingRequest::getUri()`` now returns ``URI`` instead of ``URI|null``, matching ``OutgoingRequestInterface``.
public function __construct(
string $method,
?URI $uri = null,
URI $uri,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. breaking change Pull requests that may break existing functionalities refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants