Is it possible to define a function argument as multiple possible types? For example, a function may take a string or an integer to accomplish something. Is it possible to somehow define it like this?
function something(int|string $token) {}
Or is only one type per argument supported?
(mind you, I know I can filter input later on, I just like to have my arguments typed)
The best you can do is called Type Hinting and is explained here:
http://php.net/manual/en/language.oop5.typehinting.php
In particular, you can hint a class type or an array type, but (as the manual says) “Traditional type hinting with int and string isn’t supported.” So I guess that what you are trying to accomplish is not possible at this level.
However, you can create your own wrappers, etc. There are probably a thousand ways to handle this.