Top "Type-hinting" questions

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

PhpStorm type-hinting for factories?

I have code more or less like this: class Foo { public static function factory($str) { $class = "Foo_" . $str; return new $…

factory phpstorm type-hinting
Does Python type hint (annotations) cause some run-time effects?

Can Python function annotations and type hints (PEP 3107 and PEP 484) cause some run-time effects? Could it made the code faster? …

python annotations type-hinting
Python >=3.5: Checking type annotation at runtime

Does the typing module (or any other module) exhibit an API to typecheck a variable at runtime, similar to isinstance() …

python python-3.x type-hinting mypy
Returning NULL with return type declarations

I was refactoring a codebase for use with PHP7, particularly implementing scalar type hints and return type hints, when I …

php php-7 type-hinting php-7.1
How do I correctly add type-hints to Mixin classes?

Consider the following example. The example is contrived but illustrates the point in a runnable example: class MultiplicatorMixin: def multiply(…

python oop type-hinting mypy python-typing
What are the differences between Set, FrozenSet, MutableSet and AbstractSet in python typing module?

I am trying to annotate my code with types but I am a little confused when it comes to sets. …

python python-3.x type-hinting frozenset
The correct way to annotate a "file type" in Python

In modern versions of Ppython one can have static type analysis using function annotations, according to PEP 484. This is made …

python python-3.5 type-hinting
What does the keyword "callable" do in PHP

To be more exact, the "callable" used in function declaration arguments. like the one below. function post($pattern, callable $handler) { $…

php type-hinting callable function-declaration type-declaration
Using the class as a type hint for arguments in its methods

The code I have included below throws the following error: NameError: name 'Vector2' is not defined at this line: …

python python-3.x oop type-hinting