Skip to content

Commit e6015fa

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 0280297 + c4bd34e commit e6015fa

File tree

8 files changed

+108
-41
lines changed

8 files changed

+108
-41
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Auto Add Label "stale" & Comment Conflicts
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- '4.*'
8+
pull_request:
9+
branches:
10+
- develop
11+
- '4.*'
12+
13+
jobs:
14+
auto-label-comment-conflict:
15+
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Get PR List
26+
id: PR-list
27+
run: echo "pr_list=$(gh pr list -L 100 --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: 'Add label "stale" and comment'
32+
env:
33+
PR_LIST: ${{ steps.PR-list.outputs.pr_list }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
37+
IFS=$'\n' # Set Internal Field Separator to newline to handle array elements
38+
39+
# Iterate through the PRs in PR_LIST
40+
for pr in $(echo "$PR_LIST" | jq -c '.[]'); do
41+
mergeable=$(echo "$pr" | jq -r '.mergeable')
42+
author=$(echo "$pr" | jq -r '.author.login')
43+
labels=$(echo "$pr" | jq -c '.labels[].name' | tr -d '[]"')
44+
url=$(echo "$pr" | jq -r '.url')
45+
46+
# CONFLICTING and no 'stale' label
47+
if [ "$mergeable" == "CONFLICTING" ] && [[ ! "$labels" == *"stale"* ]]; then
48+
# Add "stale" label
49+
gh pr edit $url --add-label "stale"
50+
51+
# Add a comment
52+
gh pr comment $url --body ":wave: Hi, @$author!<br><br>We detected conflicts in your PR against the base branch :speak_no_evil:<br>You may want to sync :arrows_counterclockwise: your branch with upstream!<br><br>Ref: [Syncing Your Branch](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#pushing-your-branch)"
53+
fi
54+
done

.github/workflows/label-conflict.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Auto Remove "stale" label
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- '4.*'
8+
9+
jobs:
10+
check-conflict:
11+
runs-on: ubuntu-22.04
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Get PR Detail
21+
id: PR-detail
22+
run: echo "detail=$(gh pr view $PR_URL --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
PR_URL: ${{ github.event.pull_request.html_url }}
26+
27+
- name: 'Remove label "stale"'
28+
env:
29+
PR_DETAIL: ${{ steps.PR-detail.outputs.detail }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
run: |
33+
34+
# MERGEABLE with 'stale' label
35+
if [ "$(echo $PR_DETAIL | jq -r '.mergeable')" == "MERGEABLE" ] && \
36+
[ "$(echo $PR_DETAIL | jq -r '.labels[] | select(.name == "stale")')" != "" ]; then
37+
# remove 'stale' label
38+
gh pr edit $PR_URL --remove-label "stale"
39+
fi

.github/workflows/reusable-coveralls.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ jobs:
5757
run: composer update --ansi
5858

5959
- name: Merge coverage files
60-
run: vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
60+
run: |
61+
jq '.autoload."psr-4" += {"Config\\": "app/Config/"}' composer.json > temp.json && mv temp.json composer.json
62+
composer dump-autoload
63+
vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
6164
6265
- name: Upload coverage to Coveralls
6366
run: vendor/bin/php-coveralls --verbose --exclude-no-stmt --ansi

phpstan-baseline.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,11 +3031,6 @@
30313031
'count' => 1,
30323032
'path' => __DIR__ . '/system/Router/RouteCollection.php',
30333033
];
3034-
$ignoreErrors[] = [
3035-
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
3036-
'count' => 2,
3037-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
3038-
];
30393034
$ignoreErrors[] = [
30403035
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
30413036
'count' => 1,

system/Router/RouteCollection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ public function __construct(FileLocator $locator, Modules $moduleConfig, Routing
302302

303303
// Normalize the path string in routeFiles array.
304304
foreach ($this->routeFiles as $routeKey => $routesFile) {
305-
$this->routeFiles[$routeKey] = realpath($routesFile) ?: $routesFile;
305+
$realpath = realpath($routesFile);
306+
$this->routeFiles[$routeKey] = ($realpath === false) ? $routesFile : $realpath;
306307
}
307308
}
308309

@@ -1680,7 +1681,7 @@ public function resetRoutes()
16801681
*/
16811682
protected function loadRoutesOptions(?string $verb = null): array
16821683
{
1683-
$verb = $verb ?: $this->getHTTPVerb();
1684+
$verb ??= $this->getHTTPVerb();
16841685

16851686
$options = $this->routesOptions[$verb] ?? [];
16861687

user_guide_src/source/database/configuration.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ within the class' constructor:
105105

106106
.. literalinclude:: configuration/008.php
107107

108+
.. _database-config-with-env-file:
109+
108110
**************************
109111
Configuring with .env File
110112
**************************

user_guide_src/source/general/configuration.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ are considered for merging into the configuration object's properties.
183183
.. important:: You cannot add a new property by setting environment variables,
184184
nor change a scalar value to an array. See :ref:`env-var-replacements-for-data`.
185185

186+
.. note:: This feature is implemented in the ``CodeIgniter\Config\BaseConfig``
187+
class. So it will not work with a few files in the **app/Config** folder
188+
that do not extends the class.
189+
186190
If the prefix of a namespaced variable exactly matches the namespace of the configuration
187191
class, then the trailing part of the setting (after the dot) is treated as a configuration
188192
property. If it matches an existing configuration property, the environment variable's
@@ -233,6 +237,8 @@ expect your ``Config\App`` to magically have that property and value at run time
233237
When you have the property ``$default = ['encrypt' => false]`` in your
234238
``Config\Database``, you cannot change the ``encrypt`` value to an array even if
235239
you put ``database.default.encrypt.ssl_verify = true`` in your **.env**.
240+
If you want to do like that, see
241+
:ref:`Database Configuration <database-config-with-env-file>`.
236242

237243
Treating Environment Variables as Arrays
238244
========================================

0 commit comments

Comments
 (0)