Skip to content

Commit 9820c31

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 301ffb8 + 87652c9 commit 9820c31

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

system/Database/Postgre/Connection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public function connect(bool $persistent = false)
6767
}
6868

6969
// Convert DSN string
70+
// @TODO This format is for PDO_PGSQL.
71+
// https://www.php.net/manual/en/ref.pdo-pgsql.connection.php
72+
// Should deprecate?
7073
if (mb_strpos($this->DSN, 'pgsql:') === 0) {
7174
$this->convertDSN();
7275
}

tests/system/Database/ConfigTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ public function testConnectionGroupWithDSNPostgreNative(): void
200200
*/
201201
public function testConvertDSN(string $input, string $expected): void
202202
{
203+
// @TODO This format is for PDO_PGSQL.
204+
// https://www.php.net/manual/en/ref.pdo-pgsql.connection.php
205+
// Should deprecate?
203206
$this->dsnGroupPostgreNative['DSN'] = $input;
204207
$conn = Config::connect($this->dsnGroupPostgreNative, false);
205208
$this->assertInstanceOf(BaseConnection::class, $conn);

user_guide_src/source/concepts/autoloader.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ CodeIgniter4 Autoloader
1919

2020
CodeIgniter provides a very flexible autoloader that can be used with very little configuration.
2121
It can locate individual namespaced classes that adhere to
22-
`PSR-4 <https://www.php-fig.org/psr/psr-4/>`_ autoloading
23-
directory structures.
22+
`PSR-4`_ autoloading directory structures.
23+
24+
.. _PSR-4: https://www.php-fig.org/psr/psr-4/
2425

2526
The autoloader works great by itself, but can also work with other autoloaders, like
2627
`Composer <https://getcomposer.org>`_, or even your own custom autoloaders, if needed.
@@ -49,16 +50,23 @@ arrays: one for the classmap, and one for PSR-4 compatible namespaces.
4950
Namespaces
5051
==========
5152

52-
The recommended method for organizing your classes is to create one or more namespaces for your
53-
application's files. This is most important for any business-logic related classes, entity classes,
54-
etc. The ``$psr4`` array in the configuration file allows you to map the namespace to the directory
53+
The recommended method for organizing your classes is to create one or more namespaces
54+
for your application's files.
55+
56+
The ``$psr4`` array in the configuration file allows you to map the namespace to the directory
5557
those classes can be found in:
5658

5759
.. literalinclude:: autoloader/001.php
5860

5961
The key of each row is the namespace itself. This does not need a trailing back slash.
6062
The value is the location to the directory the classes can be found in.
6163

64+
By default, the namespace ``App`` is located in the **app** directory, and the
65+
namespace ``Config`` is located in the ``app/Config`` directory.
66+
67+
If you create class files in the locations and according to `PSR-4`_, the autoloader
68+
will autoload them.
69+
6270
.. _confirming-namespaces:
6371

6472
Confirming Namespaces
@@ -119,9 +127,8 @@ You will need to modify any existing files that are referencing the current name
119127
Classmap
120128
========
121129

122-
The classmap is used extensively by CodeIgniter to eke the last ounces of performance out of the system
123-
by not hitting the file-system with extra ``is_file()`` calls. You can use the classmap to link to
124-
third-party libraries that are not namespaced:
130+
If you use third-party libraries that are not Composer packages and are not namespaced,
131+
you can load those classes using the classmap:
125132

126133
.. literalinclude:: autoloader/003.php
127134

user_guide_src/source/libraries/time.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ extension's features to convert times across timezones and display the output co
77
is the ``Time`` class and lives in the ``CodeIgniter\I18n`` namespace.
88

99
.. note:: Since the Time class extends ``DateTimeImmutable``, if there are features that you need that this class doesn't provide,
10-
you can likely find them within the `DateTimeImmutable <https://www.php.net/manual/en/class.datetimeimmutable.php>`_ class itself.
10+
you can likely find them within the `DateTimeImmutable`_ class itself.
11+
12+
.. _DateTimeImmutable: https://www.php.net/manual/en/class.datetimeimmutable.php
1113

1214
.. note:: Prior to v4.3.0, the Time class extended ``DateTime`` and some inherited methods changed
1315
the current object state. The bug was fixed in v4.3.0. If you need the old Time class for backward
@@ -24,10 +26,11 @@ Instantiating
2426
There are several ways that a new Time instance can be created. The first is simply to create a new instance
2527
like any other class.
2628

27-
When you do it this way, you can pass in a string representing the desired time. This can
28-
be any string that PHP's `strtotime()`_ function can parse:
29+
When you do it this way, you can pass in a string representing the desired time.
30+
This can be any string that PHP's `DateTimeImmutable`_ constructor can parse. See
31+
`Supported Date and Time Formats`_ for details.
2932

30-
.. _strtotime(): https://www.php.net/manual/en/function.strtotime.php
33+
.. _Supported Date and Time Formats: https://www.php.net/manual/en/datetime.formats.php
3134

3235
.. literalinclude:: time/001.php
3336

user_guide_src/source/libraries/time/001.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
use CodeIgniter\I18n\Time;
44

5-
$myTime = new Time('+3 week');
5+
$myTime = new Time('2024-01-01');
6+
$myTime = new Time('2024-01-01 12:00:00');
67
$myTime = new Time('now');
8+
$myTime = new Time('+3 week');

0 commit comments

Comments
 (0)