PHP has (almost) complete strong typing system and all the bells and whistles of OOP needed to implement said systems using proper patterns and methodologies and make it modular and testable enough to be robust and supportable for a long time.
Python has literally all of those things, and has been strongly (but dynamically) type from the very beginning. PHP is still weakly typed today. This code doesn't raise a warning or anything:
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;
}
That'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.
No, 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.