protected function setProperty($object, $name)
    {
        $this->loadPropertyTypes();
        if (empty($this->restrictedProperties) && $this->frozen) {
            $this->restrictedProperties = $this->getRestrictedProperties(get_class());
        }
        if ($name) {
            $this->assignProperty($name, $object);
        } else {
            $objectClass = get_class($object);
            $match = null;
            foreach ($this->propertyTypes as $name => $type) {
                if ($object instanceof $type) {
                    if ($match) {
                        throw new \FW\DI\Exception("You must specify a name for the property of type $objectClass,
                        since at least two parameters ($match and $name) share the same class");
                    }
                    $match = $name;
                }
            }
            if (!$match) {
                // We gave an unused class in the DI, it doesn't serve any purpose but it won't break the build
                trigger_error("Object of class $objectClass given to " . get_class() . " but it seems unused.", E_USER_WARNING);
            } else {
                $this->assignProperty($match, $object);
            }
        }
        return $this;
    }