Deriving entity property types from PHP7.4+ types

Hello app devs,

With Nextcloud 24 the PHP7.3 support ends. Now we can use typed properties. They are also handy for entities.

It looks like we can also use them for automatic derivation of type information, so that we do not have to use the $this->addType('counter', 'int'); boilerplate anymore.

Quick performance comparisons do not show any significant downside:
https://3v4l.org/tfOCo/perf vs https://3v4l.org/BZeMa/perf

Let me know what you think.

Cheers,
Christoph

2 Likes

Nice idea! PHP types to SQL types are not a 1:1 relationship, though, are they?

no, not necessarily