Skip to content

[InfluxDB][Monitoring] Deprecate passing Client instance instead of config array/string #811

@Steveb-p

Description

@Steveb-p

I'd suggest deprecating it, because it basically prevents setting any other options, like database name, measurementSentMessages, measurementConsumedMessages and measurementConsumers (others being basically configuration options for the client itself).

In my opinion it would be best to be as strict as possible when creating function definitions, in this case a constructor. If there is a secondary constructor needed, it can always take the form of a static function, like so:

public static function createFromClient(Client $client, array $config): self
{
    $self = new static($config);
    $self->client = $client;
    return $self;
}

or similar. This would allow us to skip most of type checks, as PHP will do a function argument check on it's own and function declaration would explicitly say what value types are acceptable.

I'll drop the deprecation for now anyway.

Originally posted by @Steveb-p in #809

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions