Skip to content

Fix code bugs from docs audit (#22); docs alignment and IDateTime alias - #23

Merged
manychois merged 8 commits into
mainfrom
dev0.0.3
Sep 29, 2026
Merged

manychois merged 8 commits into
mainfrom
dev0.0.3

Conversation

@manychois

Copy link
Copy Markdown
Owner

Closes #22.

Fixes for #22

  1. FileCachePool returned expired entries from its per-instance memo. read() now checks the expiry of a remembered entry again. An expired one becomes a miss, and its file is deleted, the same as on a first read. New test: getItem_missesOnceARememberedItemHasExpiredOnTheSameInstance.
  2. RequestFactory::createServerRequest() ignored its own key check. Server params whose key is not a string are now dropped, which is what ServerRequest::fromGlobals() already does for $_SERVER.
    • I chose to drop them rather than throw. The existing test passes the value 'ignored-non-string-key', and PSR-17 declares no exception for this method.
    • That test now asserts the entry is dropped and has been renamed to match.
    • The misleading @phpstan-assert helper is gone.
  3. Iter::unique() / Seq::unique() did not throw for null without a key selector. They now throw TypeError, as the PHPDoc and docs/collections.md already said.
    • Before, null was silently turned into the key ''.
    • PHP 8.5 also deprecates null as an array offset.
    • New test: uniqueThrowsTypeErrorForNullElementWithoutKeySelector.
  4. Http\Internal\AbstractMessage was missing @internal. Added.

docs/http.md and docs/collections.md are updated for fixes 2 and 3.

Also on this branch (already pushed to dev0.0.3)

  • The Markdown docs were aligned with the source code: README, CLAUDE.md, the coding standard and every module guide.
  • DateTimeInterface is now imported as IDateTime. The interface-alias convention now covers PHP built-ins.
  • The outdated "no abstract base classes in the public API" rule was removed from CLAUDE.md.
  • Earlier dev0.0.3 work:
    • DataReader nullGet, asTrimmedString, and defaults for as*.
    • Container resolves ContainerInterface to itself.
    • Container make() and autowiring.

Testing

  • composer could not install dependencies in the authoring environment, so phpcs, phpstan and PHPUnit were not run locally. CI on this PR runs them.
  • The fixes were smoke-tested on PHP 8.4 against the real PSR interface packages:
    • The cache expiry scenario fails on the old code and passes on the new.
    • Server params with integer keys are dropped.
    • null throws, and the existing coercion behaviour of unique() is unchanged.
  • All changed PHP files pass php -l.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZyjWKt2WYxDc2vbY8Z6jV


Generated by Claude Code

manychois and others added 8 commits August 27, 2026 23:25
…update as* methods to read missing keys as null; add asTrimmedString method for trimmed string conversion with default fallback; improve tests for new functionality
…or as* methods; update tests to verify behavior with null values and defaults.
Fix stale or inaccurate claims and fill gaps in README, CLAUDE.md, the
coding standard and every module guide under docs/ (http, cache, time,
collections, texts, logging, events, links, dependency-injection).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZyjWKt2WYxDc2vbY8Z6jV
Import DateTimeInterface as IDateTime in src/ and tests/, and extend the
interface-alias convention in CLAUDE.md and the coding standard to PHP
built-ins. Remove the "no abstract base classes in the public API" rule
from CLAUDE.md, which no longer reflects the codebase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZyjWKt2WYxDc2vbY8Z6jV
- FileCachePool: re-check expiry of a remembered entry so an item read or
  saved on the same instance stops being a hit once it expires; the stale
  file is deleted, as for a first read.
- RequestFactory::createServerRequest(): drop server params whose key is
  not a string, as ServerRequest::fromGlobals() does, instead of calling a
  check whose result was ignored and whose @phpstan-assert lied.
- Iter::unique() / Seq::unique(): throw TypeError for a null element when
  no key selector is given, matching the documented contract (null was
  silently coerced to '' and is a deprecated array offset in PHP 8.5).
- Mark Http\Internal\AbstractMessage as @internal.

Closes #22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZyjWKt2WYxDc2vbY8Z6jV
@manychois
manychois merged commit 5cae8b5 into main Sep 29, 2026
5 checks passed
@manychois
manychois deleted the dev0.0.3 branch September 29, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code bugs found during docs audit (FileCachePool memo expiry, RequestFactory server params, Iter::unique null, AbstractMessage @internal)

2 participants