Skip to content

Declare native types and clean up code - #76

Merged
robertlemke merged 4 commits into
mainfrom
task/strict-types-and-code-style
Sep 11, 2026
Merged

robertlemke merged 4 commits into
mainfrom
task/strict-types-and-code-style

Conversation

@robertlemke

Copy link
Copy Markdown
Member

This brings the code in line with current PHP and Flow conventions, without changing what the package does.

Injected and other properties have native types instead of @var annotations. Flow injects typed properties directly instead of lazily, so dependencies are now created together with the object. Named injections such as the security logger are declared with lazy: false, because Flow would otherwise assign a dependency proxy that does not match the property type. The caches configured in Objects.yaml stay untyped for the same reason, since Flow offers no way to disable lazy injection there.

Besides that, classes are imported instead of being referenced with a leading backslash, constants are typed, docblocks that only repeated the signature are removed, and some unused code is gone. The remaining classes and the tests declare strict_types.

Also, the CI matrix no longer cancels all jobs after the first failure.

Properties of the authentication components, the client, the command
controller and the cookie middleware have native PHP types instead of
@var annotations. The middleware uses constructor property promotion.

Flow does not inject typed properties lazily, so these dependencies are
now injected when the object is created. Named injections, such as the
security logger, still default to lazy injection, which would assign a
dependency proxy to the typed property. They are therefore declared
with "lazy: false". The loggers are nullable, so that the classes also
work without a logger in unit tests.

The discovery and JWKS caches stay untyped. Flow injects properties
configured in Objects.yaml lazily and has no option to change that.
Classes are imported instead of being referenced with a leading
backslash, constants are typed and listed first, and docblocks which
only repeated the method signature are removed. TokenSet is marked as
not proxied, like other plain data objects.

Unused code is removed: the security context injected into the
authentication provider, the entity manager of the command controller
and the default value of the middleware option
"disableTrustedProxiesComponentCompatibility", which nothing reads.
Configurations which still set this option keep working. A duplicated
session check in the provider is merged into one.
The remaining classes and all unit tests declare strict_types, so that
scalar values passed to typed parameters are no longer converted
silently. IdentityToken is left unchanged for now, because it will be
reworked separately.
The test matrix no longer cancels the remaining jobs after the first
failure. This shows at a glance which combinations of PHP versions and
dependency sets are affected.
@robertlemke
robertlemke merged commit 7e8b15b into main Sep 11, 2026
6 checks passed
@robertlemke
robertlemke deleted the task/strict-types-and-code-style branch September 11, 2026 10:11
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.

1 participant