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 - - 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-distributables.yml similarity index 53% rename from .github/workflows/deploy-framework.yml rename to .github/workflows/deploy-distributables.yml index 9fdbc8f08127..d00ebc5a9f36 100644 --- a/.github/workflows/deploy-framework.yml +++ b/.github/workflows/deploy-distributables.yml @@ -1,16 +1,40 @@ -# 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 +name: Deploy Distributable Repos on: release: 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: | @@ -96,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 - }) 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 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 65692f144275..f3364aa3d2bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [v4.2.10](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.10) (2022-11-05) +[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.9...v4.2.10) + +### Fixed Bugs +* docs: fix PHPDoc types in Session by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6796 +* fix: output "0" at the end of toolbar js when Kint::$enabled_mode is false by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6809 + +### Refactoring +* Refactor assertHeaderEmitted and assertHeaderNotEmitted by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6806 +* fix: variable types for PHPStan 1.9.0 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6810 + +## [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/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` diff --git a/admin/framework/composer.json b/admin/framework/composer.json index 486cdf6787ab..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", @@ -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..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", @@ -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" }, diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 0f5303c7ea2f..4d738aed462f 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -47,7 +47,7 @@ class CodeIgniter /** * The current version of CodeIgniter Framework */ - public const CI_VERSION = '4.2.8'; + public const CI_VERSION = '4.2.10'; /** * App startup time. diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 9e02fc43e3f5..c6bb25de0794 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -31,7 +31,7 @@ class Factories * Store of component-specific options, usually * from CodeIgniter\Config\Factory. * - * @var array + * @var array> */ protected static $options = []; @@ -39,7 +39,7 @@ class Factories * Explicit options for the Config * component to prevent logic loops. * - * @var array + * @var array */ private static array $configOptions = [ 'component' => 'config', @@ -53,7 +53,8 @@ class Factories * Mapping of class basenames (no namespace) to * their instances. * - * @var array + * @var array> + * @phpstan-var array> */ protected static $basenames = []; @@ -63,7 +64,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 +76,10 @@ class Factories * * @template T of Model * - * @param class-string $name + * @phpstan-param class-string $name * - * @return T + * @return Model + * @phpstan-return T */ public static function models(string $name, array $options = [], ?ConnectionInterface &$conn = null) { @@ -228,7 +231,7 @@ protected static function verifyInstanceOf(array $options, string $name): bool * * @param string $component Lowercase, plural component name * - * @return array + * @return array */ public static function getOptions(string $component): array { @@ -253,7 +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 + * @return array The result after applying defaults and normalization */ public static function setOptions(string $component, array $values): array { diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index a10fefd2e3c6..f980e3923e48 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -141,7 +141,7 @@ public function connect(bool $persistent = false) $errors = []; foreach (sqlsrv_errors(SQLSRV_ERR_ERRORS) as $error) { - $errors[] = preg_replace('/(\[.+\]\[.+\](?:\[.+\])?)(.+)/', '$2', $error['message']); + $errors[] = (string) preg_replace('/(\[.+\]\[.+\](?:\[.+\])?)(.+)/', '$2', $error['message']); } throw new DatabaseException(implode("\n", $errors)); 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 . '