private function restrictByObjectType(PhpType $type = null, $outcome)
 {
     if ($outcome) {
         if (null === $type || $type->isUnknownType()) {
             return $this->typeRegistry->getNativeType('object');
         }
         return $type->getGreatestSubtype($this->typeRegistry->getNativeType('object'));
     }
     if (null === $type || $type->isAllType()) {
         return $this->typeRegistry->createAllTypeExcept(array('object'));
     }
     if ($type->isObjectType() || $type->isNoObjectType()) {
         return $this->typeRegistry->getNativeType('none');
     }
     if ($type->isUnionType()) {
         return $type->getRestrictedUnion($this->typeRegistry->getNativeType('object'));
     }
     return $type;
 }