Skip to content

Commit 5d3d4b2

Browse files
committed
Release v4.3.4
1 parent e3821f9 commit 5d3d4b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+245
-173
lines changed

app/Config/App.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class App extends BaseConfig
105105
*
106106
* The default timezone that will be used in your application to display
107107
* dates with the date helper, and can be retrieved through app_timezone()
108+
*
109+
* @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP.
108110
*/
109111
public string $appTimezone = 'UTC';
110112

app/Config/Generators.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Generators extends BaseConfig
2626
* @var array<string, string>
2727
*/
2828
public array $views = [
29+
'make:cell' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
2930
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
3031
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
3132
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',

public/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* ---------------------------------------------------------------
4848
*
4949
* The CodeIgniter class contains the core functionality to make
50-
* the application run, and does all of the dirty work to get
50+
* the application run, and does all the dirty work to get
5151
* the pieces all working together.
5252
*/
5353

@@ -60,7 +60,7 @@
6060
*---------------------------------------------------------------
6161
* LAUNCH THE APPLICATION
6262
*---------------------------------------------------------------
63-
* Now that everything is setup, it's time to actually fire
63+
* Now that everything is set up, it's time to actually fire
6464
* up the engines and make this app do its thang.
6565
*/
6666

system/API/ResponseTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use CodeIgniter\Format\FormatterInterface;
1515
use CodeIgniter\HTTP\IncomingRequest;
16+
use CodeIgniter\HTTP\RequestInterface;
1617
use CodeIgniter\HTTP\ResponseInterface;
1718
use Config\Services;
1819

@@ -21,7 +22,7 @@
2122
* consistent HTTP responses under a variety of common
2223
* situations when working as an API.
2324
*
24-
* @property IncomingRequest $request
25+
* @property RequestInterface $request
2526
* @property ResponseInterface $response
2627
*/
2728
trait ResponseTrait

system/BaseModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ abstract class BaseModel
6363
* The Database connection group that
6464
* should be instantiated.
6565
*
66-
* @var string
67-
* @phpstan-var non-empty-string
66+
* @var string|null
67+
* @phpstan-var non-empty-string|null
6868
*/
6969
protected $DBGroup;
7070

system/CLI/BaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ abstract public function run(array $params);
105105
/**
106106
* Can be used by a command to run other commands.
107107
*
108-
* @return mixed
108+
* @return int|void
109109
*
110110
* @throws ReflectionException
111111
*/
@@ -205,7 +205,7 @@ public function getPad(array $array, int $pad): int
205205
/**
206206
* Makes it simple to access our protected properties.
207207
*
208-
* @return mixed
208+
* @return array|Commands|LoggerInterface|string|null
209209
*/
210210
public function __get(string $key)
211211
{

system/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ public static function getURI(): string
915915
*
916916
* **IMPORTANT:** The index here is one-based instead of zero-based.
917917
*
918-
* @return mixed
918+
* @return string|null
919919
*/
920920
public static function getSegment(int $index)
921921
{

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeIgniter
4747
/**
4848
* The current version of CodeIgniter Framework
4949
*/
50-
public const CI_VERSION = '4.3.3';
50+
public const CI_VERSION = '4.3.4';
5151

5252
/**
5353
* App startup time.

system/Commands/Generators/CellGenerator.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,8 @@ public function run(array $params)
8888
// Form the view name
8989
$segments = explode('\\', $this->qualifyClassName());
9090

91-
$view = array_pop($segments);
92-
$view = str_replace('Cell', '', decamelize($view));
93-
if (strpos($view, '_cell') === false) {
94-
$view .= '_cell';
95-
}
91+
$view = array_pop($segments);
92+
$view = decamelize($view);
9693
$segments[] = $view;
9794
$view = implode('\\', $segments);
9895

system/Commands/Generators/Views/model.tpl.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class {class} extends Model
1010
protected $table = '{table}';
1111
protected $primaryKey = 'id';
1212
protected $useAutoIncrement = true;
13-
protected $insertID = 0;
1413
protected $returnType = {return};
1514
protected $useSoftDeletes = false;
1615
protected $protectFields = true;

system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ public function read(string $class, string $defaultController = 'Home', string $
6565
// Remove HTTP verb prefix.
6666
$methodInUri = lcfirst(substr($methodName, strlen($httpVerb)));
6767

68+
// Check if it is the default method.
6869
if ($methodInUri === $defaultMethod) {
69-
$routeWithoutController = $this->getRouteWithoutController(
70+
$routeForDefaultController = $this->getRouteForDefaultController(
7071
$classShortname,
7172
$defaultController,
7273
$classInUri,
@@ -75,8 +76,11 @@ public function read(string $class, string $defaultController = 'Home', string $
7576
$httpVerb
7677
);
7778

78-
if ($routeWithoutController !== []) {
79-
$output = [...$output, ...$routeWithoutController];
79+
if ($routeForDefaultController !== []) {
80+
// The controller is the default controller. It only
81+
// has a route for the default method. Other methods
82+
// will not be routed even if they exist.
83+
$output = [...$output, ...$routeForDefaultController];
8084

8185
continue;
8286
}
@@ -113,6 +117,12 @@ public function read(string $class, string $defaultController = 'Home', string $
113117
$params[$param->getName()] = $required;
114118
}
115119

120+
// If it is the default controller, the method will not be
121+
// routed.
122+
if ($classShortname === $defaultController) {
123+
$route = 'x ' . $route;
124+
}
125+
116126
$output[] = [
117127
'method' => $httpVerb,
118128
'route' => $route,
@@ -151,9 +161,11 @@ private function getUriByClass(string $classname): string
151161
}
152162

153163
/**
154-
* Gets a route without default controller.
164+
* Gets a route for the default controller.
165+
*
166+
* @phpstan-return list<array>
155167
*/
156-
private function getRouteWithoutController(
168+
private function getRouteForDefaultController(
157169
string $classShortname,
158170
string $defaultController,
159171
string $uriByClass,

system/Config/BaseService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ class BaseService
173173
*
174174
* $key must be a name matching a service.
175175
*
176-
* @param mixed ...$params
176+
* @param array|bool|float|int|object|string|null ...$params
177177
*
178-
* @return mixed
178+
* @return object
179179
*/
180180
protected static function getSharedInstance(string $key, ...$params)
181181
{
@@ -239,7 +239,7 @@ public static function locator(bool $getShared = true)
239239
* Provides the ability to perform case-insensitive calling of service
240240
* names.
241241
*
242-
* @return mixed
242+
* @return object|null
243243
*/
244244
public static function __callStatic(string $name, array $arguments)
245245
{
@@ -296,7 +296,7 @@ public static function resetSingle(string $name)
296296
/**
297297
* Inject mock object for testing.
298298
*
299-
* @param mixed $mock
299+
* @param object $mock
300300
*/
301301
public static function injectMock(string $name, $mock)
302302
{
@@ -309,7 +309,7 @@ public static function injectMock(string $name, $mock)
309309
* looks for the service method in each, returning an instance of
310310
* the service, if available.
311311
*
312-
* @return mixed
312+
* @return object|null
313313
*
314314
* @deprecated
315315
*

system/Config/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Config
2323
* @param string $name Configuration name
2424
* @param bool $getShared Use shared instance
2525
*
26-
* @return mixed|null
26+
* @return object|null
2727
*/
2828
public static function get(string $name, bool $getShared = true)
2929
{

system/Cookie/Cookie.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Cookie implements ArrayAccess, CloneableCookieInterface
9696
* Default attributes for a Cookie object. The keys here are the
9797
* lowercase attribute names. Do not camelCase!
9898
*
99-
* @var array<string, mixed>
99+
* @var array<string, bool|int|string>
100100
*/
101101
private static array $defaults = [
102102
'prefix' => '',
@@ -124,7 +124,7 @@ class Cookie implements ArrayAccess, CloneableCookieInterface
124124
*
125125
* This method is called from Response::__construct().
126126
*
127-
* @param array<string, mixed>|CookieConfig $config
127+
* @param array<string, bool|int|string>|CookieConfig $config
128128
*
129129
* @return array<string, mixed> The old defaults array. Useful for resetting.
130130
*/
@@ -195,9 +195,9 @@ public static function fromHeaderString(string $cookie, bool $raw = false)
195195
/**
196196
* Construct a new Cookie instance.
197197
*
198-
* @param string $name The cookie's name
199-
* @param string $value The cookie's value
200-
* @param array<string, mixed> $options The cookie's options
198+
* @param string $name The cookie's name
199+
* @param string $value The cookie's value
200+
* @param array<string, bool|int|string> $options The cookie's options
201201
*
202202
* @throws CookieException
203203
*/
@@ -595,8 +595,8 @@ public function offsetGet($offset)
595595
/**
596596
* Offset to set.
597597
*
598-
* @param string $offset
599-
* @param mixed $value
598+
* @param string $offset
599+
* @param bool|int|string $value
600600
*
601601
* @throws LogicException
602602
*/

system/Cookie/CookieInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function isRaw(): bool;
143143
* Gets the options that are passable to the `setcookie` variant
144144
* available on PHP 7.3+
145145
*
146-
* @return array<string, mixed>
146+
* @return array<string, bool|int|string>
147147
*/
148148
public function getOptions(): array;
149149

@@ -162,7 +162,7 @@ public function __toString();
162162
/**
163163
* Returns the array representation of the Cookie object.
164164
*
165-
* @return array<string, mixed>
165+
* @return array<string, bool|int|string>
166166
*/
167167
public function toArray(): array;
168168
}

system/Database/BaseConnection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ abstract protected function _close();
456456
/**
457457
* Create a persistent database connection.
458458
*
459-
* @return mixed
459+
* @return false|object|resource
460+
* @phpstan-return false|TConnection
460461
*/
461462
public function persistentConnect()
462463
{
@@ -558,7 +559,7 @@ abstract protected function execute(string $sql);
558559
* Should automatically handle different connections for read/write
559560
* queries if needed.
560561
*
561-
* @param mixed ...$binds
562+
* @param array|string|null $binds
562563
*
563564
* @return BaseResult|bool|Query BaseResult when “read” type query, bool when “write” type query, Query when prepared query
564565
* @phpstan-return BaseResult<TConnection, TResult>|bool|Query
@@ -1747,7 +1748,7 @@ protected function _enableForeignKeyChecks()
17471748
/**
17481749
* Accessor for properties if they exist.
17491750
*
1750-
* @return mixed
1751+
* @return array|bool|float|int|object|resource|string|null
17511752
*/
17521753
public function __get(string $key)
17531754
{

0 commit comments

Comments
 (0)