fix(tests): the ObjectEntity stub declared return types wider than the contract - #528
Merged
rubenvdlinde merged 2 commits intoAug 16, 2026
Merged
Conversation
…e contract Every PHPUnit cell and all four PHP quality tools were failing on development with one fatal, thrown at class load before any test ran: PHP Fatal error: Declaration of OCA\OpenRegister\Db\ObjectEntity::getUuid() must be compatible with OCA\OpenRegister\Contract\ObjectEntityInterface::getUuid(): ?string The stub implements ObjectEntityInterface but declared getUuid, getObject, getRegister and getSchema with no return type at all. A return type may be narrowed by an implementor, never widened, and an omitted type is the widest there is — so `abstract public function getUuid();` against the contract's `?string` is not loose, it is invalid. The four abstracts now carry the contract's own types, and the anonymous subclass in MergeOrganisatieServiceTest follows them; it was the only subclass in the repo. 13 of 37 jobs were red on this one declaration.
Contributor
Quality Report — ConductionNL/softwarecatalog @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ❌ | ||||
| psalm | ❌ | ||||
| phpstan | ❌ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| check-vue-demi | ✅ | ||||
| test-l10n | ✅ | ||||
| format | ✅ | ||||
| composer | ✅ | ✅ 130/130 | |||
| npm | ✅ | ✅ 704/704 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| PHPUnit | ❌ | ||||
| Newman | ⏭️ | ||||
| Playwright | ❌ | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-08-16 10:30 UTC
Download the full PDF report from the workflow artifacts.
With the stub fatal gone PHPUnit actually runs (698 tests, 2644 assertions), which exposed 53 errors that could not previously be reached. Four causes: 38 — five test helpers declared `: ObjectService` (the concrete class) while returning `createMock(ObjectServiceInterface::class)`. The helpers now declare what they return. 8 — OrganisationMembersControllerTest passed $this->container in the logger slot and omitted $organisationService entirely; the mock it needed was already built two lines up, it was just being reached through the container. 2 — OrganizationSyncService guarded two batch loops with `$this->objectService instanceof ObjectService === false`, testing the CONCRETE class against a property typed as the interface. The property is promoted, readonly and non-nullable, so it can never be unresolved: in production the guard was dead, and against any other implementation it logged "could not resolve ObjectService" and returned early — silently skipping the whole organisation batch and every contact rather than syncing them. 1 — ViewService::getObjectService() declares `?ObjectServiceInterface` but resolved `ObjectService::class` out of the container. It now asks for the contract, which is what the return type promises.
Contributor
Quality Report — ConductionNL/softwarecatalog @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ❌ | ||||
| psalm | ❌ | ||||
| phpstan | ❌ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| check-vue-demi | ✅ | ||||
| test-l10n | ✅ | ||||
| format | ✅ | ||||
| composer | ✅ | ✅ 130/130 | |||
| npm | ✅ | ✅ 704/704 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| PHPUnit | ❌ | ||||
| Newman | ⏭️ | ||||
| Playwright | ❌ | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-08-16 11:06 UTC
Download the full PDF report from the workflow artifacts.
rubenvdlinde
pushed a commit
that referenced
this pull request
Aug 16, 2026
`development` gained #528 (`fix/stub-return-types-match-the-contract`) while this branch was open. It fixes `tests/Stubs/Db/ObjectEntity.php` with the same four return types and the same reasoning as this branch's `b711474c`, and it goes further: it also repairs the test helpers and the two services whose failures that class-load fatal was hiding. Conflict in `tests/Stubs/Db/ObjectEntity.php` resolved by taking `development`'s version wholesale. The two are equivalent in effect — `getUuid(): ?string`, `getObject(): array`, `getRegister(): ?string`, `getSchema(): ?string`, with `getId()` and `setObject()` left untyped because neither is on the contract — and #528's comment sits better. `tests/Unit/Service/MergeOrganisatieServiceTest.php` auto-merged to `development`'s content for the same reason. Both files are now byte-identical to `origin/development`. What remains on this branch is only the composition root itself, which #528 did NOT touch: `Application.php:730` still passes 11 arguments to a 13-parameter constructor, so `/api/me` still returns 500 for every user.
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.
13 of 37 jobs on
developmentwere red on one fatal thrown at class load, before any test ran:The stub implements
ObjectEntityInterfacebut declaredgetUuid,getObject,getRegisterandgetSchemawith no return type at all. A return type may be narrowed by an implementor, never widened — and an omitted type is the widest there is, so an untypedgetUuid()against the contract's?stringis invalid, not merely loose.The four abstracts now carry the contract's own types, and the anonymous subclass in
MergeOrganisatieServiceTestfollows them. It is the only subclass of this stub in the repo.Because the fatal happens at class load, it took down all six PHPUnit cells and all four PHP quality tools together.