Skip to content

IBX-12192: Added SiteAccess::MATCHING_TYPE_UNINITIALIZED constant - #796

Merged
Steveb-p merged 3 commits into
4.6from
IBX-12192-add-matching-type-uninitialized-constant
Aug 4, 2026
Merged

IBX-12192: Added SiteAccess::MATCHING_TYPE_UNINITIALIZED constant#796
Steveb-p merged 3 commits into
4.6from
IBX-12192-add-matching-type-uninitialized-constant

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-12192

Related PRs:

Description:

SiteAccess::$matchingType uses the magic string 'uninitialized' in a couple of places (ConfigResolver's scope-change checks, and the service wiring for the placeholder SiteAccess instance) as the sentinel for "this SiteAccess was never actually matched from a request." Added SiteAccess::MATCHING_TYPE_UNINITIALIZED so that check has a name instead of a repeated literal, and so other packages can compare against it without hardcoding the string.

Also fixed SiteAccessService::$siteAccess — it got typed as non-nullable SiteAccess in the same pass, but setSiteAccess() still accepts and assigns null, so that threw a TypeError (caught by SiteAccessServiceTest::testGetCurrentSiteAccess). Made it ?SiteAccess again.

This unblocks the ibexa/messenger fix above, which needs to detect an uninitialized SiteAccess to avoid stamping console-dispatched messages with a bogus SiteAccess name.

Replaces the 'uninitialized' magic string used for the placeholder
SiteAccess wired into the container before request matching happens,
so consumers (e.g. ibexa/messenger) can detect it without duplicating
the literal.
setSiteAccess() accepts and assigns null, but the property was typed
as non-nullable SiteAccess, causing a TypeError.
…sRelation() against null SiteAccess

Making SiteAccessService::$siteAccess properly nullable exposed a real
gap: getSiteAccessesRelation() fell back to $this->siteAccess without
checking it could be null, and would then call ->name on it.
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Steveb-p added a commit to ibexa/messenger that referenced this pull request Aug 4, 2026
Points CI at the ibexa/core branch that adds SiteAccess::MATCHING_TYPE_UNINITIALIZED,
so this PR's tests can run before that PR merges. Must be removed before merging.

@konradoboza konradoboza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we have some test coverage for this?

@Steveb-p

Steveb-p commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Can we have some test coverage for this?

If the calling code didn't have tests, it would mean introducing a whole out-of-scope test.
If it did, then it already tests it somewhat.

In general, since I'd prefer to move away from having an "uninitialized" SiteAccess service, I don't find it worthwile. I have a different plan for this.

In simple terms, I want to make all services reliant on SiteAccess service to ask SiteAccessService::getCurrent() instead. And simplify a few things related to SiteAccess changing (currently you need to know that you have to operate using two events).

@Steveb-p
Steveb-p merged commit adba092 into 4.6 Aug 4, 2026
33 of 35 checks passed
@Steveb-p
Steveb-p deleted the IBX-12192-add-matching-type-uninitialized-constant branch August 4, 2026 13:13
Steveb-p added a commit to ibexa/messenger that referenced this pull request Aug 4, 2026
ibexa/core#796 merged, so ibexa/core's ~4.6.x-dev now resolves the
SiteAccess::MATCHING_TYPE_UNINITIALIZED constant on its own.
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.

5 participants