3 ms·
These examples are not about strong typing, but about type juggling. Strong typing is this: declare(strict_types=1); use \Domain\SomeItem; use \Domain\S
by SergeAx 6y ago
These examples are not about strong typing, but about type juggling. Strong typing is this:
declare(strict_types=1);
use \Domain\SomeItem;
use \Domain\SomeItemId;
use \Domain\SomeItemSpec;
abstract class SomeItemRepo {
public function GetOneByID(SomeItemId $id): SomeItem;
/*
* Still hacky
*
* @param []SomeItemSpec $specs
*
* @return []SomeItem
*/
public function GetManyBySpecs(array $specs): array;
}
- kstrauser 6y agoThat's an example of strong typing specific to PHP, then, and not used in the rest of computer science. What you're describing there is usually known as static typing, which Python also supports.
- francislavoie 6y agoNo, types are checked at runtime in PHP. You can also use static types with docblocks and use static analysis tools, and both play complement eachother.