From 601c03a17f36439ecd45ce2d9a4cb68dc2fd7278 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 25 Oct 2022 10:01:35 +0900 Subject: [PATCH 01/22] docs: fix PHPDoc types --- system/Config/Factories.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 9e02fc43e3f5..514c52a1e561 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -31,7 +31,8 @@ class Factories * Store of component-specific options, usually * from CodeIgniter\Config\Factory. * - * @var array + * @var array[] + * @phpstan-var array> */ protected static $options = []; @@ -39,7 +40,7 @@ class Factories * Explicit options for the Config * component to prevent logic loops. * - * @var array + * @phpstan-var array */ private static array $configOptions = [ 'component' => 'config', @@ -53,7 +54,8 @@ class Factories * Mapping of class basenames (no namespace) to * their instances. * - * @var array + * @var array[] + * @phpstan-var array> */ protected static $basenames = []; @@ -63,7 +65,8 @@ class Factories * A multi-dimensional array with components as * keys to the array of name-indexed instances. * - * @var array + * @var array[] + * @phpstan-var array> */ protected static $instances = []; @@ -74,9 +77,10 @@ class Factories * * @template T of Model * - * @param class-string $name + * @phpstan-param class-string $name * - * @return T + * @return object + * @phpstan-return T */ public static function models(string $name, array $options = [], ?ConnectionInterface &$conn = null) { @@ -228,7 +232,7 @@ protected static function verifyInstanceOf(array $options, string $name): bool * * @param string $component Lowercase, plural component name * - * @return array + * @phpstan-return array */ public static function getOptions(string $component): array { @@ -253,7 +257,8 @@ public static function getOptions(string $component): array * * @param string $component Lowercase, plural component name * - * @return array The result after applying defaults and normalization + * @return array The result after applying defaults and normalization + * @phpstan-return array */ public static function setOptions(string $component, array $values): array { From d8de7c9645c506ed69ba6c8984b8e5a84c0f1dbc Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 27 Oct 2022 17:09:47 +0900 Subject: [PATCH 02/22] docs: fix @param type Co-authored-by: MGatner --- system/Config/Factories.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 514c52a1e561..c4c3061b936a 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -79,7 +79,7 @@ class Factories * * @phpstan-param class-string $name * - * @return object + * @return Model * @phpstan-return T */ public static function models(string $name, array $options = [], ?ConnectionInterface &$conn = null) From 0118dae0e2716df8ddf037e83e27c557f482ec33 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 27 Oct 2022 21:41:36 +0900 Subject: [PATCH 03/22] docs: remove @phpstan-* --- system/Config/Factories.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/system/Config/Factories.php b/system/Config/Factories.php index c4c3061b936a..77f43ba55c3b 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -31,8 +31,7 @@ class Factories * Store of component-specific options, usually * from CodeIgniter\Config\Factory. * - * @var array[] - * @phpstan-var array> + * @var array> */ protected static $options = []; @@ -40,7 +39,7 @@ class Factories * Explicit options for the Config * component to prevent logic loops. * - * @phpstan-var array + * @var array */ private static array $configOptions = [ 'component' => 'config', @@ -232,7 +231,7 @@ protected static function verifyInstanceOf(array $options, string $name): bool * * @param string $component Lowercase, plural component name * - * @phpstan-return array + * @return array */ public static function getOptions(string $component): array { @@ -257,8 +256,7 @@ public static function getOptions(string $component): array * * @param string $component Lowercase, plural component name * - * @return array The result after applying defaults and normalization - * @phpstan-return array + * @return array The result after applying defaults and normalization */ public static function setOptions(string $component, array $values): array { From 34f08677f0fc73f8ba72d93ff77cff40890cb813 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 27 Oct 2022 21:48:32 +0900 Subject: [PATCH 04/22] docs: make @var more specific --- system/Config/Factories.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 77f43ba55c3b..c6bb25de0794 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -53,7 +53,7 @@ class Factories * Mapping of class basenames (no namespace) to * their instances. * - * @var array[] + * @var array> * @phpstan-var array> */ protected static $basenames = []; @@ -64,7 +64,7 @@ class Factories * A multi-dimensional array with components as * keys to the array of name-indexed instances. * - * @var array[] + * @var array> * @phpstan-var array> */ protected static $instances = []; From ff2a4e300e0c2caaea6fb63e18857d1217142a5a Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 30 Oct 2022 16:27:50 +0800 Subject: [PATCH 05/22] Add PHP 8.2 to Unit Tests GHA --- .github/workflows/test-phpunit.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index 253263e78884..bd8ed58fd579 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -47,13 +47,15 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1'] + php-versions: ['7.4', '8.0', '8.1', '8.2'] db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV', 'OCI8'] mysql-versions: ['5.7'] include: - php-versions: '7.4' db-platforms: MySQLi mysql-versions: '8.0' + - php-versions: '8.2' + composer-option: '--ignore-platform-req=php' services: mysql: @@ -148,8 +150,8 @@ jobs: - name: Install dependencies run: | - composer update --ansi --no-interaction - composer remove --ansi --dev --unused -W -- rector/rector phpstan/phpstan friendsofphp/php-cs-fixer nexusphp/cs-config codeigniter/coding-standard + composer update --ansi --no-interaction ${{ matrix.composer-option }} + composer remove --ansi --dev --unused ${{ matrix.composer-option }} -W -- rector/rector phpstan/phpstan friendsofphp/php-cs-fixer nexusphp/cs-config codeigniter/coding-standard - name: Profile slow tests in PHP ${{ env.COVERAGE_PHP_VERSION }} if: matrix.php-versions == env.COVERAGE_PHP_VERSION From c788c7b87d6e7a2350c06ba15a6f02fb6f3f3a02 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 31 Oct 2022 10:28:53 +0900 Subject: [PATCH 06/22] docs: add v4.2.9 changelog --- CHANGELOG.md | 5 +++++ user_guide_src/source/changelogs/index.rst | 1 + user_guide_src/source/changelogs/v4.2.9.rst | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 user_guide_src/source/changelogs/v4.2.9.rst diff --git a/CHANGELOG.md b/CHANGELOG.md index 65692f144275..ca74fac9370d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [v4.2.9](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.9) (2022-10-30) +[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.8...v4.2.9) + +**Hotfix release to fix PHPUnit errors (see https://github.com/codeigniter4/CodeIgniter4/pull/6794)** + ## [v4.2.8](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.8) (2022-10-30) [Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.7...v4.2.8) diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index f764a929bff5..e87e0f5ec5b5 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,6 +12,7 @@ See all the changes. .. toctree:: :titlesonly: + v4.2.9 v4.2.8 v4.2.7 v4.2.6 diff --git a/user_guide_src/source/changelogs/v4.2.9.rst b/user_guide_src/source/changelogs/v4.2.9.rst new file mode 100644 index 000000000000..b5d6ecaea143 --- /dev/null +++ b/user_guide_src/source/changelogs/v4.2.9.rst @@ -0,0 +1,19 @@ +Version 4.2.9 +############# + +Release Date: October 30, 2022 + +**4.2.9 release of CodeIgniter4** + +.. contents:: + :local: + :depth: 2 + +**Hotfix release to fix PHPUnit errors in 4.2.8; no other content changes.** + +Bugs Fixed +********** + +- Fixed a bug that causes `PHP Fatal error: Trait "Nexus\PHPUnit\Extension\Expeditable" not found` when running PHPUnit. + +See the repo's `CHANGELOG.md `_ for a complete list of bugs fixed. From 88474b649e1e885eb794f288fbba99fbf35bf8a5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 31 Oct 2022 17:05:53 +0900 Subject: [PATCH 07/22] docs: fix @param and @return --- system/Session/Session.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/system/Session/Session.php b/system/Session/Session.php index a0d9f4902584..fa44b8267e7b 100644 --- a/system/Session/Session.php +++ b/system/Session/Session.php @@ -197,7 +197,7 @@ public function __construct(SessionHandlerInterface $driver, App $config) /** * Initialize the session container and starts up the session. * - * @return mixed + * @return $this|void */ public function start() { @@ -450,8 +450,8 @@ public function destroy() * If $data is an array, it is expected to be an array of key/value pairs * to be set as session properties. * - * @param array|string $data Property name or associative array of properties - * @param mixed $value Property value if single key provided + * @param array|string $data Property name or associative array of properties + * @param array|bool|float|int|object|string|null $value Property value if single key provided */ public function set($data, $value = null) { @@ -612,8 +612,8 @@ public function __isset(string $key): bool * Otherwise, it is interpreted as the identifier of a specific * flashdata property, with $value containing the property value. * - * @param array|string $data Property identifier or associative array of properties - * @param array|string $value Property value if $data is a scalar + * @param array|string $data Property identifier or associative array of properties + * @param array|bool|float|int|object|string|null $value Property value if $data is a scalar */ public function setFlashdata($data, $value = null) { @@ -695,7 +695,7 @@ public function markAsFlashdata($key): bool /** * Unmark data in the session as flashdata. * - * @param mixed $key Property identifier or array of them + * @param array|string $key Property identifier or array of them */ public function unmarkFlashdata($key) { @@ -744,9 +744,9 @@ public function getFlashKeys(): array * Sets new data into the session, and marks it as temporary data * with a set lifespan. * - * @param array|string $data Session data key or associative array of items - * @param null $value Value to store - * @param int $ttl Time-to-live in seconds + * @param array|string $data Session data key or associative array of items + * @param array|bool|float|int|object|string|null $value Value to store + * @param int $ttl Time-to-live in seconds */ public function setTempdata($data, $value = null, int $ttl = 300) { @@ -760,7 +760,7 @@ public function setTempdata($data, $value = null, int $ttl = 300) * * @param string $key Session data key * - * @return mixed Session data value or null if not found. + * @return array|bool|float|int|object|string|null Session data value or null if not found. */ public function getTempdata(?string $key = null) { From bcae2a243ff1e00042d58dd97ffaaa2cbdd338c9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 1 Nov 2022 09:15:23 +0900 Subject: [PATCH 08/22] docs: add missing \ for consistency --- user_guide_src/source/libraries/images/002.php | 2 +- user_guide_src/source/testing/controllers/005.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/images/002.php b/user_guide_src/source/libraries/images/002.php index b0f698c3d768..9215a57e9e23 100644 --- a/user_guide_src/source/libraries/images/002.php +++ b/user_guide_src/source/libraries/images/002.php @@ -1,3 +1,3 @@ appTimezone = 'America/Chicago'; $results = $this->withConfig($config) From ccce89961727f591b08289e4a56d1eab684bf926 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 14:17:09 +0800 Subject: [PATCH 09/22] Update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5caa82fddd4f..98aa948b795e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,6 +2,8 @@ Each pull request should address a single issue and have a meaningful title. +- Pull requests must be in English. +- If a pull request fixes an issue, reference the issue with a suitable keyword (e.g., Fixes ). - All bug fixes should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed. - PRs with any enhancement should be sent to the next minor version branch, e.g. __"4.3"__ @@ -15,15 +17,3 @@ Explain what you have changed, and why. - [ ] Unit testing, with >80% coverage - [ ] User guide updated - [ ] Conforms to style guide - - From 7f95f7d5225bf9f60cc4e75195a7937e93b900cb Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 20:49:52 +0800 Subject: [PATCH 10/22] Add check-version job --- .github/scripts/validate-version | 21 +++++++++++++++++ .github/workflows/deploy-framework.yml | 32 +++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/validate-version diff --git a/.github/scripts/validate-version b/.github/scripts/validate-version new file mode 100644 index 000000000000..d8fa85cdf959 --- /dev/null +++ b/.github/scripts/validate-version @@ -0,0 +1,21 @@ +#!/bin/bash +set -o pipefail + +if [[ -z $1 ]]; then + echo "validate-version requires a version identifier" + exit 1 +fi + +FILES=("system/CodeIgniter.php" "user_guide_src/source/conf.py") +LENGTH="${#FILES[@]}" + +for FILE in "${FILES[@]}"; do + COUNT="$((COUNT + $(grep -c "$FILE" -e "$1")))" +done + +if [[ $COUNT -ne $LENGTH ]]; then + echo "CodeIgniter version is not updated to v"$1"" + exit 1 +fi + +echo "CodeIgniter version is updated to v"$1"" diff --git a/.github/workflows/deploy-framework.yml b/.github/workflows/deploy-framework.yml index 9fdbc8f08127..f2be4cf0c9ca 100644 --- a/.github/workflows/deploy-framework.yml +++ b/.github/workflows/deploy-framework.yml @@ -1,4 +1,4 @@ -# When a new Release is created, deploy relevant +# When a new release is created, deploy relevant # files to each of the generated repos. name: Deploy Framework @@ -7,10 +7,34 @@ on: types: [published] jobs: + check-version: + name: Check for updated version + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # fetch all tags + + - name: Get latest version + run: | + echo 'LATEST_VERSION<> $GITHUB_ENV + echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: Search for updated version + if: ${{ env.LATEST_VERSION }} + run: | + chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version + ${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }} + framework: name: Deploy to framework if: github.repository == 'codeigniter4/CodeIgniter4' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + needs: check-version + steps: - name: Identify run: | @@ -55,7 +79,9 @@ jobs: appstarter: name: Deploy to appstarter if: github.repository == 'codeigniter4/CodeIgniter4' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + needs: check-version + steps: - name: Identify run: | From cd4bff31d19ebe616858c8307776a75ae0f789e0 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 21:31:05 +0800 Subject: [PATCH 11/22] Move contents of deploy-userguide to deploy-framework --- .github/workflows/deploy-framework.yml | 53 +++++++++++++++++++++++ .github/workflows/deploy-userguide.yml | 59 -------------------------- 2 files changed, 53 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/deploy-userguide.yml diff --git a/.github/workflows/deploy-framework.yml b/.github/workflows/deploy-framework.yml index f2be4cf0c9ca..0af8d9f43e47 100644 --- a/.github/workflows/deploy-framework.yml +++ b/.github/workflows/deploy-framework.yml @@ -122,3 +122,56 @@ jobs: name: release.data.name, body: release.data.body }) + + userguide: + name: Deploy to userguide + if: github.repository == 'codeigniter4/CodeIgniter4' + runs-on: ubuntu-22.04 + needs: check-version + + steps: + - name: Identify + run: | + git config --global user.email "action@github.com" + git config --global user.name "${GITHUB_ACTOR}" + + - name: Checkout source + uses: actions/checkout@v3 + with: + path: source + + - name: Checkout target + uses: actions/checkout@v3 + with: + repository: codeigniter4/userguide + token: ${{ secrets.ACCESS_TOKEN }} + path: userguide + + - name: Install Sphinx + run: | + sudo apt install python3-sphinx + sudo pip3 install sphinxcontrib-phpdomain + sudo pip3 install sphinx_rtd_theme + + - name: Chmod + run: chmod +x ./source/.github/scripts/deploy-userguide + + - name: Deploy + run: ./source/.github/scripts/deploy-userguide ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/userguide ${GITHUB_REF##*/} + + - name: Release + uses: actions/github-script@v6 + with: + github-token: ${{secrets.ACCESS_TOKEN}} + script: | + const release = await github.rest.repos.getLatestRelease({ + owner: context.repo.owner, + repo: context.repo.repo + }) + github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: 'userguide', + tag_name: release.data.tag_name, + name: release.data.name, + body: release.data.body + }) diff --git a/.github/workflows/deploy-userguide.yml b/.github/workflows/deploy-userguide.yml deleted file mode 100644 index 384eeef5186f..000000000000 --- a/.github/workflows/deploy-userguide.yml +++ /dev/null @@ -1,59 +0,0 @@ -# When a new Release is created, deploy relevant -# files to each of the generated repos. -name: Deploy User Guide - -on: - release: - types: [published] - -jobs: - framework: - name: Deploy to userguide - if: (github.repository == 'codeigniter4/CodeIgniter4') - runs-on: ubuntu-latest - steps: - - name: Identify - run: | - git config --global user.email "action@github.com" - git config --global user.name "${GITHUB_ACTOR}" - - - name: Checkout source - uses: actions/checkout@v3 - with: - path: source - - - name: Checkout target - uses: actions/checkout@v3 - with: - repository: codeigniter4/userguide - token: ${{ secrets.ACCESS_TOKEN }} - path: userguide - - - name: Install Sphinx - run: | - sudo apt install python3-sphinx - sudo pip3 install sphinxcontrib-phpdomain - sudo pip3 install sphinx_rtd_theme - - - name: Chmod - run: chmod +x ./source/.github/scripts/deploy-userguide - - - name: Deploy - run: ./source/.github/scripts/deploy-userguide ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/userguide ${GITHUB_REF##*/} - - - name: Release - uses: actions/github-script@v6 - with: - github-token: ${{secrets.ACCESS_TOKEN}} - script: | - const release = await github.rest.repos.getLatestRelease({ - owner: context.repo.owner, - repo: context.repo.repo - }) - github.rest.repos.createRelease({ - owner: context.repo.owner, - repo: 'userguide', - tag_name: release.data.tag_name, - name: release.data.name, - body: release.data.body - }) From 884a8e75e62f9661864b6d9a7777f8ec24983ef4 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 21:32:22 +0800 Subject: [PATCH 12/22] Rename to deploy-distributables.yml --- .../{deploy-framework.yml => deploy-distributables.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{deploy-framework.yml => deploy-distributables.yml} (99%) diff --git a/.github/workflows/deploy-framework.yml b/.github/workflows/deploy-distributables.yml similarity index 99% rename from .github/workflows/deploy-framework.yml rename to .github/workflows/deploy-distributables.yml index 0af8d9f43e47..d00ebc5a9f36 100644 --- a/.github/workflows/deploy-framework.yml +++ b/.github/workflows/deploy-distributables.yml @@ -1,6 +1,6 @@ # When a new release is created, deploy relevant # files to each of the generated repos. -name: Deploy Framework +name: Deploy Distributable Repos on: release: From ebf7e66994f181d80cb094d485f0454b16c6b897 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 21:36:43 +0800 Subject: [PATCH 13/22] Update admin/RELEASE.md --- admin/RELEASE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/RELEASE.md b/admin/RELEASE.md index 174147ac5733..d37868bf1d5b 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -60,15 +60,15 @@ CodeIgniter 4.x.x release. See the changelog: https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md ``` -* Watch for the "Deploy Framework" Action to make sure **framework** and **appstarter** get updated -* Run the following commands to install and test AppStarter and verify the new version: +* Watch for the "Deploy Distributable Repos" action to make sure **framework**, **appstarter**, and **userguide** get updated +* Run the following commands to install and test `appstarter` and verify the new version: ```console composer create-project codeigniter4/appstarter release-test cd release-test composer test && composer info codeigniter4/framework ``` -* Verify that the User Guide Actions succeeded: - * "Deploy User Guide", framework repo +* Verify that the user guide actions succeeded: + * "Deploy Distributable Repos", framework repo * "Deploy Production", UG repo * "pages-build-deployment", both repos * Fast-forward `develop` branch to catch the merge commit from `master` From cda71ae7da123b0826c12c8ddb8f3ec50f39a3a4 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 1 Nov 2022 23:44:24 +0800 Subject: [PATCH 14/22] Fix deptrac requires ^8.1 --- .github/workflows/test-deptrac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-deptrac.yml b/.github/workflows/test-deptrac.yml index 8b9a598885de..e756f83ebcd7 100644 --- a/.github/workflows/test-deptrac.yml +++ b/.github/workflows/test-deptrac.yml @@ -39,7 +39,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.1' tools: composer, phive extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3 From b69cee36e338aab4e8183c377ef775b260aacc91 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 2 Nov 2022 06:56:39 +0900 Subject: [PATCH 15/22] chore: add ext-xdebug to composer.json --- admin/framework/composer.json | 1 + composer.json | 1 + 2 files changed, 2 insertions(+) diff --git a/admin/framework/composer.json b/admin/framework/composer.json index 486cdf6787ab..8106c5007851 100644 --- a/admin/framework/composer.json +++ b/admin/framework/composer.json @@ -38,6 +38,7 @@ "ext-redis": "If you use Cache class RedisHandler", "ext-dom": "If you use TestResponse", "ext-libxml": "If you use TestResponse", + "ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()", "ext-fileinfo": "Improves mime type detection for files", "ext-readline": "Improves CLI::input() usability" }, diff --git a/composer.json b/composer.json index da3d66ccda58..364bbf261008 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,7 @@ "ext-redis": "If you use Cache class RedisHandler", "ext-dom": "If you use TestResponse", "ext-libxml": "If you use TestResponse", + "ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()", "ext-fileinfo": "Improves mime type detection for files", "ext-readline": "Improves CLI::input() usability" }, From 549e1ca81c9623031e2fe037b6e3eb10e5368796 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 2 Nov 2022 01:07:02 +0800 Subject: [PATCH 16/22] Refactor assertHeaderEmitted and assertHeaderNotEmitted --- system/Test/CIUnitTestCase.php | 72 ++++++++++------------------------ 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index e7a72db457f9..0fecac3ecca1 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -392,60 +392,31 @@ public function assertEventTriggered(string $eventName): bool } /** - * Hooks into xdebug's headers capture, looking for a specific header - * emitted + * Hooks into xdebug's headers capture, looking for presence of + * a specific header emitted. * * @param string $header The leading portion of the header we are looking for - * - * @throws Exception */ public function assertHeaderEmitted(string $header, bool $ignoreCase = false): void { - $found = false; - - if (! function_exists('xdebug_get_headers')) { - $this->markTestSkipped('XDebug not found.'); - } - - foreach (xdebug_get_headers() as $emitted) { - $found = $ignoreCase ? - (stripos($emitted, $header) === 0) : - (strpos($emitted, $header) === 0); - if ($found) { - break; - } - } - - $this->assertTrue($found, "Didn't find header for {$header}"); + $this->assertNotNull( + $this->getHeaderEmitted($header, $ignoreCase, __METHOD__), + "Didn't find header for {$header}" + ); } /** - * Hooks into xdebug's headers capture, looking for a specific header - * emitted + * Hooks into xdebug's headers capture, looking for absence of + * a specific header emitted. * * @param string $header The leading portion of the header we don't want to find - * - * @throws Exception */ public function assertHeaderNotEmitted(string $header, bool $ignoreCase = false): void { - $found = false; - - if (! function_exists('xdebug_get_headers')) { - $this->markTestSkipped('XDebug not found.'); - } - - foreach (xdebug_get_headers() as $emitted) { - $found = $ignoreCase ? - (stripos($emitted, $header) === 0) : - (strpos($emitted, $header) === 0); - if ($found) { - break; - } - } - - $success = ! $found; - $this->assertTrue($success, "Found header for {$header}"); + $this->assertNull( + $this->getHeaderEmitted($header, $ignoreCase, __METHOD__), + "Found header for {$header}" + ); } /** @@ -520,23 +491,20 @@ protected function createApplication() /** * Return first matching emitted header. - * - * @param string $header Identifier of the header of interest - * - * @return string|null The value of the header found, null if not found */ - protected function getHeaderEmitted(string $header, bool $ignoreCase = false): ?string + protected function getHeaderEmitted(string $header, bool $ignoreCase = false, string $method = __METHOD__): ?string { if (! function_exists('xdebug_get_headers')) { - $this->markTestSkipped('XDebug not found.'); + $this->markTestSkipped($method . '() requires xdebug.'); } - foreach (xdebug_get_headers() as $emitted) { - $found = $ignoreCase ? - (stripos($emitted, $header) === 0) : - (strpos($emitted, $header) === 0); + foreach (xdebug_get_headers() as $emittedHeader) { + $found = $ignoreCase + ? (stripos($emittedHeader, $header) === 0) + : (strpos($emittedHeader, $header) === 0); + if ($found) { - return $emitted; + return $emittedHeader; } } From 9e479561494c490f5e872569f0202dc1a668b79a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 03:36:25 +0000 Subject: [PATCH 17/22] chore: update friendsofphp/php-cs-fixer requirement from ~3.12.0 to ~3.13.0 (#6803) --- admin/framework/composer.json | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/framework/composer.json b/admin/framework/composer.json index 8106c5007851..fe66bb2934e4 100644 --- a/admin/framework/composer.json +++ b/admin/framework/composer.json @@ -17,7 +17,7 @@ "require-dev": { "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", - "friendsofphp/php-cs-fixer": "~3.12.0", + "friendsofphp/php-cs-fixer": "~3.13.0", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", "phpunit/phpunit": "^9.1", diff --git a/composer.json b/composer.json index 364bbf261008..dccc0379924f 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require-dev": { "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", - "friendsofphp/php-cs-fixer": "~3.12.0", + "friendsofphp/php-cs-fixer": "~3.13.0", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", "nexusphp/tachycardia": "^1.0", From 6a70b1b7a3d071341e423d6ec15d4d4956111723 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 2 Nov 2022 16:15:53 +0900 Subject: [PATCH 18/22] fix: output "0" at the end of toolbar js when Kint::$enabled_mode is false --- system/Debug/Toolbar.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index f93bfa0a0f31..5e70dbc437ff 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -405,6 +405,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r $kintScript = @Kint::dump(''); Kint::$mode_default = $oldKintMode; $kintScript = substr($kintScript, 0, strpos($kintScript, '') + 8); + $kintScript = ($kintScript === '0') ? '' : $kintScript; $script = PHP_EOL . '