<?php declare(strict_types=1); error_reporting(E_ALL); class ClassUsedForTyping { } class ClassWithSetMagic { public function __construct(array $dummy) { printf("Constructor for ClassWithSetMagic\n"); } public function __set($name, $value) { printf("Setting %s\n", $name); } public function __isset($name) { return false; } } class ClassInheritingFromClassWithSetMagic extends ClassWithSetMagic { public ClassUsedForTyping $property_with_type; public function __construct(array $dummy, ClassUsedForTyping $class_used_for_typing) { parent::__construct($dummy); printf("Constructor for ClassInheritingFromClassWithSetMagic\n"); $this->property_with_type = $class_used_for_typing; } } $inst = new ClassInheritingFromClassWithSetMagic( [], new ClassUsedForTyping() ); print_r($inst);
You have javascript disabled. You will not be able to edit any code.