Skip to content

Commit d49f244

Browse files
committed
wip
1 parent 1b93904 commit d49f244

11 files changed

Lines changed: 35 additions & 36 deletions

File tree

app/Config/WorkerMode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class WorkerMode
5050
* - 'disconnect':
5151
* Closes all connections after each request
5252
*
53-
* @var 'keep-alive'|'disconnect'
53+
* @var 'disconnect'|'keep-alive'
5454
*/
5555
public string $databaseStrategy = 'keep-alive';
5656

@@ -64,7 +64,7 @@ class WorkerMode
6464
* - 'disconnect':
6565
* Closes the handler after each request
6666
*
67-
* @var 'keep-alive'|'disconnect'
67+
* @var 'disconnect'|'keep-alive'
6868
*/
6969
public string $cacheStrategy = 'keep-alive';
7070

system/CodeIgniter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ public function initialize()
195195
/**
196196
* Reset request-specific state for worker mode.
197197
* Clears all request/response data to prepare for the next request.
198-
*
199-
* @return void
200198
*/
201199
public function resetForWorkerMode(): void
202200
{

system/Commands/Worker/WorkerInstall.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <[email protected]>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
312
namespace CodeIgniter\Commands\Worker;
413

514
use CodeIgniter\CLI\BaseCommand;
@@ -16,9 +25,8 @@ class WorkerInstall extends BaseCommand
1625
protected $group = 'Worker Mode';
1726
protected $name = 'worker:install';
1827
protected $description = 'Install FrankenPHP worker mode by creating necessary configuration files';
19-
20-
protected $usage = 'worker:install [options]';
21-
protected $options = [
28+
protected $usage = 'worker:install [options]';
29+
protected $options = [
2230
'--force' => 'Overwrite existing files',
2331
];
2432

@@ -61,7 +69,7 @@ public function run(array $params)
6169
CLI::error(
6270
"Failed to read template: {$template}",
6371
'light_gray',
64-
'red'
72+
'red',
6573
);
6674
CLI::newLine();
6775

@@ -73,7 +81,7 @@ public function run(array $params)
7381
CLI::error(
7482
'Failed to create file: ' . clean_path($target),
7583
'light_gray',
76-
'red'
84+
'red',
7785
);
7886
CLI::newLine();
7987

system/Commands/Worker/WorkerUninstall.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <[email protected]>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
312
namespace CodeIgniter\Commands\Worker;
413

514
use CodeIgniter\CLI\BaseCommand;
@@ -15,9 +24,8 @@ class WorkerUninstall extends BaseCommand
1524
protected $group = 'Worker Mode';
1625
protected $name = 'worker:uninstall';
1726
protected $description = 'Remove FrankenPHP worker mode configuration files';
18-
19-
protected $usage = 'worker:uninstall [options]';
20-
protected $options = [
27+
protected $usage = 'worker:uninstall [options]';
28+
protected $options = [
2129
'--force' => 'Skip confirmation prompt',
2230
];
2331

@@ -40,6 +48,7 @@ public function run(array $params)
4048

4149
// Find existing files
4250
$existing = [];
51+
4352
foreach ($this->files as $file) {
4453
$path = ROOTPATH . $file;
4554
if (is_file($path)) {
@@ -57,6 +66,7 @@ public function run(array $params)
5766

5867
// Show files that will be removed
5968
CLI::write('The following files will be removed:', 'yellow');
69+
6070
foreach ($existing as $file) {
6171
CLI::write(' - ' . $file, 'white');
6272
}
@@ -83,6 +93,7 @@ public function run(array $params)
8393

8494
if (! @unlink($path)) {
8595
CLI::error('Failed to remove file: ' . clean_path($path), 'light_gray', 'red');
96+
8697
continue;
8798
}
8899

system/Config/BaseService.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@ public static function reset(bool $initAutoloader = true)
377377
/**
378378
* Resets all services except those in the persistent list.
379379
* Used for worker mode to preserve expensive-to-initialize services.
380-
*
381-
* @param WorkerMode $config
382-
* @return void
383380
*/
384381
public static function resetForWorkerMode(WorkerMode $config): void
385382
{

system/Database/BaseConnection.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ abstract protected function _close();
495495

496496
/**
497497
* Check if the connection is still alive.
498-
*
499-
* @return bool
500498
*/
501499
public function ping(): bool
502500
{
@@ -509,16 +507,13 @@ public function ping(): bool
509507

510508
/**
511509
* Driver-specific ping implementation.
512-
*
513-
* @return bool
514510
*/
515511
protected function _ping(): bool
516512
{
517513
try {
518514
$result = $this->simpleQuery('SELECT 1');
519515

520516
return $result !== false;
521-
522517
} catch (DatabaseException) {
523518
return false;
524519
}

system/Database/Config.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ protected static function ensureFactory()
160160
*
161161
* This method handles connection state management between requests
162162
* in long-running worker processes.
163-
*
164-
* @param WorkerMode $config
165-
* @return void
166163
*/
167164
public static function resetForWorkerMode(WorkerMode $config): void
168165
{
@@ -202,5 +199,4 @@ public static function resetForWorkerMode(WorkerMode $config): void
202199
static::$factory = null;
203200
}
204201
}
205-
206202
}

system/Database/Postgre/Connection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,12 @@ protected function _close()
168168

169169
/**
170170
* Ping the database connection.
171-
*
172-
* @return bool
173171
*/
174172
protected function _ping(): bool
175173
{
176174
return pg_ping($this->connID);
177175
}
178176

179-
180177
/**
181178
* Select a specific database table to use.
182179
*/

system/Events/Events.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,9 @@ public static function getPerformanceLogs()
293293
*
294294
* Note: This clears dynamically registered listeners. If your application
295295
* registers listeners at runtime, they will need to be re-registered for each request.
296-
*
297-
* @return void
298296
*/
299297
public static function resetForWorkerMode(): void
300298
{
301299
static::$performanceLog = [];
302300
}
303-
304301
}

tests/system/Config/ServicesTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ public function testHasReturnsFalseForNonExistentService(): void
520520
#[RunInSeparateProcess]
521521
public function testResetForWorkerModeWithKeepAliveStrategy(): void
522522
{
523-
$config = new WorkerMode();
524-
$config->cacheStrategy = 'keep-alive';
523+
$config = new WorkerMode();
524+
$config->cacheStrategy = 'keep-alive';
525525
$config->persistentServices = ['timer'];
526526

527527
Services::cache();
@@ -543,8 +543,8 @@ public function testResetForWorkerModeWithKeepAliveStrategy(): void
543543
#[RunInSeparateProcess]
544544
public function testResetForWorkerModeWithReconnectStrategy(): void
545545
{
546-
$config = new WorkerMode();
547-
$config->cacheStrategy = 'reconnect';
546+
$config = new WorkerMode();
547+
$config->cacheStrategy = 'reconnect';
548548
$config->persistentServices = ['timer'];
549549

550550
Services::cache();

0 commit comments

Comments
 (0)