Skip to content

Commit 39535d4

Browse files
authored
style: use Cdn77 coding standard (#227)
1 parent 98ba540 commit 39535d4

File tree

12 files changed

+246
-234
lines changed

12 files changed

+246
-234
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"thecodingmachine/safe": "^2.2 || ^3"
2626
},
2727
"require-dev": {
28-
"doctrine/coding-standard": "^13.0",
28+
"cdn77/coding-standard": "^7.4",
2929
"infection/infection": "^0.30.0",
3030
"phpstan/extension-installer": "^1.1",
3131
"phpstan/phpstan": "2.1.19",

phpcs.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<arg name="cache" value=".phpcs-cache" />
77
<arg name="colors" />
88

9-
<config name="php_version" value="80100" />
9+
<config name="php_version" value="80300" />
1010

1111
<!-- Ignore warnings, show progress of the run and show sniff names -->
1212
<arg value="nps" />
1313

1414
<file>src</file>
1515
<file>tests</file>
1616

17-
<rule ref="Doctrine" />
17+
<rule ref="Cdn77" />
1818
</ruleset>

src/Clients/CommonClientConfigs.php

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use SimPod\Kafka\Common\Config;
88

9+
//phpcs:disable Cdn77.NamingConventions.ValidConstantName.ClassConstantNotUpperCase
10+
//phpcs:disable SlevomatCodingStandard.Files.LineLength.LineTooLong
11+
912
/**
1013
* Some configurations shared by both producer and consumer
1114
*/
@@ -15,55 +18,55 @@ final class CommonClientConfigs extends Config
1518
* NOTE: DO NOT CHANGE EITHER CONFIG NAMES AS THESE ARE PART OF THE PUBLIC API AND CHANGE WILL BREAK USER CODE.
1619
*/
1720

18-
public const BOOTSTRAP_SERVERS_CONFIG = 'bootstrap.servers';
19-
public const BOOTSTRAP_SERVERS_DOC = 'A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping&mdash;this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form '
21+
public const string BOOTSTRAP_SERVERS_CONFIG = 'bootstrap.servers';
22+
public const string BOOTSTRAP_SERVERS_DOC = 'A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping&mdash;this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form '
2023
. '<code>host1:port1,host2:port2,...</code>. Since these servers are just used for the initial connection to '
2124
. 'discover the full cluster membership (which may change dynamically), this list need not contain the full set of '
2225
. 'servers (you may want more than one, though, in case a server is down).';
23-
public const CLIENT_DNS_LOOKUP_CONFIG = 'client.dns.lookup';
24-
public const CLIENT_DNS_LOOKUP_DOC = '<p>Controls how the client uses DNS lookups.</p><p>If set to <code>use_all_dns_ips</code> then, when the lookup returns multiple IP addresses for a hostname,'
26+
public const string CLIENT_DNS_LOOKUP_CONFIG = 'client.dns.lookup';
27+
public const string CLIENT_DNS_LOOKUP_DOC = '<p>Controls how the client uses DNS lookups.</p><p>If set to <code>use_all_dns_ips</code> then, when the lookup returns multiple IP addresses for a hostname,'
2528
. ' they will all be attempted to connect to before failing the connection. Applies to both bootstrap and advertised servers.</p>'
2629
. '<p>If the value is <code>resolve_canonical_bootstrap_servers_only</code> each entry will be resolved and expanded into a list of canonical names.</p>';
27-
public const CLIENT_ID_CONFIG = 'client.id';
28-
public const CLIENT_ID_DOC = 'An id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.';
29-
public const CONNECTIONS_MAX_IDLE_MS_CONFIG = 'connections.max.idle.ms';
30-
public const CONNECTIONS_MAX_IDLE_MS_DOC = 'Close idle connections after the number of milliseconds specified by this config.';
31-
public const DEFAULT_SECURITY_PROTOCOL = 'PLAINTEXT';
32-
public const METADATA_MAX_AGE_CONFIG = 'metadata.max.age.ms';
33-
public const METADATA_MAX_AGE_DOC = "The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.";
34-
public const METRIC_REPORTER_CLASSES_CONFIG = 'metric.reporters';
35-
public const METRIC_REPORTER_CLASSES_DOC = 'A list of classes to use as metrics reporters. Implementing the <code>org.apache.kafka.common.metrics.MetricsReporter</code> interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics.';
36-
public const METRICS_NUM_SAMPLES_CONFIG = 'metrics.num.samples';
37-
public const METRICS_NUM_SAMPLES_DOC = 'The number of samples maintained to compute metrics.';
38-
public const METRICS_RECORDING_LEVEL_CONFIG = 'metrics.recording.level';
39-
public const METRICS_RECORDING_LEVEL_DOC = 'The highest recording level for metrics.';
40-
public const METRICS_SAMPLE_WINDOW_MS_CONFIG = 'metrics.sample.window.ms';
41-
public const METRICS_SAMPLE_WINDOW_MS_DOC = 'The window of time a metrics sample is computed over.';
42-
public const RECEIVE_BUFFER_CONFIG = 'receive.buffer.bytes';
43-
public const RECEIVE_BUFFER_DOC = 'The size of the TCP receive buffer (SO_RCVBUF) to use when reading data. If the value is -1, the OS default will be used.';
44-
public const RECEIVE_BUFFER_LOWER_BOUND = -1;
45-
public const RECONNECT_BACKOFF_MAX_MS_CONFIG = 'reconnect.backoff.max.ms';
46-
public const RECONNECT_BACKOFF_MAX_MS_DOC = 'The maximum amount of time in milliseconds to wait when reconnecting to a broker that has repeatedly failed to connect. If provided, the backoff per host will increase exponentially for each consecutive connection failure, up to this maximum. After calculating the backoff increase, 20% random jitter is added to avoid connection storms.';
47-
public const RECONNECT_BACKOFF_MS_CONFIG = 'reconnect.backoff.ms';
48-
public const RECONNECT_BACKOFF_MS_DOC = 'The base amount of time to wait before attempting to reconnect to a given host. This avoids repeatedly connecting to a host in a tight loop. This backoff applies to all connection attempts by the client to a broker.';
49-
public const REQUEST_TIMEOUT_MS_CONFIG = 'request.timeout.ms';
50-
public const REQUEST_TIMEOUT_MS_DOC = 'The configuration controls the maximum amount of time the client will wait '
30+
public const string CLIENT_ID_CONFIG = 'client.id';
31+
public const string CLIENT_ID_DOC = 'An id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.';
32+
public const string CONNECTIONS_MAX_IDLE_MS_CONFIG = 'connections.max.idle.ms';
33+
public const string CONNECTIONS_MAX_IDLE_MS_DOC = 'Close idle connections after the number of milliseconds specified by this config.';
34+
public const string DEFAULT_SECURITY_PROTOCOL = 'PLAINTEXT';
35+
public const string METADATA_MAX_AGE_CONFIG = 'metadata.max.age.ms';
36+
public const string METADATA_MAX_AGE_DOC = "The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.";
37+
public const string METRIC_REPORTER_CLASSES_CONFIG = 'metric.reporters';
38+
public const string METRIC_REPORTER_CLASSES_DOC = 'A list of classes to use as metrics reporters. Implementing the <code>org.apache.kafka.common.metrics.MetricsReporter</code> interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics.';
39+
public const string METRICS_NUM_SAMPLES_CONFIG = 'metrics.num.samples';
40+
public const string METRICS_NUM_SAMPLES_DOC = 'The number of samples maintained to compute metrics.';
41+
public const string METRICS_RECORDING_LEVEL_CONFIG = 'metrics.recording.level';
42+
public const string METRICS_RECORDING_LEVEL_DOC = 'The highest recording level for metrics.';
43+
public const string METRICS_SAMPLE_WINDOW_MS_CONFIG = 'metrics.sample.window.ms';
44+
public const string METRICS_SAMPLE_WINDOW_MS_DOC = 'The window of time a metrics sample is computed over.';
45+
public const string RECEIVE_BUFFER_CONFIG = 'receive.buffer.bytes';
46+
public const string RECEIVE_BUFFER_DOC = 'The size of the TCP receive buffer (SO_RCVBUF) to use when reading data. If the value is -1, the OS default will be used.';
47+
public const int RECEIVE_BUFFER_LOWER_BOUND = -1;
48+
public const string RECONNECT_BACKOFF_MAX_MS_CONFIG = 'reconnect.backoff.max.ms';
49+
public const string RECONNECT_BACKOFF_MAX_MS_DOC = 'The maximum amount of time in milliseconds to wait when reconnecting to a broker that has repeatedly failed to connect. If provided, the backoff per host will increase exponentially for each consecutive connection failure, up to this maximum. After calculating the backoff increase, 20% random jitter is added to avoid connection storms.';
50+
public const string RECONNECT_BACKOFF_MS_CONFIG = 'reconnect.backoff.ms';
51+
public const string RECONNECT_BACKOFF_MS_DOC = 'The base amount of time to wait before attempting to reconnect to a given host. This avoids repeatedly connecting to a host in a tight loop. This backoff applies to all connection attempts by the client to a broker.';
52+
public const string REQUEST_TIMEOUT_MS_CONFIG = 'request.timeout.ms';
53+
public const string REQUEST_TIMEOUT_MS_DOC = 'The configuration controls the maximum amount of time the client will wait '
5154
. 'for the response of a request. If the response is not received before the timeout '
5255
. 'elapses the client will resend the request if necessary or fail the request if '
5356
. 'retries are exhausted.';
54-
public const RETRIES_CONFIG = 'retries';
55-
public const RETRIES_DOC = 'Setting a value greater than zero will cause the client to resend any request that fails with a potentially transient error.';
56-
public const RETRY_BACKOFF_MS_CONFIG = 'retry.backoff.ms';
57-
public const RETRY_BACKOFF_MS_DOC = 'The amount of time to wait before attempting to retry a failed request to a given topic partition. This avoids repeatedly sending requests in a tight loop under some failure scenarios.';
58-
public const SASL_USERNAME = 'sasl.username';
59-
public const SASL_USERNAME_DOC = 'SASL username for use with the PLAIN mechanism.';
60-
public const SASL_MECHANISM = 'sasl.mechanisms';
61-
public const SASL_MECHANISM_DOC = 'SASL mechanism to use for authentication. Supported: GSSAPI, PLAIN.';
62-
public const SASL_PASSWORD = 'sasl.password';
63-
public const SASL_PASSWORD_DOC = 'SASL password for use with the PLAIN mechanism.';
64-
public const SECURITY_PROTOCOL_CONFIG = 'security.protocol';
65-
public const SECURITY_PROTOCOL_DOC = 'Protocol used to communicate with brokers. Valid values are: '; // TODO
66-
public const SEND_BUFFER_CONFIG = 'send.buffer.bytes';
67-
public const SEND_BUFFER_DOC = 'The size of the TCP send buffer (SO_SNDBUF) to use when sending data. If the value is -1, the OS default will be used.';
68-
public const SEND_BUFFER_LOWER_BOUND = -1;
57+
public const string RETRIES_CONFIG = 'retries';
58+
public const string RETRIES_DOC = 'Setting a value greater than zero will cause the client to resend any request that fails with a potentially transient error.';
59+
public const string RETRY_BACKOFF_MS_CONFIG = 'retry.backoff.ms';
60+
public const string RETRY_BACKOFF_MS_DOC = 'The amount of time to wait before attempting to retry a failed request to a given topic partition. This avoids repeatedly sending requests in a tight loop under some failure scenarios.';
61+
public const string SASL_USERNAME = 'sasl.username';
62+
public const string SASL_USERNAME_DOC = 'SASL username for use with the PLAIN mechanism.';
63+
public const string SASL_MECHANISM = 'sasl.mechanisms';
64+
public const string SASL_MECHANISM_DOC = 'SASL mechanism to use for authentication. Supported: GSSAPI, PLAIN.';
65+
public const string SASL_PASSWORD = 'sasl.password';
66+
public const string SASL_PASSWORD_DOC = 'SASL password for use with the PLAIN mechanism.';
67+
public const string SECURITY_PROTOCOL_CONFIG = 'security.protocol';
68+
public const string SECURITY_PROTOCOL_DOC = 'Protocol used to communicate with brokers. Valid values are: '; // TODO
69+
public const string SEND_BUFFER_CONFIG = 'send.buffer.bytes';
70+
public const string SEND_BUFFER_DOC = 'The size of the TCP send buffer (SO_SNDBUF) to use when sending data. If the value is -1, the OS default will be used.';
71+
public const int SEND_BUFFER_LOWER_BOUND = -1;
6972
}

0 commit comments

Comments
 (0)