Top "Type-hinting" questions

Type hinting binds function arguments to specific objects or strongly types them.

What are type hints in Python 3.5?

One of the most talked about features in Python 3.5 is type hints. An example of type hints is mentioned in …

python python-3.x python-3.5 type-hinting
How to resolve "must be an instance of string, string given" prior to PHP 7?

Here is my code: function phpwtf(string $s) { echo "$s\n"; } phpwtf("Type hinting is da bomb"); Which results in …

php types type-hinting
Adding default parameter value with type hint in Python

If I have a function like this: def foo(name, opts={}): pass And I want to add type hints to …

python python-3.x type-hinting
Nullable return types in PHP7

PHP 7 introduces return type declarations. Which means I can now indicate the return value is a certain class, interface, array, …

php nullable return-type type-hinting php-7
How to specify multiple return types using type-hints

I have a function in python that can either return a bool or a list. Is there a way to …

python python-3.x return-type type-hinting python-3.5
Cannot pass null argument when using type hinting

The following code: <?php class Type { } function foo(Type $t) { } foo(null); ?> failed at run time: PHP Fatal …

php type-hinting
Type hinting in PHP 7 - array of objects

Maybe I missed something but is there any option to define that function should have argument or return for example …

php arrays oop type-hinting php-7
Type hinting a collection of a specified type

Using Python 3's function annotations, it is possible to specify the type of items contained within a homogeneous list (or …

python python-3.x type-hinting
Type annotations for *args and **kwargs

I'm trying out Python's type annotations with abstract base classes to write some interfaces. Is there a way to annotate …

python type-hinting typechecking typing
How to code autocompletion in python?

I'd like to code autocompletion in Linux terminal. The code should work as follows. It has a list of strings (…

python autocomplete type-hinting