Commit graph

3 commits

Author SHA1 Message Date
thiemowmde db9c989e10 Simplify normalization of "params" key
The isset() check was odd and confusing. I think I added it in
Ie572809 to be able to run the normalizer independend from the
validator. But the "params" element is required anyway. It makes
much more sense to enforce it in the normalizer as well. Even if
this currently doesn't make a difference in real-world scenarios,
it makes the code easier to read.

Change-Id: If4eb2f3985c56146d74e760996ad983be12b921a
2024-04-08 13:56:05 +00:00
thiemowmde 8f81812242 Enable and enforce a few extra PHPCS sniffs
This is not really anything new. Most code already followed these
sniffs. This patch just fixes the remaining exceptions. Also:
* Remove PHPDoc blocks that don't add anything but just repeat the
  strict types.
* Remove @file comments in favor of class-level comments.
* Add strict types where possible, most notably some `void`.

Change-Id: Iff6872dff68170b0fc4e82ac2ba3cad385e8773e
2023-09-06 18:15:22 +02:00
Thiemo Kreuz 7a32cba3ef Split validation and normalization into separate services
This makes it possible to use these steps independent from each
other. For example, a future patch can get rid of the re-validation
that's done over and over again when the API is called.

A significant change is that this gets rid of an expensive deep
clone. It was necessary before exactly because validation and
normalization was intertwined. Normalized properties would mess with
the later inheritance.

Strictly splitting validation and normalization (and executing them
in this order) solved this. The only downside of this is that
inherited properties are validated twice. But this is much less of a
problem, compared to the deep clone, I would like to argue.

This was always covered by tests. You can still see the tests fail
when you flip the execution order of inheritance and parameter
validation.

Bug: T301337
Change-Id: Ie5728094f9ed813f53b709d8b5283c4b99dc7d63
2023-03-06 13:05:51 +00:00