refactor(encryption+filesystem): Contracts + exception relocation (task 2.9 + 2.10) - #45
Open
agissept wants to merge 2 commits into
Conversation
…rop symfony/security (task 2.9)
Encrypter now `implements Contracts\Encryption\{Encrypter, StringEncrypter}`:
add getAllKeys()/getPreviousKeys() (single-key fork; rotation arrives with the
illuminate/encryption swap), remove setKey() (strict-mode: method-not-found),
and throw Contracts\Encryption\EncryptException instead of \RuntimeException on
encrypt failure. DecryptException canonical location moves to Contracts; the old
Illuminate\Encryption\DecryptException becomes a class_alias bridge so existing
catch sites keep matching until the swap. New StringEncrypter contract mirrors
v13. Container resolves both encryption contracts to 'encrypter'. Fork callsites
(Cookie\Guard, EncrypterTest) converged to the Contracts exception. Dropped the
dead symfony/security-core require (only referenced by two unused imports).
Full suite 1644 green; ratchet at baseline.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… alias bridge (task 2.10) Canonical location moves to Contracts\Filesystem\FileNotFoundException (L13). Filesystem throws/catches the contract exception; the old Illuminate\Filesystem\FileNotFoundException becomes a class_alias bridge so existing catch sites keep matching until the illuminate/filesystem swap. Provider already binds 'files' via singleton() (done in task 3.5), so no provider change. Full suite 1644 green; ratchet at baseline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Stacked on #44 (base
migration/3.8-console-fire-handle). Bundles two small strict-mode-tighten tasks over disjoint files.2.9 — Encryption → L13 Contracts (
91282268)Encrypter implements Contracts\Encryption\{Encrypter, StringEncrypter}getAllKeys()/getPreviousKeys()— single-key fork (key rotation /previous_keysarrives with theilluminate/encryptionswap; ponytail comment)setKey()— strict-mode method-not-found (0 callers in fork/app)encrypt()failure throwsContracts\Encryption\EncryptExceptioninstead of\RuntimeException; constructor keeps\RuntimeExceptionfor unsupported cipher/key (matches v13)DecryptExceptioncanonical location moves toContracts\Encryption\DecryptException; oldIlluminate\Encryption\DecryptExceptionbecomes aclass_aliasbridge so existingcatchsites still match the thrown contract exceptionContracts\Encryption\StringEncrypter(copy of v13); container resolves both encryption contracts to'encrypter'Cookie\Guard,EncrypterTest)symfony/security-core— only referenced by two dead imports inEncrypter; also removes transitivesymfony/password-hasher(verified 0 usage insrc)2.10 — Filesystem
FileNotFoundException→ Contracts (46e9710b)Contracts\Filesystem\FileNotFoundException;Filesystemuses/throws itIlluminate\Filesystem\FileNotFoundExceptionbecomes aclass_aliasbridge (catch identity)'files'viasingleton()(done in task 3.5) → no provider changeBridge pattern (reusable)
class_alias— not a subclass — is required when relocating an exception class: a subclass can't catch the (parent) contract exception that gets thrown, so oldcatchsites would silently miss. App-side repoint is grep-driven (Psalm is blind toclass_alias), consistent with the cache/events/console guards.Validation
php -lclean; inline runtime check passes (alias identity, old-name catch matches thrown contract,Encrypter instanceofboth contracts,setKeygone)App-side conform (repoint imports + guard + integration validation) tracked separately.
🤖 Generated with Claude Code