Skip to content

Commit 4fed864

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 1e3cfdc + aaef1de commit 4fed864

File tree

6 files changed

+159
-15
lines changed

6 files changed

+159
-15
lines changed

contributing/pull_request.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ and the [PHPUnit website](https://phpunit.de/) for more information.
7979
Source code should be commented using PHPDoc comment blocks. This means
8080
implementation comments to explain potentially confusing sections of
8181
code, and documentation comments before each public or protected
82-
class/interface/trait, method and variable.
82+
class/interface/trait, method, and variable.
8383

8484
Do not add PHPDoc comments that are superficial, duplicated, or stating the obvious.
8585

86-
See the [phpDocumentor website](https://phpdoc.org/) for more
87-
information.
86+
See the following for more information.
87+
88+
- [PHPDoc reference](https://docs.phpdoc.org/3.0/guide/references/phpdoc/index.html#phpdoc-reference)
89+
- [PHPDocs Basics](https://phpstan.org/writing-php-code/phpdocs-basics)
90+
- [PHPDoc Types](https://phpstan.org/writing-php-code/phpdoc-types)
8891

8992
#### Code Comments
9093

@@ -210,12 +213,28 @@ These tools have already been integrated into our CI/CD workflow to minimize una
210213
are expected that their code will pass these two. In your local machine, you can manually run these tools
211214
so that you can fix whatever errors that pop up with your submission.
212215

216+
#### PHPStan
217+
213218
PHPStan is expected to scan the entire framework by running this command in your terminal:
214219

215220
```console
216221
vendor/bin/phpstan analyse
217222
```
218223

224+
See also:
225+
- [PHPDocs Basics](https://phpstan.org/writing-php-code/phpdocs-basics)
226+
- [PHPDoc Types](https://phpstan.org/writing-php-code/phpdoc-types)
227+
228+
If PHPStan errors cannot be resolved by any means, or if the PHPStan error is
229+
false positive and should be ignored, the baseline can be updated with the following
230+
command:
231+
232+
```console
233+
vendor/bin/phpstan analyze --generate-baseline phpstan-baseline.php
234+
```
235+
236+
#### Rector
237+
219238
Rector, on the other hand, can be run on the specific files you modified or added:
220239

221240
```console

contributing/signing.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Read below to find out how to sign your commits :)
2929

3030
## Secure Signing
3131

32-
To verify your commits, you will need to setup a GPG key, and attach it
32+
To verify your commits, you will need to set up a GPG key, and attach it
3333
to your GitHub account.
3434

3535
See the [git tools](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) page
@@ -47,7 +47,19 @@ The basic steps are
4747
- Provide your GPG key passphrase, as prompted, when you do a commit.
4848

4949
Depending on your IDE, you may have to do your Git commits from your Git
50-
bash shell to use the **-S** option to force the secure signing.
50+
bash shell to use the `-S` option to force the secure signing.
51+
52+
## Set Default Signing
53+
54+
We recommend you set git securely sign commits without the `-S` option in
55+
`git commit`.
56+
57+
You can do it by setting `git config --global commit.gpgsign true` and
58+
`git config --global user.signingkey 3AC5C34371567BD2` to all local repositories.
59+
Without the `--global` option, the change is applied to one local repository only.
60+
61+
> [!NOTE]
62+
> `3AC5C34371567BD2` is your GPG Key ID
5163
5264
## Commit Messages
5365

contributing/workflow.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ For instance, to commit your work from a debugging session:
179179

180180
Just make sure that your commits in a feature branch are all related.
181181

182+
> [!NOTE]
183+
> We recommend to [Set Default Signing](./signing.md#set-default-signing) for
184+
> secure signing commits without the `-S` option in `git commit`.
185+
182186
### GPG-Signing Old Commits
183187

184188
Any developer can forget GPG-signing their commits with the option `-S`, like `git commit -S -m 'Signed GPG'`. In such a case, all you need to do is the following:
@@ -197,10 +201,8 @@ All commits:
197201
> git push --force-with-lease origin your-branch
198202
```
199203

200-
As a faster alternative, you can still securely sign commits without the `-S` option in `git commit` by setting `git config --global commit.gpgsign true` and `git config --global user.signingkey 3AC5C34371567BD2` to all local repositories. Without the `--global` option, the change is applied to one local repository only.
201-
202-
> **Note**
203-
> `3AC5C34371567BD2` is your GPG Key ID
204+
As a faster alternative, you can still securely sign commits without the `-S`
205+
option in `git commit`. See [Set Default Signing](./signing.md#set-default-signing).
204206

205207
### Changing a Commit Message
206208

system/Database/OCI8/Connection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,7 @@ protected function _fieldData(string $table): array
317317

318318
$retval[$i]->max_length = $length;
319319

320-
$default = $query[$i]->DATA_DEFAULT;
321-
if ($default === null && $query[$i]->NULLABLE === 'N') {
322-
$default = '';
323-
}
324-
$retval[$i]->default = $default;
320+
$retval[$i]->default = $query[$i]->DATA_DEFAULT;
325321
$retval[$i]->nullable = $query[$i]->NULLABLE === 'Y';
326322
}
327323

tests/system/Database/Live/ForgeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ public function testAddFields(): void
10601060
'name' => 'username',
10611061
'type' => 'VARCHAR2',
10621062
'max_length' => '255',
1063-
'default' => '',
1063+
'default' => null,
10641064
'nullable' => false,
10651065
],
10661066
2 => [
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\Database\Live\OCI8;
15+
16+
use CodeIgniter\Database\Live\AbstractGetFieldDataTest;
17+
use Config\Database;
18+
19+
/**
20+
* @group DatabaseLive
21+
*
22+
* @internal
23+
*/
24+
final class GetFieldDataTest extends AbstractGetFieldDataTest
25+
{
26+
protected function createForge(): void
27+
{
28+
if ($this->db->DBDriver !== 'OCI8') {
29+
$this->markTestSkipped('This test is only for OCI8.');
30+
}
31+
32+
$this->forge = Database::forge($this->db);
33+
}
34+
35+
public function testGetFieldData(): void
36+
{
37+
$fields = $this->db->getFieldData('test1');
38+
39+
$data = [];
40+
41+
foreach ($fields as $obj) {
42+
$data[$obj->name] = $obj;
43+
}
44+
45+
$idDefault = $data['id']->default;
46+
$this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_[0-9]+".nextval/', $idDefault);
47+
48+
$expected = json_decode(json_encode([
49+
(object) [
50+
'name' => 'id',
51+
'type' => 'NUMBER',
52+
'max_length' => '11',
53+
'default' => $idDefault, // The default value is not defined.
54+
// 'primary_key' => 1,
55+
'nullable' => false,
56+
],
57+
(object) [
58+
'name' => 'text_not_null',
59+
'type' => 'VARCHAR2',
60+
'max_length' => '64',
61+
'default' => null, // The default value is not defined.
62+
// 'primary_key' => 0,
63+
'nullable' => false,
64+
],
65+
(object) [
66+
'name' => 'text_null',
67+
'type' => 'VARCHAR2',
68+
'max_length' => '64',
69+
'default' => null, // The default value is not defined.
70+
// 'primary_key' => 0,
71+
'nullable' => true,
72+
],
73+
(object) [
74+
'name' => 'int_default_0',
75+
'type' => 'NUMBER',
76+
'max_length' => '11',
77+
'default' => '0 ', // int 0
78+
// 'primary_key' => 0,
79+
'nullable' => false,
80+
],
81+
(object) [
82+
'name' => 'text_default_null',
83+
'type' => 'VARCHAR2',
84+
'max_length' => '64',
85+
'default' => 'NULL ', // NULL value
86+
// 'primary_key' => 0,
87+
'nullable' => true,
88+
],
89+
(object) [
90+
'name' => 'text_default_text_null',
91+
'type' => 'VARCHAR2',
92+
'max_length' => '64',
93+
'default' => "'null' ", // string "null"
94+
// 'primary_key' => 0,
95+
'nullable' => false,
96+
],
97+
(object) [
98+
'name' => 'text_default_abc',
99+
'type' => 'VARCHAR2',
100+
'max_length' => '64',
101+
'default' => "'abc' ", // string "abc"
102+
// 'primary_key' => 0,
103+
'nullable' => false,
104+
],
105+
]), true);
106+
$names = array_column($expected, 'name');
107+
array_multisort($names, SORT_ASC, $expected);
108+
109+
$fields = json_decode(json_encode($fields), true);
110+
$names = array_column($fields, 'name');
111+
array_multisort($names, SORT_ASC, $fields);
112+
113+
$this->assertSame($expected, $fields);
114+
}
115+
}

0 commit comments

Comments
 (0)