Skip to content

Commit 4e596aa

Browse files
authored
6.x: rename conflicting underscored methods (#18707)
* rename conflicting underscored methods * adjust method naming according to feedback
1 parent d235af5 commit 4e596aa

File tree

22 files changed

+76
-76
lines changed

22 files changed

+76
-76
lines changed

src/Console/ConsoleOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public function write(array|string $message, int $newlines = 1): int
221221
$message = implode(static::LF, $message);
222222
}
223223

224-
return $this->_write($this->styleText($message . str_repeat(static::LF, $newlines)));
224+
return $this->writeStream($this->styleText($message . str_repeat(static::LF, $newlines)));
225225
}
226226

227227
/**
@@ -291,7 +291,7 @@ protected function replaceTags(array $matches): string
291291
* @param string $message Message to write.
292292
* @return int The number of bytes returned from writing to output.
293293
*/
294-
protected function _write(string $message): int
294+
protected function writeStream(string $message): int
295295
{
296296
if (!isset($this->_output)) {
297297
return 0;

src/Form/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ public function execute(array $data, array $options = []): bool
258258
$options += ['validate' => true];
259259

260260
if ($options['validate'] === false) {
261-
return $this->_execute($data);
261+
return $this->process($data);
262262
}
263263

264264
$validator = $options['validate'] === true ? static::DEFAULT_VALIDATOR : $options['validate'];
265265

266-
return $this->validate($data, $validator) && $this->_execute($data);
266+
return $this->validate($data, $validator) && $this->process($data);
267267
}
268268

269269
/**
@@ -274,7 +274,7 @@ public function execute(array $data, array $options = []): bool
274274
* @param array $data Form data.
275275
* @return bool
276276
*/
277-
protected function _execute(array $data): bool
277+
protected function process(array $data): bool
278278
{
279279
return true;
280280
}

src/Http/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public function send(RequestInterface $request, array $options = []): Response
500500
$requestSent = false;
501501
if ($response === null) {
502502
$requestSent = true;
503-
$response = $this->_sendRequest($request, $event->getAdapterOptions());
503+
$response = $this->processRequest($request, $event->getAdapterOptions());
504504
}
505505

506506
/** @var \Cake\Http\Client\ClientEvent $event */
@@ -582,7 +582,7 @@ public static function addMockResponse(string $method, string $url, Response $re
582582
* @param array<string, mixed> $options Additional options to use.
583583
* @return \Cake\Http\Client\Response
584584
*/
585-
protected function _sendRequest(RequestInterface $request, array $options): Response
585+
protected function processRequest(RequestInterface $request, array $options): Response
586586
{
587587
$responses = [];
588588
if (static::$_mockAdapter) {

src/Http/Client/Adapter/Stream.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function send(RequestInterface $request, array $options): array
7979

8080
$this->buildContext($request, $options);
8181

82-
return $this->_send($request);
82+
return $this->processRequest($request);
8383
}
8484

8585
/**
@@ -238,7 +238,7 @@ protected function buildSslContext(RequestInterface $request, array $options): v
238238
* @return array Array of populated Response objects
239239
* @throws \Psr\Http\Client\NetworkExceptionInterface
240240
*/
241-
protected function _send(RequestInterface $request): array
241+
protected function processRequest(RequestInterface $request): array
242242
{
243243
$deadline = false;
244244
if (isset($this->_contextOptions['timeout']) && $this->_contextOptions['timeout'] > 0) {

src/Http/ServerRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ public function is(array|string $type, mixed ...$args): bool
511511
throw new InvalidArgumentException(sprintf('No detector set for type `%s`.', $type));
512512
}
513513
if ($args) {
514-
return $this->_is($type, $args);
514+
return $this->isType($type, $args);
515515
}
516516

517-
return $this->_detectorCache[$type] ??= $this->_is($type, $args);
517+
return $this->_detectorCache[$type] ??= $this->isType($type, $args);
518518
}
519519

520520
/**
@@ -534,7 +534,7 @@ public function clearDetectorCache(): void
534534
* @param array $args Array of custom detector arguments.
535535
* @return bool Whether the request is the type you are checking.
536536
*/
537-
protected function _is(string $type, array $args): bool
537+
protected function isType(string $type, array $args): bool
538538
{
539539
$detect = static::$_detectors[$type];
540540
if ($detect instanceof Closure) {

src/I18n/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function parseDate(string $date, string|int|null $format = null):
169169
$format = [$format, IntlDateFormatter::NONE];
170170
}
171171

172-
return static::_parseDateTime($date, $format);
172+
return static::processDateTime($date, $format);
173173
}
174174

175175
/**

src/I18n/DateFormatTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function formatObject(
130130
* @param \DateTimeZone|string|null $tz The timezone for the instance
131131
* @return static|null
132132
*/
133-
protected static function _parseDateTime(
133+
protected static function processDateTime(
134134
string $time,
135135
array|string $format,
136136
DateTimeZone|string|null $tz = null,

src/I18n/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public static function parseDateTime(
284284
$format ??= static::$_toStringFormat;
285285
$format = is_int($format) ? [$format, $format] : $format;
286286

287-
return static::_parseDateTime($time, $format, $tz);
287+
return static::processDateTime($time, $format, $tz);
288288
}
289289

290290
/**

src/I18n/Time.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static function parseTime(string $time, string|int|null $format = null):
143143
$format = [IntlDateFormatter::NONE, $format];
144144
}
145145

146-
return static::_parseDateTime($time, $format);
146+
return static::processDateTime($time, $format);
147147
}
148148

149149
/**

src/Mailer/Transport/SmtpTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function __wakeup(): void
122122
public function connect(): void
123123
{
124124
if (!$this->connected()) {
125-
$this->_connect();
125+
$this->connectSmtp();
126126
$this->auth();
127127
}
128128
}
@@ -151,7 +151,7 @@ public function disconnect(): void
151151
return;
152152
}
153153

154-
$this->_disconnect();
154+
$this->disconnectSmtp();
155155
}
156156

157157
/**
@@ -196,7 +196,7 @@ public function send(Message $message): array
196196
$this->checkRecipient($message);
197197

198198
if (!$this->connected()) {
199-
$this->_connect();
199+
$this->connectSmtp();
200200
$this->auth();
201201
} else {
202202
$this->smtpSend('RSET');
@@ -206,7 +206,7 @@ public function send(Message $message): array
206206
$this->sendData($message);
207207

208208
if (!$this->_config['keepAlive']) {
209-
$this->_disconnect();
209+
$this->disconnectSmtp();
210210
}
211211

212212
/** @var array{headers: string, message: string} */
@@ -286,7 +286,7 @@ protected function parseAuthType(): void
286286
* @return void
287287
* @throws \Cake\Network\Exception\SocketException
288288
*/
289-
protected function _connect(): void
289+
protected function connectSmtp(): void
290290
{
291291
$this->generateSocket();
292292
if (!$this->_socket->connect()) {
@@ -565,7 +565,7 @@ protected function sendData(Message $message): void
565565
* @return void
566566
* @throws \Cake\Network\Exception\SocketException
567567
*/
568-
protected function _disconnect(): void
568+
protected function disconnectSmtp(): void
569569
{
570570
$this->smtpSend('QUIT', false);
571571
$this->_socket->disconnect();

0 commit comments

Comments
 (0)