FriendsOfREDAXO / rexstan

redaxo phpstan addon
https://staabm.github.io/archive.html#rexstan
MIT License
35 stars 3 forks source link

Support rex superglobals array types #556

Open staabm opened 1 year ago

staabm commented 1 year ago

$form = rex_post('form', 'array[string]', []); should be detected as array<string> etc.

gharlan commented 1 year ago

array[string] scheint mir unterstützt zu werden: https://github.com/FriendsOfREDAXO/rexstan/blob/e4d1213b6fc04e845cce3d9708c1407e7880eff5/lib/extension/RexFunctionsDynamicReturnTypeExtension.php#L142-L153

Was mir aber zu fehlen scheint (nicht getestet), sind Array-Shapes, die in rex so notiert werden:

$form = rex_post('form', [
    ['foo', 'int', 1],
    ['kitchen', 'array[string]'],
]);

Für das psalm-Plugin habe ich es hier umgesetzt (keine Ahnung ob hilfreich): https://github.com/redaxo/psalm-plugin/blob/main/src/Provider/RexTypeReturnProvider.php#L138

gharlan commented 6 months ago

In 5.17 kam noch eine weitere Array-Variante hinzu: https://github.com/redaxo/redaxo/pull/6031