Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scalar types #21

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add scalar types #21

wants to merge 12 commits into from

Conversation

Derugon
Copy link
Contributor

@Derugon Derugon commented Feb 3, 2025

Object types have been previously added in #10 for consistency with core extensions, this PR adds types for all function arguments and returned values, as much as possible.

To simplify some function signatures, some functions are slightly changed to only accept string, instead of string|PPNode or string|null.

Also, use optional arguments to merge arrayTrimSliceUnescape with arrayTrimUnescape: both functions do the same thing but with different implementations.

so we do not have to check for `false` later on
…rayElementTrimUnescape`

These functions mostly do the same thing, but with different implementations.
Merge the `arrayTrimUnescape` and `arrayTrimSliceUnescape` functions together, and make `arrayElementTrimUnescape` use the previous one, so if we want to change how lists are evaluated, the algorithm is in a single place
so we do not have sometimes strings, and other times PPNodes, so we can type any pattern variable as a string.
Sometimes written as int, while it always is passed as a string

Also forgot to push pattern fixes in SimpleFunctions.php in previous commit
with MediaWiki 1.43
1.43 requires PHP 8.0, so I assume we can safely use union types now
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