From 96992f89e33900ff4fb319f7a90b9ce39abb5700 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 12 Aug 2020 11:21:04 +0700 Subject: [PATCH 01/20] 4.1.0: remove Autoloader::loadLegacy() method --- system/Autoloader/Autoloader.php | 50 +------------------ tests/system/Autoloader/AutoloaderTest.php | 13 +---- user_guide_src/source/changelogs/index.rst | 2 + user_guide_src/source/changelogs/v4.1.0.rst | 10 ++++ user_guide_src/source/concepts/autoloader.rst | 9 ---- 5 files changed, 14 insertions(+), 70 deletions(-) create mode 100644 user_guide_src/source/changelogs/v4.1.0.rst diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index 6322b756e9fc..845790bb7f88 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -225,16 +225,7 @@ public function loadClass(string $class) $class = trim($class, '\\'); $class = str_ireplace('.php', '', $class); - $mapped_file = $this->loadInNamespace($class); - - // Nothing? One last chance by looking - // in common CodeIgniter folders. - if (! $mapped_file) - { - $mapped_file = $this->loadLegacy($class); - } - - return $mapped_file; + return $this->loadInNamespace($class); } //-------------------------------------------------------------------- @@ -287,45 +278,6 @@ protected function loadInNamespace(string $class) //-------------------------------------------------------------------- - /** - * Attempts to load the class from common locations in previous - * version of CodeIgniter, namely 'app/Libraries', and - * 'app/Models'. - * - * @param string $class The class name. This typically should NOT have a namespace. - * - * @return mixed The mapped file name on success, or boolean false on failure - */ - protected function loadLegacy(string $class) - { - // If there is a namespace on this class, then - // we cannot load it from traditional locations. - if (strpos($class, '\\') !== false) - { - return false; - } - - $paths = [ - APPPATH . 'Controllers/', - APPPATH . 'Libraries/', - APPPATH . 'Models/', - ]; - - $class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; - - foreach ($paths as $path) - { - if ($file = $this->includeFile($path . $class)) - { - return $file; - } - } - - return false; - } - - //-------------------------------------------------------------------- - /** * A central way to include a file. Split out primarily for testing purposes. * diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index fd998bf16457..ca527561f935 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -186,18 +186,7 @@ public function testloadClassConfigNotFound() $this->assertFalse($this->loader->loadClass('NotFound')); } - public function testLoadLegacy() - { - // should not be able to find a folder - $this->assertFalse((bool) $this->loader->loadClass(__DIR__)); - // should be able to find these because we said so in the Autoloader - $this->assertTrue((bool) $this->loader->loadClass('Home')); - // should not be able to find these - don't exist - $this->assertFalse((bool) $this->loader->loadClass('anotherLibrary')); - $this->assertFalse((bool) $this->loader->loadClass('\nester\anotherLibrary')); - // should not be able to find these legacy classes - namespaced - $this->assertFalse($this->loader->loadClass('Controllers\Home')); - } + //-------------------------------------------------------------------- public function testSanitizationSimply() { diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index aeba4b2490ef..7eb41677871d 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,6 +12,8 @@ See all the changes. .. toctree:: :titlesonly: + next + v4.1.0 v4.0.5 v4.0.4 v4.0.3 diff --git a/user_guide_src/source/changelogs/v4.1.0.rst b/user_guide_src/source/changelogs/v4.1.0.rst new file mode 100644 index 000000000000..64c1e80f2362 --- /dev/null +++ b/user_guide_src/source/changelogs/v4.1.0.rst @@ -0,0 +1,10 @@ +Version 4.1.0 +==================================================== + +Release Date: Not released + +**4.1.0 release of CodeIgniter4** + +Removed: + +- `Autoloader::loadLegacy()` method was previously used for migration non-namespaced classes transition to CodeIgniter v4. Since `4.1.0`, this support removed. \ No newline at end of file diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 842a9d28cfc6..543d70323bc6 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -76,15 +76,6 @@ third-party libraries that are not namespaced:: The key of each row is the name of the class that you want to locate. The value is the path to locate it at. -Legacy Support -============== - -If neither of the above methods finds the class, and the class is not namespaced, the autoloader will look in the -**/app/Libraries** and **/app/Models** directories to attempt to locate the files. This provides -a measure to help ease the transition from previous versions. - -There are no configuration options for legacy support. - Composer Support ================ From 2cbd53114d2570cd3e09e96e07b71ccd69e0ee74 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 12 Aug 2020 15:22:43 +0700 Subject: [PATCH 02/20] Update grammar user_guide_src/source/changelogs/v4.1.0.rst Co-authored-by: John Paul E. Balandan, CPA <51850998+paulbalandan@users.noreply.github.com> --- user_guide_src/source/changelogs/v4.1.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.1.0.rst b/user_guide_src/source/changelogs/v4.1.0.rst index 64c1e80f2362..ee6225fa3e56 100644 --- a/user_guide_src/source/changelogs/v4.1.0.rst +++ b/user_guide_src/source/changelogs/v4.1.0.rst @@ -7,4 +7,4 @@ Release Date: Not released Removed: -- `Autoloader::loadLegacy()` method was previously used for migration non-namespaced classes transition to CodeIgniter v4. Since `4.1.0`, this support removed. \ No newline at end of file +- `Autoloader::loadLegacy()` method was previously used for migration of non-namespaced classes in transition to CodeIgniter v4. Since `4.1.0`, this support was removed. From 841529136de366e1767586af403b6bd247cab00e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 11 Aug 2020 14:08:58 +0700 Subject: [PATCH 03/20] add changelog 4.1.0 for removal Model::fillPlaceholders() --- user_guide_src/source/changelogs/v4.1.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelogs/v4.1.0.rst b/user_guide_src/source/changelogs/v4.1.0.rst index ee6225fa3e56..d8f9571172f4 100644 --- a/user_guide_src/source/changelogs/v4.1.0.rst +++ b/user_guide_src/source/changelogs/v4.1.0.rst @@ -8,3 +8,4 @@ Release Date: Not released Removed: - `Autoloader::loadLegacy()` method was previously used for migration of non-namespaced classes in transition to CodeIgniter v4. Since `4.1.0`, this support was removed. +- Deprecated `Model::fillPlaceholders(array $rules, array $data)` method, use `fillPlaceholders(array $rules, array $data)` from Validation instead. From 22e34b190f24ff21735f6dcf7bb2671181234165 Mon Sep 17 00:00:00 2001 From: MGatner Date: Fri, 30 Oct 2020 18:13:27 +0000 Subject: [PATCH 04/20] Bump PHP req, PHPUnit version --- admin/framework/composer.json | 4 ++-- admin/module/composer.json | 4 ++-- admin/starter/composer.json | 4 ++-- composer.json | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/framework/composer.json b/admin/framework/composer.json index df3468dba72a..e5e88487cfe6 100644 --- a/admin/framework/composer.json +++ b/admin/framework/composer.json @@ -5,7 +5,7 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3||^8.0", "ext-curl": "*", "ext-intl": "*", "ext-json": "*", @@ -18,7 +18,7 @@ "codeigniter4/codeigniter4-standard": "^1.0", "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", "squizlabs/php_codesniffer": "^3.3" }, diff --git a/admin/module/composer.json b/admin/module/composer.json index e2f0eee8dd25..f2b85c785ad8 100644 --- a/admin/module/composer.json +++ b/admin/module/composer.json @@ -4,13 +4,13 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0" + "php": "^7.3||^8.0" }, "require-dev": { "codeigniter4/codeigniter4": "dev-develop", "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.1" }, "suggest": { "ext-fileinfo": "Improves mime type detection for files" diff --git a/admin/starter/composer.json b/admin/starter/composer.json index 16c99faba777..63112d799057 100644 --- a/admin/starter/composer.json +++ b/admin/starter/composer.json @@ -5,13 +5,13 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3||^8.0", "codeigniter4/framework": "^4" }, "require-dev": { "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.1" }, "suggest": { "ext-fileinfo": "Improves mime type detection for files" diff --git a/composer.json b/composer.json index be1033f5f94f..9516cd3901c4 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3||^8.0", "ext-curl": "*", "ext-intl": "*", "ext-json": "*", @@ -18,8 +18,8 @@ "codeigniter4/codeigniter4-standard": "^1.0", "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", - "phpstan/phpstan": "0.12.69", - "phpunit/phpunit": "^8.5 || ^9.1", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", "rector/rector": "^0.8", "squizlabs/php_codesniffer": "^3.3" From 89e7856084b3a8f6a6efc2fbb45d3dcd4510be0e Mon Sep 17 00:00:00 2001 From: MGatner Date: Fri, 30 Oct 2020 18:42:59 +0000 Subject: [PATCH 05/20] Migrate PHPUnit to 9 --- .github/workflows/test-phpunit.yml | 4 +- admin/framework/phpunit.xml.dist | 68 ++++++++++++------------------ admin/module/phpunit.xml.dist | 68 ++++++++++++------------------ admin/starter/phpunit.xml.dist | 68 ++++++++++++------------------ phpunit.xml.dist | 56 +++++++++--------------- 5 files changed, 105 insertions(+), 159 deletions(-) diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index eb15d0a4dd1f..c330de17ffa1 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -12,6 +12,7 @@ on: - 'tests/**' - composer.json - spark + - phpunit.xml.dist - '**.php' - phpunit.xml.dist - .github/workflows/test-phpunit.yml @@ -26,6 +27,7 @@ on: - 'tests/**' - composer.json - spark + - phpunit.xml.dist - '**.php' - phpunit.xml.dist - .github/workflows/test-phpunit.yml @@ -40,7 +42,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.2', '7.3', '7.4', '8.0'] + php-versions: ['7.3', '7.4', '8.0'] db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV'] services: diff --git a/admin/framework/phpunit.xml.dist b/admin/framework/phpunit.xml.dist index 446ae80a291f..ea2a1afc889f 100644 --- a/admin/framework/phpunit.xml.dist +++ b/admin/framework/phpunit.xml.dist @@ -1,60 +1,46 @@ - + + + + ./app + + + ./app/Views + ./app/Config/Routes.php + + + + + + + + ./tests - - - - ./app - - ./app/Views - ./app/Config/Routes.php - - - - - - - - - - - + + + - - - - - - - - - - - - - + diff --git a/admin/module/phpunit.xml.dist b/admin/module/phpunit.xml.dist index dd9ca6e55753..f5b3540f40b6 100644 --- a/admin/module/phpunit.xml.dist +++ b/admin/module/phpunit.xml.dist @@ -1,60 +1,46 @@ - + + + + ./src + + + ./src/Views + ./src/Config/Routes.php + + + + + + + + ./tests - - - - ./src - - ./src/Views - ./src/Config/Routes.php - - - - - - - - - - - + + + - - - - - - - - - - - - - + diff --git a/admin/starter/phpunit.xml.dist b/admin/starter/phpunit.xml.dist index eee842937bdb..306a46cf4324 100644 --- a/admin/starter/phpunit.xml.dist +++ b/admin/starter/phpunit.xml.dist @@ -1,60 +1,46 @@ - + + + + ./app + + + ./app/Views + ./app/Config/Routes.php + + + + + + + + ./tests - - - - ./app - - ./app/Views - ./app/Config/Routes.php - - - - - - - - - - - + + + - - - - - - - - - - - - - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 45b16af2a614..3fef011ae043 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,24 @@ - + + + + ./system + + + ./system/Commands/Generators/Views + ./system/Debug/Toolbar/Views + ./system/Pager/Views + ./system/ThirdParty + ./system/Validation/Views + ./system/bootstrap.php + ./system/ComposerScripts.php + ./system/Config/Routes.php + ./system/Test/bootstrap.php + + + + + ./tests/system @@ -18,38 +28,14 @@ ./tests/system/Database - - - - ./system - - ./system/Commands/Generators/Views - ./system/Debug/Toolbar/Views - ./system/Pager/Views - ./system/ThirdParty - ./system/Validation/Views - ./system/bootstrap.php - ./system/ComposerScripts.php - ./system/Config/Routes.php - ./system/Test/bootstrap.php - - - - - - - - + - - - From 38efd6cc648aa12c706ade1091494d198f0c1fcb Mon Sep 17 00:00:00 2001 From: MGatner Date: Fri, 30 Oct 2020 18:49:38 +0000 Subject: [PATCH 06/20] Update various references to 7.2 --- CONTRIBUTING.md | 2 +- README.md | 2 +- Vagrantfile.dist | 6 +++--- admin/framework/README.md | 2 +- admin/starter/.github/workflows/phpunit.yml | 10 +++++----- admin/starter/README.md | 2 +- admin/userguide/composer.json | 2 +- system/Commands/Server/Serve.php | 7 +++++++ user_guide_src/source/installation/running.rst | 4 ++-- user_guide_src/source/installation/upgrade_4xx.rst | 2 +- user_guide_src/source/intro/requirements.rst | 2 +- 11 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16ce17f31a96..600d42940dfa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ If you change anything that requires a change to documentation, then you will ne ### Compatibility -CodeIgniter4 requires [PHP 7.2](https://php.net/releases/7_2_0.php). +CodeIgniter4 requires [PHP 7.3](https://php.net/releases/7_3_0.php). ### Branching diff --git a/README.md b/README.md index eb143b09d407..5d9d007b91e2 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/ ## Server Requirements -PHP version 7.2 or higher is required, with the following extensions installed: +PHP version 7.3 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) diff --git a/Vagrantfile.dist b/Vagrantfile.dist index d98a5bbddab0..7a549bdab10b 100644 --- a/Vagrantfile.dist +++ b/Vagrantfile.dist @@ -50,7 +50,7 @@ Vagrant.configure("2") do |config| PGSQL_ROOT_PASS="password" VIRTUALHOST="localhost" CODEIGNITER_PATH="/var/www/codeigniter" - PHP_VERSION=7.2 + PHP_VERSION=7.3 PGSQL_VERSION=10 #APT_PROXY="192.168.10.1:3142" @@ -164,8 +164,8 @@ Vagrant.configure("2") do |config| sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=vagrant/" /etc/apache2/envvars sed -i "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=vagrant/" /etc/apache2/envvars grep -q "Listen 81" /etc/apache2/ports.conf || sed -i "s/^Listen 80/Listen 80\\nListen 81\\nListen 82/" /etc/apache2/ports.conf - sed -i "s/^display_errors = Off/display_errors = On/" /etc/php/7.2/apache2/php.ini - sed -i "s/^display_startup_errors = Off/display_startup_errors = On/" /etc/php/7.2/apache2/php.ini + sed -i "s/^display_errors = Off/display_errors = On/" /etc/php/7.3/apache2/php.ini + sed -i "s/^display_startup_errors = Off/display_startup_errors = On/" /etc/php/7.3/apache2/php.ini echo "ServerName ${VIRTUALHOST} diff --git a/admin/framework/README.md b/admin/framework/README.md index 6692596bd02e..3dcd3b5c73fb 100644 --- a/admin/framework/README.md +++ b/admin/framework/README.md @@ -43,7 +43,7 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/ ## Server Requirements -PHP version 7.2 or higher is required, with the following extensions installed: +PHP version 7.3 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library diff --git a/admin/starter/.github/workflows/phpunit.yml b/admin/starter/.github/workflows/phpunit.yml index 1e647e08c4c9..5e37bd91e504 100644 --- a/admin/starter/.github/workflows/phpunit.yml +++ b/admin/starter/.github/workflows/phpunit.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php-versions: ['7.2', '7.3', '7.4'] + php-versions: ['7.3', '7.4'] runs-on: ubuntu-latest @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v2 - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} tools: composer, pecl, phpunit @@ -34,14 +34,14 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache composer dependencies - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader + run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader # To prevent rate limiting you may need to supply an OAuth token in Settings > Secrets # env: # https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens diff --git a/admin/starter/README.md b/admin/starter/README.md index 6bde1ffd4113..41ce92110d7a 100644 --- a/admin/starter/README.md +++ b/admin/starter/README.md @@ -50,7 +50,7 @@ Problems with it can be raised on our forum, or as issues in the main repository ## Server Requirements -PHP version 7.2 or higher is required, with the following extensions installed: +PHP version 7.3 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library diff --git a/admin/userguide/composer.json b/admin/userguide/composer.json index 3562f47a2abb..198450876c89 100644 --- a/admin/userguide/composer.json +++ b/admin/userguide/composer.json @@ -5,7 +5,7 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3||^8.0", "codeigniter4/framework": "^4" }, "support": { diff --git a/system/Commands/Server/Serve.php b/system/Commands/Server/Serve.php index 034957c340d2..cbcda32dd189 100644 --- a/system/Commands/Server/Serve.php +++ b/system/Commands/Server/Serve.php @@ -23,6 +23,13 @@ */ class Serve extends BaseCommand { + /** + * Minimum PHP version + * + * @var string + */ + protected $minPHPVersion = '7.3'; + /** * Group * diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 32f02689caf0..6ff82f119a36 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -93,7 +93,7 @@ configuration file, e.g., ``apache2/conf/httpd.conf``:: Also make sure that the default document root's element enables this too, in the "AllowOverride" setting:: - + Options Indexes FollowSymLinks AllowOverride All Require all granted @@ -120,7 +120,7 @@ Add a element for your webapp inside the virtual hosting configura e.g., ``apache2/conf/extra/httpd-vhost.conf``:: - DocumentRoot "/opt/lamp7.2/apache2/htdocs/myproject/public" + DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public" ServerName myproject.local ErrorLog "logs/myproject-error_log" CustomLog "logs/myproject-access_log" common diff --git a/user_guide_src/source/installation/upgrade_4xx.rst b/user_guide_src/source/installation/upgrade_4xx.rst index d9846dfb008c..66a4ebab14ca 100644 --- a/user_guide_src/source/installation/upgrade_4xx.rst +++ b/user_guide_src/source/installation/upgrade_4xx.rst @@ -30,7 +30,7 @@ subforum for an up-to-date list! **Namespaces** -- CI4 is built for PHP7.2+, and everything in the framework is namespaced, except for the helpers. +- CI4 is built for PHP7.3+, and everything in the framework is namespaced, except for the helpers. **Application Structure** diff --git a/user_guide_src/source/intro/requirements.rst b/user_guide_src/source/intro/requirements.rst index 6e7a7cdcd6f4..88516f7de355 100644 --- a/user_guide_src/source/intro/requirements.rst +++ b/user_guide_src/source/intro/requirements.rst @@ -2,7 +2,7 @@ Server Requirements ################### -`PHP `_ version 7.2 or newer is required, with the +`PHP `_ version 7.3 or newer is required, with the `*intl* extension `_ and `*mbstring* extension `_ installed. From 385ba182e10b448d851df48a26ce47db410e9a68 Mon Sep 17 00:00:00 2001 From: MGatner Date: Fri, 30 Oct 2020 19:33:12 +0000 Subject: [PATCH 07/20] Improve XML formatting --- admin/framework/phpunit.xml.dist | 13 ++++++++++++- admin/module/phpunit.xml.dist | 13 ++++++++++++- admin/starter/phpunit.xml.dist | 13 ++++++++++++- phpunit.xml.dist | 13 ++++++++++++- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/admin/framework/phpunit.xml.dist b/admin/framework/phpunit.xml.dist index ea2a1afc889f..51c5fddc530b 100644 --- a/admin/framework/phpunit.xml.dist +++ b/admin/framework/phpunit.xml.dist @@ -1,5 +1,16 @@ - + ./app diff --git a/admin/module/phpunit.xml.dist b/admin/module/phpunit.xml.dist index f5b3540f40b6..39d1dd2dde54 100644 --- a/admin/module/phpunit.xml.dist +++ b/admin/module/phpunit.xml.dist @@ -1,5 +1,16 @@ - + ./src diff --git a/admin/starter/phpunit.xml.dist b/admin/starter/phpunit.xml.dist index 306a46cf4324..df6a6259f73e 100644 --- a/admin/starter/phpunit.xml.dist +++ b/admin/starter/phpunit.xml.dist @@ -1,5 +1,16 @@ - + ./app diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3fef011ae043..16445adb23a4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,16 @@ - + ./system From 6986be3f3c336c1a28ac636db38f3fab10dc4a8e Mon Sep 17 00:00:00 2001 From: MGatner Date: Fri, 30 Oct 2020 19:33:28 +0000 Subject: [PATCH 08/20] Fix additional ersion reference --- public/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 127780da57e0..5cea047c8531 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,7 @@ Date: Fri, 30 Oct 2020 19:33:40 +0000 Subject: [PATCH 09/20] Fix toctree --- user_guide_src/source/changelogs/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index 7eb41677871d..728d23d56d73 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,7 +12,6 @@ See all the changes. .. toctree:: :titlesonly: - next v4.1.0 v4.0.5 v4.0.4 From b3c9e0e0ef9446a10b00394d62b087445251d892 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 1 Nov 2020 21:21:44 +0700 Subject: [PATCH 10/20] [4.1] Remove Skip UnderscoreToCamelCaseVariableNameRector for Autoloader.php file Previously, in `develop`, it skipped due conflict with deprecated code. In 4.1, deprecated code is removed. --- rector.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rector.php b/rector.php index beddde1cf6f5..000514167398 100644 --- a/rector.php +++ b/rector.php @@ -29,13 +29,6 @@ // auto import fully qualified class names $parameters->set(Option::AUTO_IMPORT_NAMES, true); - - $parameters->set(Option::SKIP, [ - // skipped for UnderscoreToCamelCaseVariableNameRector rule - // as the underscored variable removed in 4.1 branch - UnderscoreToCamelCaseVariableNameRector::class => [__DIR__ . '/system/Autoloader/Autoloader.php'], - ]); - $parameters->set(Option::ENABLE_CACHE, true); $parameters->set(Option::PHP_VERSION_FEATURES, '7.2'); From c5d0d13eb1d1af4dbfb01dadc6fc595d912cd33c Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 7 Nov 2020 00:16:45 +0800 Subject: [PATCH 11/20] Change deprecated assertFileNotExists --- tests/system/Commands/ClearDebugbarTest.php | 4 ++-- tests/system/Commands/ClearLogsTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/Commands/ClearDebugbarTest.php b/tests/system/Commands/ClearDebugbarTest.php index f69606406e15..588634f3b4b9 100644 --- a/tests/system/Commands/ClearDebugbarTest.php +++ b/tests/system/Commands/ClearDebugbarTest.php @@ -43,7 +43,7 @@ protected function createDummyDebugbarJson() public function testClearDebugbarWorks() { // test clean debugbar dir - $this->assertFileNotExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json"); + $this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json"); // test dir is now populated with json $this->createDummyDebugbarJson(); @@ -52,7 +52,7 @@ public function testClearDebugbarWorks() command('debugbar:clear'); $result = CITestStreamFilter::$buffer; - $this->assertFileNotExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json"); + $this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json"); $this->assertFileExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . '.gitkeep'); $this->assertStringContainsString('Debugbar cleared.', $result); } diff --git a/tests/system/Commands/ClearLogsTest.php b/tests/system/Commands/ClearLogsTest.php index 866fe309e1fa..302a3eef2038 100644 --- a/tests/system/Commands/ClearLogsTest.php +++ b/tests/system/Commands/ClearLogsTest.php @@ -47,7 +47,7 @@ protected function createDummyLogFiles() public function testClearLogsWorks() { // test clean logs dir - $this->assertFileNotExists(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$this->date}.log"); + $this->assertFileDoesNotExist(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$this->date}.log"); // test dir is now populated with logs $this->createDummyLogFiles(); @@ -56,7 +56,7 @@ public function testClearLogsWorks() command('logs:clear -force'); $result = CITestStreamFilter::$buffer; - $this->assertFileNotExists(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$this->date}.log"); + $this->assertFileDoesNotExist(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$this->date}.log"); $this->assertFileExists(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . 'index.html'); $this->assertStringContainsString('Logs cleared.', $result); } From 5cbe17319327a73b7d72283327cd46f027194b66 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 5 Jan 2021 02:10:45 +0700 Subject: [PATCH 12/20] [Static Analysis] Use Rector 0.9 for 4.1 branch with php version feature 7.3 --- composer.json | 2 +- rector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9516cd3901c4..a845905efa5c 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", - "rector/rector": "^0.8", + "rector/rector": "^0.9", "squizlabs/php_codesniffer": "^3.3" }, "suggest": { diff --git a/rector.php b/rector.php index 000514167398..ca01fb29bdca 100644 --- a/rector.php +++ b/rector.php @@ -30,7 +30,7 @@ // auto import fully qualified class names $parameters->set(Option::AUTO_IMPORT_NAMES, true); $parameters->set(Option::ENABLE_CACHE, true); - $parameters->set(Option::PHP_VERSION_FEATURES, '7.2'); + $parameters->set(Option::PHP_VERSION_FEATURES, '7.3'); $services = $containerConfigurator->services(); $services->set(UnderscoreToCamelCaseVariableNameRector::class); From 3887a7849c51757829770e9edc0e2c59fbc45654 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 5 Jan 2021 22:16:43 +0700 Subject: [PATCH 13/20] use Option::SKIP --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index ca01fb29bdca..123a2250b8d0 100644 --- a/rector.php +++ b/rector.php @@ -15,7 +15,7 @@ $parameters->set(Option::PATHS, [__DIR__ . '/app', __DIR__ . '/system']); // is there a file you need to skip? - $parameters->set(Option::EXCLUDE_PATHS, [ + $parameters->set(Option::SKIP, [ __DIR__ . '/app/Views', __DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php', __DIR__ . '/system/ThirdParty', From f412df05469da9d532dd674a32841a9d0ba2f449 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 5 Jan 2021 02:19:28 +0700 Subject: [PATCH 14/20] syntax update for getDefinition() -> getRuleDefinition() --- .../Rector/PassStrictParameterToFunctionParameterRector.php | 6 +++--- utils/Rector/UnderscoreToCamelCaseVariableNameRector.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/Rector/PassStrictParameterToFunctionParameterRector.php b/utils/Rector/PassStrictParameterToFunctionParameterRector.php index c37430a73de6..4e2b4f5315b8 100644 --- a/utils/Rector/PassStrictParameterToFunctionParameterRector.php +++ b/utils/Rector/PassStrictParameterToFunctionParameterRector.php @@ -11,7 +11,7 @@ use PhpParser\Node\Name; use Rector\Core\Rector\AbstractRector; use Rector\Core\RectorDefinition\CodeSample; -use Rector\Core\RectorDefinition\RectorDefinition; +use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** * Pass strict to function parameter on specific position argument when no value provided @@ -25,9 +25,9 @@ final class PassStrictParameterToFunctionParameterRector extends AbstractRector 'in_array' => 2, ]; - public function getDefinition(): RectorDefinition + public function getRuleDefinition(): RuleDefinition { - return new RectorDefinition('Pass strict to function parameter on specific position argument when no value provided', [ + return new RuleDefinition('Pass strict to function parameter on specific position argument when no value provided', [ new CodeSample('array_search($value, $array);', 'array_search($value, $array, true);'), new CodeSample('base64_decode($string);', 'base64_decode($string, true);'), new CodeSample("in_array('a', \$array);", "in_array('a', \$array, true);"), diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index 20cce4abeb03..a1f556641a98 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -13,7 +13,7 @@ use Rector\Core\Php\ReservedKeywordAnalyzer; use Rector\Core\Rector\AbstractRector; use Rector\Core\RectorDefinition\CodeSample; -use Rector\Core\RectorDefinition\RectorDefinition; +use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Rector\Core\Util\StaticRectorStrings; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -48,9 +48,9 @@ public function __construct( $this->reservedKeywordAnalyzer = $reservedKeywordAnalyzer; } - public function getDefinition(): RectorDefinition + public function getRuleDefinition(): RuleDefinition { - return new RectorDefinition('Change under_score names to camelCase', [ + return new RuleDefinition('Change under_score names to camelCase', [ new CodeSample( <<<'CODE_SAMPLE' final class SomeClass From 5084adaa07b58f7e9b443d23dfc18ae9e6108ac3 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 5 Jan 2021 22:17:26 +0700 Subject: [PATCH 15/20] cs fix --- utils/Rector/UnderscoreToCamelCaseVariableNameRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index a1f556641a98..a43da3edf4a1 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -13,9 +13,9 @@ use Rector\Core\Php\ReservedKeywordAnalyzer; use Rector\Core\Rector\AbstractRector; use Rector\Core\RectorDefinition\CodeSample; -use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Rector\Core\Util\StaticRectorStrings; use Rector\NodeTypeResolver\Node\AttributeKey; +use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** * Adapted from https://github.com/rectorphp/rector/blob/4578e6d8490c1acfbf59bb17c4537a672fa77193/rules/naming/src/Rector/Variable/UnderscoreToCamelCaseVariableNameRector.php From ea8396abfffe1fc14778a7120371050fa0946f95 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 5 Jan 2021 22:20:17 +0700 Subject: [PATCH 16/20] run rector --- system/CodeIgniter.php | 7 ++++--- system/Database/Seeder.php | 2 +- system/Filters/CSRF.php | 4 ++-- system/HTTP/DownloadResponse.php | 2 -- system/Helpers/url_helper.php | 4 ++-- system/Pager/Pager.php | 6 +++--- system/Pager/PagerInterface.php | 5 +++-- system/Pager/PagerRenderer.php | 4 +++- system/Pager/Views/default_full.php | 5 +++-- system/Pager/Views/default_head.php | 6 ++++-- system/Pager/Views/default_simple.php | 6 ++++-- system/RESTful/BaseResource.php | 1 - system/Security/Security.php | 1 - system/Test/CIDatabaseTestCase.php | 3 ++- system/Test/bootstrap.php | 3 ++- system/bootstrap.php | 9 +++++---- 16 files changed, 38 insertions(+), 30 deletions(-) diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 38e99ca38b26..43d8b78bad66 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -18,13 +18,14 @@ use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\DownloadResponse; -use CodeIgniter\HTTP\RedirectResponse; +use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Request; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\URI; use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\RouteCollectionInterface; +use CodeIgniter\Router\Router; use Config\App; use Config\Cache; use Config\Services; @@ -76,7 +77,7 @@ class CodeIgniter /** * Current request. * - * @var Request|HTTP\IncomingRequest|CLIRequest + * @var Request|IncomingRequest|CLIRequest */ protected $request; @@ -90,7 +91,7 @@ class CodeIgniter /** * Router to use. * - * @var Router\Router + * @var Router */ protected $router; diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index e8e56e18cb0d..4e9b2a7b266f 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -67,7 +67,7 @@ class Seeder /** * Faker Generator instance. * - * @var \Faker\Generator|null + * @var Generator|null */ private static $faker; diff --git a/system/Filters/CSRF.php b/system/Filters/CSRF.php index 4d767f7059e2..254d1f88c783 100644 --- a/system/Filters/CSRF.php +++ b/system/Filters/CSRF.php @@ -13,6 +13,7 @@ use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Security\Exceptions\SecurityException; use Config\Services; @@ -67,12 +68,11 @@ public function before(RequestInterface $request, $arguments = null) } //-------------------------------------------------------------------- - /** * We don't have anything to do here. * * @param RequestInterface|IncomingRequest $request - * @param ResponseInterface|\CodeIgniter\HTTP\Response $response + * @param ResponseInterface|Response $response * @param array|null $arguments * * @return mixed diff --git a/system/HTTP/DownloadResponse.php b/system/HTTP/DownloadResponse.php index b2df5f7c9e64..5787772da4da 100644 --- a/system/HTTP/DownloadResponse.php +++ b/system/HTTP/DownloadResponse.php @@ -14,8 +14,6 @@ use CodeIgniter\Exceptions\DownloadException; use CodeIgniter\Files\File; use Config\Mimes; -use DateTime; -use DateTimeZone; /** * HTTP response when a download is requested. diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index ebaebbaf030e..167109543f9a 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -132,7 +132,7 @@ function base_url($uri = '', string $protocol = null): string * * @param boolean $returnObject True to return an object instead of a strong * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ function current_url(bool $returnObject = false) { @@ -212,7 +212,7 @@ function uri_string(bool $relative = false): string * * Returns the "index_page" from your config file * - * @param \Config\App|null $altConfig Alternate configuration to use + * @param App|null $altConfig Alternate configuration to use * @return string */ function index_page(App $altConfig = null): string diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index 52aa9ebfaa82..3220d127e7e5 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -12,6 +12,7 @@ namespace CodeIgniter\Pager; use CodeIgniter\HTTP\Exceptions\HTTPException; +use CodeIgniter\HTTP\URI; use CodeIgniter\Pager\Exceptions\PagerException; use CodeIgniter\View\RendererInterface; use Config\Pager as PagerConfig; @@ -335,7 +336,6 @@ public function getFirstPage(string $group = 'default'): int } //-------------------------------------------------------------------- - /** * Returns the URI for a specific page for the specified group. * @@ -343,14 +343,14 @@ public function getFirstPage(string $group = 'default'): int * @param string $group * @param boolean $returnObject * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ public function getPageURI(int $page = null, string $group = 'default', bool $returnObject = false) { $this->ensureGroup($group); /** - * @var \CodeIgniter\HTTP\URI $uri + * @var URI $uri */ $uri = $this->groups[$group]['uri']; diff --git a/system/Pager/PagerInterface.php b/system/Pager/PagerInterface.php index 68406519fc14..0b06ef81fc60 100644 --- a/system/Pager/PagerInterface.php +++ b/system/Pager/PagerInterface.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Pager; +use CodeIgniter\HTTP\URI; + /** * Expected behavior for a Pager */ @@ -103,7 +105,6 @@ public function getPageCount(string $group = 'default'): int; public function getCurrentPage(string $group = 'default'): int; //-------------------------------------------------------------------- - /** * Returns the URI for a specific page for the specified group. * @@ -111,7 +112,7 @@ public function getCurrentPage(string $group = 'default'): int; * @param string $group * @param boolean $returnObject * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ public function getPageURI(int $page = null, string $group = 'default', bool $returnObject = false); diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index 01caa3378c50..ab1303182f01 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Pager; +use CodeIgniter\HTTP\URI; + /** * Class PagerRenderer * @@ -58,7 +60,7 @@ class PagerRenderer /** * URI base for pagination links * - * @var \CodeIgniter\HTTP\URI + * @var URI */ protected $uri; diff --git a/system/Pager/Views/default_full.php b/system/Pager/Views/default_full.php index ef446e99c8f9..0001143c6980 100644 --- a/system/Pager/Views/default_full.php +++ b/system/Pager/Views/default_full.php @@ -1,9 +1,10 @@ setSurroundCount(2); ?> diff --git a/system/Pager/Views/default_head.php b/system/Pager/Views/default_head.php index 4f916013e023..edeb092c59de 100644 --- a/system/Pager/Views/default_head.php +++ b/system/Pager/Views/default_head.php @@ -9,8 +9,10 @@ * file that was distributed with this source code. */ -/** - * @var \CodeIgniter\Pager\PagerRenderer $pager +use CodeIgniter\Pager\PagerRenderer; + + /** + * @var PagerRenderer $pager */ $pager->setSurroundCount(0); diff --git a/system/Pager/Views/default_simple.php b/system/Pager/Views/default_simple.php index 3bfa8d9d6b36..fc00ce88e1e5 100644 --- a/system/Pager/Views/default_simple.php +++ b/system/Pager/Views/default_simple.php @@ -1,8 +1,10 @@ setSurroundCount(0); ?>