Top "Type-hinting" questions

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

Type Hinting: Default Parameters

PHP 5 Type Hinting PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by specifying the …

php type-hinting default-parameters
PHP type-hinting to primitive values?

I'd like to know whether one can type-hint a method to expect primitive types? Something like this: public function someMethod(…

php primitive-types type-hinting
JetBrains WebIDE: PHP variable type hinting?

Is there a way to hint WebIDE that a variable has some type? I have to iterate an array of …

php phpstorm type-hinting web-ide
Difference between defining typing.Dict and dict?

I am practicing using type hints in Python 3.5. One of my colleague uses typing.Dict: import typing def change_bandwidths(…

python dictionary type-hinting
How to force arguments to be integer/string

I'd like my functions to expect strings/integers or throw a fit, like: warning: preg_match() expects parameter 2 to be …

php arguments type-hinting
Type hinting in Python 2

In PEP 484, type hinting was added to Python 3 with the inclusion of the typing module. Is there any way to …

python python-2.7 types type-hinting
Python void return type annotation

In python 3.x, it is common to use return type annotation of a function, such as: def foo() -> …

python annotations void type-hinting
Type hints in namedtuple

Consider following piece of code: from collections import namedtuple point = namedtuple("Point", ("x:int", "y:int")) The Code above is …

python python-3.x type-hinting namedtuple python-dataclasses
How can I tell PyCharm what type a parameter is expected to be?

When it comes to constructors, and assignments, and method calls, the PyCharm IDE is pretty good at analyzing my source …

python pycharm code-completion type-hinting
What does def main () -> None do?

I am working through Mastering Matplotlib and in chapter two they introduce the following code snippet: #! /usr/bin/env python3.4 …

python python-3.x type-hinting