From 2f7bb68e439e32731de6ce3d71978534a1d69205 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Wed, 15 Dec 2021 17:13:58 +0100 Subject: [PATCH 01/42] Unify templated files A lot of files are identical throughout the different packages. This is the base for unifying them for easier handling. --- .appveyor.yml | 61 +++++++++++++++++++++++++++++++++++++++++ .drone.jsonnet | 26 +++--------------- .editorconfig | 9 ++++++ .gitattributes | 11 ++++++-- .github/CONTRIBUTING.md | 2 +- .gitignore | 3 +- phpunit.xml.dist | 24 ++++++++++++---- ruleset.xml | 10 +++++-- 8 files changed, 109 insertions(+), 37 deletions(-) create mode 100644 .appveyor.yml create mode 100644 .editorconfig diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..48b03881 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,61 @@ +build: false +platform: + - x64 +clone_folder: C:\projects\filesystem + +branches: + except: + - gh-pages + +## Build matrix for lowest and highest possible targets +environment: + PHPBuild: "x64" + VC: "vc15" + WINCACHE: "2.0.0.8" + matrix: + - php_ver_target: 5.3.10 + - php_ver_target: 5.3.29 + - php_ver_target: 5.4.45 + - php_ver_target: 7.0.33 + - php_ver_target: 7.1.33 + - php_ver_target: 7.2.34 + - php_ver_target: 7.3.33 + - php_ver_target: 7.4.26 + - php_ver_target: 8.0.13 + +init: + - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% + - SET COMPOSER_NO_INTERACTION=1 + - SET PHP=1 # This var relates to caching the php install + - SET ANSICON=121x90 (121x90) + +## Install PHP and composer, and run the appropriate composer command +install: + - IF EXIST C:\tools\php (SET PHP=0) + - ps: >- + If ($env:PHP -eq "1") { + appveyor-retry cinst php --version=$env:php_ver_target --package-parameters='""/InstallDir:C:\tools\php""' --ignore-checksums -y --no-progress --limit-output + } + - cd C:\tools\php + - IF %PHP%==1 copy php.ini-production php.ini /Y + - IF %PHP%==1 echo date.timezone="UTC" >> php.ini + - IF %PHP%==1 echo extension_dir=ext >> php.ini + - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini + - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini + - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini + - IF %PHP%==1 echo extension=php_ftp.dll >> php.ini + - IF %PHP%==1 echo extension=php_gd2.dll >> php.ini + - IF %PHP%==1 echo extension=php_gmp.dll >> php.ini + - IF %PHP%==1 echo extension=php_pgsql.dll >> php.ini + - IF %PHP%==1 echo extension=php_curl.dll >> php.ini + - IF %PHP%==1 echo zend_extension=php_opcache.dll >> php.ini + - IF %PHP%==1 echo opcache.enable_cli=1 >> php.ini + - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat + - IF %PHP%==1 php -r "readfile('http://getcomposer.org/installer');" | php + - cd C:\projects\filesystem + - IF NOT %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress + - IF %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress --ignore-platform-req=php + +test_script: + - cd C:\projects\filesystem + - vendor\bin\phpunit diff --git a/.drone.jsonnet b/.drone.jsonnet index 849dac07..59835fc5 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -18,8 +18,7 @@ local composer(phpversion, params) = { volumes: volumes, commands: [ "php -v", - "composer --version", - "composer update " + params, + "composer update " + params ] }; @@ -52,7 +51,7 @@ local pipeline(name, phpversion, params) = { volumes: volumes, commands: [ "php -v", - "composer update", + "composer update --prefer-stable", "composer require phpmd/phpmd phpstan/phpstan" ] }, @@ -107,24 +106,7 @@ local pipeline(name, phpversion, params) = { } ] }, - { - kind: "pipeline", - name: "PHP 5.3 lowest", - volumes: hostvolumes, - steps: [ - { - name: "composer", - image: "joomlaprojects/docker-images:php5.3", - volumes: volumes, - commands: [ - "php -v", - "composer update --prefer-stable --prefer-lowest", - "composer update phpunit/phpunit-mock-objects" - ] - }, - phpunit("5.3") - ] - }, + pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"), pipeline("5.3", "5.3", "--prefer-stable"), pipeline("5.4", "5.4", "--prefer-stable"), pipeline("5.5", "5.5", "--prefer-stable"), @@ -134,5 +116,5 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs --prefer-stable") + pipeline("8.0", "8.0", "--ignore-platform-reqs") ] diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c8bb3e7b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# Unix-style newlines with a newline ending every file +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitattributes b/.gitattributes index bfb8d891..970e6040 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,10 @@ +.github/ export-ignore +docs/ export-ignore +Tests/ export-ignore +.appveyor.yml export-ignore +.drone.jsonnet export-ignore +.drone.yml export-ignore .gitattributes export-ignore .gitignore export-ignore -.gitmodules export-ignore -.travis/ export-ignore -.travis.yml export-ignore +phpunit.xml.dist export-ignore +ruleset.xml export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 368ba80a..e026a0cc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,3 +1,3 @@ # Contributing to the Joomla! Framework -Please review [http://framework.joomla.org/contribute](http://framework.joomla.org/contribute) for information on how to contribute to the Framework's development. +Please review [https://framework.joomla.org/contribute](https://framework.joomla.org/contribute) for information on how to contribute to the Framework's development. diff --git a/.gitignore b/.gitignore index f432fce7..76367ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ vendor/ -composer.phar composer.lock phpunit.xml -.idea/ +.phpunit.result.cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f867589b..1cbc2d1b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,25 @@ - - - src/phputf8 - - - Tests + tests + + + + + + + + + + src + + diff --git a/ruleset.xml b/ruleset.xml index d9f24b82..832ac7e3 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -11,11 +11,15 @@ */.github/* - */src/phputf8/* */vendor/* - - + + + + + + + From 6cfddd0b1e990c4c71b634efab6e75f4e22e872d Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Wed, 15 Dec 2021 19:26:06 +0100 Subject: [PATCH 02/42] Adjust tests path Some packages use 'tests' as tests directory, while other use 'Tests'. The reference in phpunit.xml.dist is adjusted accordingly. --- phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1cbc2d1b..990cf8cf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ - tests + Tests From 57a837fdc4dd2aa027f0598c3e24bd0089007d5b Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 00:08:44 +0100 Subject: [PATCH 03/42] Build: Ignore PHP 5.4 and 5.5 The images used for tests with these versions have problems with using composer (giving curl error 60), so they are removed for now, until a solution is found. --- .drone.jsonnet | 2 -- 1 file changed, 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 59835fc5..1c265dda 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -108,8 +108,6 @@ local pipeline(name, phpversion, params) = { }, pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"), pipeline("5.3", "5.3", "--prefer-stable"), - pipeline("5.4", "5.4", "--prefer-stable"), - pipeline("5.5", "5.5", "--prefer-stable"), pipeline("5.6", "5.6", "--prefer-stable"), pipeline("7.0", "7.0", "--prefer-stable"), pipeline("7.1", "7.1", "--prefer-stable"), From 0b14aeeaa84cd44f57fe4d33d9eff1d6135a825d Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 14:47:13 +0100 Subject: [PATCH 04/42] Add drone credentials Used for signing the generated .drone.yml file Generate .drone.yml --- .drone.yml | 73 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0a0c59c6..2bc002f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - php -v - - composer update + - composer update --prefer-stable - composer require phpmd/phpmd phpstan/phpstan volumes: - name: composer-cache @@ -70,7 +70,6 @@ steps: commands: - php -v - composer update --prefer-stable --prefer-lowest - - composer update phpunit/phpunit-mock-objects volumes: - name: composer-cache path: /tmp/composer-cache @@ -98,7 +97,6 @@ steps: image: joomlaprojects/docker-images:php5.3 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -114,64 +112,6 @@ volumes: host: path: /tmp/composer-cache ---- -kind: pipeline -name: PHP 5.4 - -platform: - os: linux - arch: amd64 - -steps: -- name: composer - image: joomlaprojects/docker-images:php5.4 - commands: - - php -v - - composer --version - - composer update --prefer-stable - volumes: - - name: composer-cache - path: /tmp/composer-cache - -- name: PHPUnit - image: joomlaprojects/docker-images:php5.4 - commands: - - vendor/bin/phpunit - -volumes: -- name: composer-cache - host: - path: /tmp/composer-cache - ---- -kind: pipeline -name: PHP 5.5 - -platform: - os: linux - arch: amd64 - -steps: -- name: composer - image: joomlaprojects/docker-images:php5.5 - commands: - - php -v - - composer --version - - composer update --prefer-stable - volumes: - - name: composer-cache - path: /tmp/composer-cache - -- name: PHPUnit - image: joomlaprojects/docker-images:php5.5 - commands: - - vendor/bin/phpunit - -volumes: -- name: composer-cache - host: - path: /tmp/composer-cache - --- kind: pipeline name: PHP 5.6 @@ -185,7 +125,6 @@ steps: image: joomlaprojects/docker-images:php5.6 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -214,7 +153,6 @@ steps: image: joomlaprojects/docker-images:php7.0 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -243,7 +181,6 @@ steps: image: joomlaprojects/docker-images:php7.1 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -272,7 +209,6 @@ steps: image: joomlaprojects/docker-images:php7.2 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -301,7 +237,6 @@ steps: image: joomlaprojects/docker-images:php7.3 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -330,7 +265,6 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -359,8 +293,7 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - php -v - - composer --version - - composer update --ignore-platform-reqs --prefer-stable + - composer update --ignore-platform-reqs volumes: - name: composer-cache path: /tmp/composer-cache @@ -378,6 +311,6 @@ volumes: --- kind: signature -hmac: b33ff1875a669dbf7ce59daaab139a1c7c46ecb03f9e03790046649bf39c44f5 +hmac: 0082d51e1a69c2d10206ba26c464f046f50b86a1f178b2b56057455c5200c412 ... From cf3f5dbf55928060e60aa37397907237bf1bf1d4 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 17:17:30 +0100 Subject: [PATCH 05/42] Build: Special treatment of 5.3-lowest There's a bug in the lowest possible version of phpunit/phpunit-mock-objects. Therefore, that dependency gets updated separately. --- .drone.jsonnet | 19 ++++++++++++++++++- .drone.yml | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 1c265dda..5742e4fa 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -106,7 +106,24 @@ local pipeline(name, phpversion, params) = { } ] }, - pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"), + { + kind: "pipeline", + name: "PHP 5.3 lowest", + volumes: hostvolumes, + steps: [ + { + name: "composer", + image: "joomlaprojects/docker-images:php5.3", + volumes: volumes, + commands: [ + "php -v", + "composer update --prefer-stable --prefer-lowest", + "composer update phpunit/phpunit-mock-objects" + ] + }, + phpunit("5.3") + ] + }, pipeline("5.3", "5.3", "--prefer-stable"), pipeline("5.6", "5.6", "--prefer-stable"), pipeline("7.0", "7.0", "--prefer-stable"), diff --git a/.drone.yml b/.drone.yml index 2bc002f0..b1adbe3b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -70,6 +70,7 @@ steps: commands: - php -v - composer update --prefer-stable --prefer-lowest + - composer update phpunit/phpunit-mock-objects volumes: - name: composer-cache path: /tmp/composer-cache @@ -311,6 +312,6 @@ volumes: --- kind: signature -hmac: 0082d51e1a69c2d10206ba26c464f046f50b86a1f178b2b56057455c5200c412 +hmac: 9c691184d1612fad2f2dd38a7ae15c198020514ce42d80b0ec12b9a01ab772a7 ... From a44cf27a75326d3d6f1781fc40e0db5b49e17078 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 20:13:29 +0100 Subject: [PATCH 06/42] Style: Loosen the constraint to respect naming conventions The public API contains methods being named _ (e.g., joomla/language) Some libraries and APIs use snake case names, causing code style checker to complain. --- ruleset.xml | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/ruleset.xml b/ruleset.xml index 832ac7e3..34c26fa5 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -1,25 +1,30 @@ - - - - - + + + + + - - */.github/* + + */.github/* - - */vendor/* + + */vendor/* - - - + + + + + + + + - - - - - + + + + + From 1bf8fd225bed7559a0b93e384a66fb702ffdf3fe Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 22:24:43 +0100 Subject: [PATCH 07/42] Build: Introducing loose and strict code style check As some packages irreversibly violate our code style by using underscores in variable and method names, the loose check will let names with underscore pass. This check must pass. The strict check is applied without any exceptions, but allowed to fail, so we still get informed about these violations. --- .drone.jsonnet | 12 +++++++++++- .drone.yml | 11 +++++++++-- ruleset.xml | 4 +++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 5742e4fa..095da6cf 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -56,7 +56,7 @@ local pipeline(name, phpversion, params) = { ] }, { - name: "phpcs", + name: "phpcs (loose)", image: "joomlaprojects/docker-images:php7.4", depends: [ "composer" ], commands: [ @@ -64,6 +64,16 @@ local pipeline(name, phpversion, params) = { "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/" ] }, + { + name: "phpcs (strict)", + image: "joomlaprojects/docker-images:php7.4", + depends: [ "composer" ], + failure: "ignore", + commands: [ + "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", + "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/" + ] + }, { name: "phpmd", image: "joomlaprojects/docker-images:php7.4", diff --git a/.drone.yml b/.drone.yml index b1adbe3b..aeb24c7b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,12 +17,19 @@ steps: - name: composer-cache path: /tmp/composer-cache -- name: phpcs +- name: phpcs (loose) image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/ +- name: phpcs (strict) + image: joomlaprojects/docker-images:php7.4 + commands: + - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards + - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/ + failure: ignore + - name: phpmd image: joomlaprojects/docker-images:php7.4 commands: @@ -312,6 +319,6 @@ volumes: --- kind: signature -hmac: 9c691184d1612fad2f2dd38a7ae15c198020514ce42d80b0ec12b9a01ab772a7 +hmac: 82b534f58acb39d32886791cf77e6b55f855b0a810ebd8dd4477992700ed6994 ... diff --git a/ruleset.xml b/ruleset.xml index 34c26fa5..f571ce1d 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -19,7 +19,9 @@ - + + + From 6437c443de9334310649cd119a900a0df5b95eff Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 22:43:24 +0100 Subject: [PATCH 08/42] Build: Exclude one more rule from loose code style check Joomla.NamingConventions.ValidVariableName.NotCamelCaps was still checked. --- ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ruleset.xml b/ruleset.xml index f571ce1d..626812e3 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -22,6 +22,7 @@ + From 03938700e629e28bc42c133d9340c8ace63fb67d Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:10:58 +0100 Subject: [PATCH 09/42] Build: Don't apply code style check to library The phputf8 library does not follow our code conventions at all. Should be left alone, since it is external. --- .drone.jsonnet | 2 +- .drone.yml | 4 ++-- .mono | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .mono diff --git a/.drone.jsonnet b/.drone.jsonnet index 095da6cf..1535a810 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -61,7 +61,7 @@ local pipeline(name, phpversion, params) = { depends: [ "composer" ], commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php" ] }, { diff --git a/.drone.yml b/.drone.yml index aeb24c7b..5f0f419d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/ + - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php - name: phpcs (strict) image: joomlaprojects/docker-images:php7.4 @@ -319,6 +319,6 @@ volumes: --- kind: signature -hmac: 82b534f58acb39d32886791cf77e6b55f855b0a810ebd8dd4477992700ed6994 +hmac: 88165cd1c0164dea7b77e8a5f467dadee2aa5021a9ac4c2623c406922bf6d459 ... diff --git a/.mono b/.mono new file mode 100644 index 00000000..eb62809b --- /dev/null +++ b/.mono @@ -0,0 +1 @@ +src="Inflector.php Normalise.php String.php StringHelper.php" From 33e46cc16b4fae97059ba4739db74b9e24775bc8 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:35:07 +0100 Subject: [PATCH 10/42] Build: Fix paths The 'src/' prefix was missing --- .drone.jsonnet | 4 ++-- .drone.yml | 6 +++--- .mono | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 1535a810..0f7dda35 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -61,7 +61,7 @@ local pipeline(name, phpversion, params) = { depends: [ "composer" ], commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" ] }, { @@ -71,7 +71,7 @@ local pipeline(name, phpversion, params) = { failure: "ignore", commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" ] }, { diff --git a/.drone.yml b/.drone.yml index 5f0f419d..ff9915f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,13 +21,13 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php + - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php - name: phpcs (strict) image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/ + - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php failure: ignore - name: phpmd @@ -319,6 +319,6 @@ volumes: --- kind: signature -hmac: 88165cd1c0164dea7b77e8a5f467dadee2aa5021a9ac4c2623c406922bf6d459 +hmac: 991f2f86c3455e1c8ae45ec03282982fa7102b7f8fd1b7876e019fe7427499c1 ... diff --git a/.mono b/.mono index eb62809b..da8b9b84 100644 --- a/.mono +++ b/.mono @@ -1 +1 @@ -src="Inflector.php Normalise.php String.php StringHelper.php" +src="src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" From 25c1c87421793782cf2e12eb8ec8e3765cf1a3b1 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:49:28 +0100 Subject: [PATCH 11/42] Build: Check for PHP 8.1 compatibility Since the CMS has expressed a need for PHP 8.1 compatible versions of the packages from Framework 1, compatibility should also be tested. --- .drone.jsonnet | 4 +++- .drone.yml | 31 ++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 0f7dda35..87beccc3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -26,6 +26,7 @@ local phpunit(phpversion) = { name: "PHPUnit", image: "joomlaprojects/docker-images:php" + phpversion, [if phpversion == "8.0" then "failure"]: "ignore", + [if phpversion == "8.1" then "failure"]: "ignore", commands: ["vendor/bin/phpunit"] }; @@ -141,5 +142,6 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs") + pipeline("8.0", "8.0", "--ignore-platform-reqs"), + pipeline("8.1", "8.1", "--ignore-platform-reqs") ] diff --git a/.drone.yml b/.drone.yml index ff9915f0..a088e958 100644 --- a/.drone.yml +++ b/.drone.yml @@ -317,8 +317,37 @@ volumes: host: path: /tmp/composer-cache +--- +kind: pipeline +name: PHP 8.1 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php8.1 + commands: + - php -v + - composer update --ignore-platform-reqs + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: PHPUnit + image: joomlaprojects/docker-images:php8.1 + commands: + - vendor/bin/phpunit + failure: ignore + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + --- kind: signature -hmac: 991f2f86c3455e1c8ae45ec03282982fa7102b7f8fd1b7876e019fe7427499c1 +hmac: 166294199b01095c3f19756d73d1202c40bb4a41fd49d676b0bfc2cc8427c307 ... From 2ed619680e2c319d66a2dbba9e9874770d0f568d Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 01:14:58 +0100 Subject: [PATCH 12/42] Build: Allow newer versions of PHPUnit PHPUnit 6.5 fails on PHP 8.1 --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b15fe4a4..7efdb34c 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,11 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": ["joomla", "framework", "string"], + "keywords": [ + "joomla", + "framework", + "string" + ], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { @@ -11,7 +15,7 @@ "require-dev": { "joomla/coding-standards": "~2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" + "phpunit/phpunit": "^4.8.36|^5.4.3|^6.0|^7.0|^8.0" }, "suggest": { "ext-mbstring": "For improved processing" From e4b3180548b2611d0b6406660cf67a81797e7f76 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 13:12:32 +0100 Subject: [PATCH 13/42] Revert "Build: Allow newer versions of PHPUnit" This reverts commit 27ee84f71de1431043e7248a388c0989042b8b29. --- composer.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 7efdb34c..b15fe4a4 100644 --- a/composer.json +++ b/composer.json @@ -2,11 +2,7 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": [ - "joomla", - "framework", - "string" - ], + "keywords": ["joomla", "framework", "string"], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { @@ -15,7 +11,7 @@ "require-dev": { "joomla/coding-standards": "~2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.36|^5.4.3|^6.0|^7.0|^8.0" + "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" }, "suggest": { "ext-mbstring": "For improved processing" From adc1b24588f64193ea262edfbd12ff9023b0d618 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 13:52:12 +0100 Subject: [PATCH 14/42] Build: Allow PHP 8 and PHPUnit up to version 6 Remove 'ignore-deps' directive from PHP 8 pipelines This is an attempt to find the cause for tests not even being executed under certain, yet unknown, circumstances. --- .drone.jsonnet | 4 ++-- .drone.yml | 6 +++--- composer.json | 12 ++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 87beccc3..56fbad81 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -142,6 +142,6 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs"), - pipeline("8.1", "8.1", "--ignore-platform-reqs") + pipeline("8.0", "8.0", "--prefer-stable"), + pipeline("8.1", "8.1", "--prefer-stable") ] diff --git a/.drone.yml b/.drone.yml index a088e958..a99d73fa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -301,7 +301,7 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - php -v - - composer update --ignore-platform-reqs + - composer update --prefer-stable volumes: - name: composer-cache path: /tmp/composer-cache @@ -330,7 +330,7 @@ steps: image: joomlaprojects/docker-images:php8.1 commands: - php -v - - composer update --ignore-platform-reqs + - composer update --prefer-stable volumes: - name: composer-cache path: /tmp/composer-cache @@ -348,6 +348,6 @@ volumes: --- kind: signature -hmac: 166294199b01095c3f19756d73d1202c40bb4a41fd49d676b0bfc2cc8427c307 +hmac: f3982330baf39b4fcadb07885bb3e18b9906efeb814e4e3077b17220a85358cb ... diff --git a/composer.json b/composer.json index b15fe4a4..ca890926 100644 --- a/composer.json +++ b/composer.json @@ -2,16 +2,20 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": ["joomla", "framework", "string"], + "keywords": [ + "joomla", + "framework", + "string" + ], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { - "php": "^5.3.10|~7.0" + "php": "^5.3.10|^7.0|^8.0" }, "require-dev": { - "joomla/coding-standards": "~2.0@alpha", + "joomla/coding-standards": "^2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" + "phpunit/phpunit": "^4.8.35|^5.4.3|^6.0" }, "suggest": { "ext-mbstring": "For improved processing" From 6ac8e7bd5b8ccd09e22efb888812b899045ff49a Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Sat, 18 Dec 2021 12:51:44 +0100 Subject: [PATCH 15/42] Fix: Test the right thing It is not the PHP version we are interested in, but the existence of the constant. --- src/phputf8/utf8.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/phputf8/utf8.php b/src/phputf8/utf8.php index af8b4127..e498763f 100644 --- a/src/phputf8/utf8.php +++ b/src/phputf8/utf8.php @@ -34,7 +34,7 @@ * Also need to check we have the correct internal mbstring * encoding */ -if ( extension_loaded('mbstring')) { +if (extension_loaded('mbstring')) { /* * Joomla modification - As of PHP 8, the `mbstring.func_overload` configuration has been removed and the * MB_OVERLOAD_STRING constant will no longer be present, so this check only runs for PHP 7 and older @@ -42,9 +42,10 @@ * and https://github.com/php/php-src/commit/97df99a6d7d96a886ac143337fecad775907589a * for additional references */ - if ( PHP_VERSION_ID < 80000 && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { + if (defined('MB_OVERLOAD_STRING') && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING) { trigger_error('String functions are overloaded by mbstring',E_USER_ERROR); } + mb_internal_encoding('UTF-8'); } From 898aaded914bf51805f7ce95570b11801ef92f0c Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Sat, 18 Dec 2021 14:45:46 +0100 Subject: [PATCH 16/42] Tests: Don't use phpunit.xml to provide PHP values The phpunit.xml should only specify values that are required by the test environment. Everything that the tests themselves require should be made available via bootstrap.php. --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 990cf8cf..f5e011a8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ - + + + + src + + diff --git a/ruleset.xml b/ruleset.xml index d9f24b82..832ac7e3 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -11,11 +11,15 @@ */.github/* - */src/phputf8/* */vendor/* - - + + + + + + + From a6638f89a32f1a880d75e1a85143921c736ad303 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Wed, 15 Dec 2021 19:26:06 +0100 Subject: [PATCH 19/42] Adjust tests path Some packages use 'tests' as tests directory, while other use 'Tests'. The reference in phpunit.xml.dist is adjusted accordingly. --- phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1cbc2d1b..990cf8cf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ - tests + Tests From e63924a5379c99082e500a417cdd7b681d991893 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 00:08:44 +0100 Subject: [PATCH 20/42] Build: Ignore PHP 5.4 and 5.5 The images used for tests with these versions have problems with using composer (giving curl error 60), so they are removed for now, until a solution is found. --- .drone.jsonnet | 2 -- 1 file changed, 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 59835fc5..1c265dda 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -108,8 +108,6 @@ local pipeline(name, phpversion, params) = { }, pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"), pipeline("5.3", "5.3", "--prefer-stable"), - pipeline("5.4", "5.4", "--prefer-stable"), - pipeline("5.5", "5.5", "--prefer-stable"), pipeline("5.6", "5.6", "--prefer-stable"), pipeline("7.0", "7.0", "--prefer-stable"), pipeline("7.1", "7.1", "--prefer-stable"), From 40156c249b7b117361171ddc3eef838215b5da17 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 14:47:13 +0100 Subject: [PATCH 21/42] Add drone credentials Used for signing the generated .drone.yml file Generate .drone.yml --- .drone.yml | 73 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0a0c59c6..2bc002f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - php -v - - composer update + - composer update --prefer-stable - composer require phpmd/phpmd phpstan/phpstan volumes: - name: composer-cache @@ -70,7 +70,6 @@ steps: commands: - php -v - composer update --prefer-stable --prefer-lowest - - composer update phpunit/phpunit-mock-objects volumes: - name: composer-cache path: /tmp/composer-cache @@ -98,7 +97,6 @@ steps: image: joomlaprojects/docker-images:php5.3 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -114,64 +112,6 @@ volumes: host: path: /tmp/composer-cache ---- -kind: pipeline -name: PHP 5.4 - -platform: - os: linux - arch: amd64 - -steps: -- name: composer - image: joomlaprojects/docker-images:php5.4 - commands: - - php -v - - composer --version - - composer update --prefer-stable - volumes: - - name: composer-cache - path: /tmp/composer-cache - -- name: PHPUnit - image: joomlaprojects/docker-images:php5.4 - commands: - - vendor/bin/phpunit - -volumes: -- name: composer-cache - host: - path: /tmp/composer-cache - ---- -kind: pipeline -name: PHP 5.5 - -platform: - os: linux - arch: amd64 - -steps: -- name: composer - image: joomlaprojects/docker-images:php5.5 - commands: - - php -v - - composer --version - - composer update --prefer-stable - volumes: - - name: composer-cache - path: /tmp/composer-cache - -- name: PHPUnit - image: joomlaprojects/docker-images:php5.5 - commands: - - vendor/bin/phpunit - -volumes: -- name: composer-cache - host: - path: /tmp/composer-cache - --- kind: pipeline name: PHP 5.6 @@ -185,7 +125,6 @@ steps: image: joomlaprojects/docker-images:php5.6 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -214,7 +153,6 @@ steps: image: joomlaprojects/docker-images:php7.0 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -243,7 +181,6 @@ steps: image: joomlaprojects/docker-images:php7.1 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -272,7 +209,6 @@ steps: image: joomlaprojects/docker-images:php7.2 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -301,7 +237,6 @@ steps: image: joomlaprojects/docker-images:php7.3 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -330,7 +265,6 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - php -v - - composer --version - composer update --prefer-stable volumes: - name: composer-cache @@ -359,8 +293,7 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - php -v - - composer --version - - composer update --ignore-platform-reqs --prefer-stable + - composer update --ignore-platform-reqs volumes: - name: composer-cache path: /tmp/composer-cache @@ -378,6 +311,6 @@ volumes: --- kind: signature -hmac: b33ff1875a669dbf7ce59daaab139a1c7c46ecb03f9e03790046649bf39c44f5 +hmac: 0082d51e1a69c2d10206ba26c464f046f50b86a1f178b2b56057455c5200c412 ... From 8d65a44ff430b984882d98cd18792bba7c572e44 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 17:17:30 +0100 Subject: [PATCH 22/42] Build: Special treatment of 5.3-lowest There's a bug in the lowest possible version of phpunit/phpunit-mock-objects. Therefore, that dependency gets updated separately. --- .drone.jsonnet | 19 ++++++++++++++++++- .drone.yml | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 1c265dda..5742e4fa 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -106,7 +106,24 @@ local pipeline(name, phpversion, params) = { } ] }, - pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"), + { + kind: "pipeline", + name: "PHP 5.3 lowest", + volumes: hostvolumes, + steps: [ + { + name: "composer", + image: "joomlaprojects/docker-images:php5.3", + volumes: volumes, + commands: [ + "php -v", + "composer update --prefer-stable --prefer-lowest", + "composer update phpunit/phpunit-mock-objects" + ] + }, + phpunit("5.3") + ] + }, pipeline("5.3", "5.3", "--prefer-stable"), pipeline("5.6", "5.6", "--prefer-stable"), pipeline("7.0", "7.0", "--prefer-stable"), diff --git a/.drone.yml b/.drone.yml index 2bc002f0..b1adbe3b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -70,6 +70,7 @@ steps: commands: - php -v - composer update --prefer-stable --prefer-lowest + - composer update phpunit/phpunit-mock-objects volumes: - name: composer-cache path: /tmp/composer-cache @@ -311,6 +312,6 @@ volumes: --- kind: signature -hmac: 0082d51e1a69c2d10206ba26c464f046f50b86a1f178b2b56057455c5200c412 +hmac: 9c691184d1612fad2f2dd38a7ae15c198020514ce42d80b0ec12b9a01ab772a7 ... From 73634d053a26a76437a106263399f043fed953cf Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 20:13:29 +0100 Subject: [PATCH 23/42] Style: Loosen the constraint to respect naming conventions The public API contains methods being named _ (e.g., joomla/language) Some libraries and APIs use snake case names, causing code style checker to complain. --- ruleset.xml | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/ruleset.xml b/ruleset.xml index 832ac7e3..34c26fa5 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -1,25 +1,30 @@ - - - - - + + + + + - - */.github/* + + */.github/* - - */vendor/* + + */vendor/* - - - + + + + + + + + - - - - - + + + + + From 5e2eba903a87d55eee8cb1f099f718b54d58751f Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 22:24:43 +0100 Subject: [PATCH 24/42] Build: Introducing loose and strict code style check As some packages irreversibly violate our code style by using underscores in variable and method names, the loose check will let names with underscore pass. This check must pass. The strict check is applied without any exceptions, but allowed to fail, so we still get informed about these violations. --- .drone.jsonnet | 12 +++++++++++- .drone.yml | 11 +++++++++-- ruleset.xml | 4 +++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 5742e4fa..095da6cf 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -56,7 +56,7 @@ local pipeline(name, phpversion, params) = { ] }, { - name: "phpcs", + name: "phpcs (loose)", image: "joomlaprojects/docker-images:php7.4", depends: [ "composer" ], commands: [ @@ -64,6 +64,16 @@ local pipeline(name, phpversion, params) = { "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/" ] }, + { + name: "phpcs (strict)", + image: "joomlaprojects/docker-images:php7.4", + depends: [ "composer" ], + failure: "ignore", + commands: [ + "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", + "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/" + ] + }, { name: "phpmd", image: "joomlaprojects/docker-images:php7.4", diff --git a/.drone.yml b/.drone.yml index b1adbe3b..aeb24c7b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,12 +17,19 @@ steps: - name: composer-cache path: /tmp/composer-cache -- name: phpcs +- name: phpcs (loose) image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/ +- name: phpcs (strict) + image: joomlaprojects/docker-images:php7.4 + commands: + - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards + - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/ + failure: ignore + - name: phpmd image: joomlaprojects/docker-images:php7.4 commands: @@ -312,6 +319,6 @@ volumes: --- kind: signature -hmac: 9c691184d1612fad2f2dd38a7ae15c198020514ce42d80b0ec12b9a01ab772a7 +hmac: 82b534f58acb39d32886791cf77e6b55f855b0a810ebd8dd4477992700ed6994 ... diff --git a/ruleset.xml b/ruleset.xml index 34c26fa5..f571ce1d 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -19,7 +19,9 @@ - + + + From 847f936e5f7504f362ba7b7bf4c39309110319b3 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 22:43:24 +0100 Subject: [PATCH 25/42] Build: Exclude one more rule from loose code style check Joomla.NamingConventions.ValidVariableName.NotCamelCaps was still checked. --- ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ruleset.xml b/ruleset.xml index f571ce1d..626812e3 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -22,6 +22,7 @@ + From 0c8ea30c579f02578a9e6b60d8fb8c8663960649 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:10:58 +0100 Subject: [PATCH 26/42] Build: Don't apply code style check to library The phputf8 library does not follow our code conventions at all. Should be left alone, since it is external. --- .drone.jsonnet | 2 +- .drone.yml | 4 ++-- .mono | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .mono diff --git a/.drone.jsonnet b/.drone.jsonnet index 095da6cf..1535a810 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -61,7 +61,7 @@ local pipeline(name, phpversion, params) = { depends: [ "composer" ], commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php" ] }, { diff --git a/.drone.yml b/.drone.yml index aeb24c7b..5f0f419d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/ + - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php - name: phpcs (strict) image: joomlaprojects/docker-images:php7.4 @@ -319,6 +319,6 @@ volumes: --- kind: signature -hmac: 82b534f58acb39d32886791cf77e6b55f855b0a810ebd8dd4477992700ed6994 +hmac: 88165cd1c0164dea7b77e8a5f467dadee2aa5021a9ac4c2623c406922bf6d459 ... diff --git a/.mono b/.mono new file mode 100644 index 00000000..eb62809b --- /dev/null +++ b/.mono @@ -0,0 +1 @@ +src="Inflector.php Normalise.php String.php StringHelper.php" From 718c7acc19a0bb920f402be2815913ea15010ef2 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:35:07 +0100 Subject: [PATCH 27/42] Build: Fix paths The 'src/' prefix was missing --- .drone.jsonnet | 4 ++-- .drone.yml | 6 +++--- .mono | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 1535a810..0f7dda35 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -61,7 +61,7 @@ local pipeline(name, phpversion, params) = { depends: [ "composer" ], commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" ] }, { @@ -71,7 +71,7 @@ local pipeline(name, phpversion, params) = { failure: "ignore", commands: [ "vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards", - "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/" + "vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" ] }, { diff --git a/.drone.yml b/.drone.yml index 5f0f419d..ff9915f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,13 +21,13 @@ steps: image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml Inflector.php Normalise.php String.php StringHelper.php + - vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php - name: phpcs (strict) image: joomlaprojects/docker-images:php7.4 commands: - vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards - - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/ + - vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php failure: ignore - name: phpmd @@ -319,6 +319,6 @@ volumes: --- kind: signature -hmac: 88165cd1c0164dea7b77e8a5f467dadee2aa5021a9ac4c2623c406922bf6d459 +hmac: 991f2f86c3455e1c8ae45ec03282982fa7102b7f8fd1b7876e019fe7427499c1 ... diff --git a/.mono b/.mono index eb62809b..da8b9b84 100644 --- a/.mono +++ b/.mono @@ -1 +1 @@ -src="Inflector.php Normalise.php String.php StringHelper.php" +src="src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php" From 211052abc6b4ca736c2e221c76146f02b1c56321 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Thu, 16 Dec 2021 23:49:28 +0100 Subject: [PATCH 28/42] Build: Check for PHP 8.1 compatibility Since the CMS has expressed a need for PHP 8.1 compatible versions of the packages from Framework 1, compatibility should also be tested. --- .drone.jsonnet | 4 +++- .drone.yml | 31 ++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 0f7dda35..87beccc3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -26,6 +26,7 @@ local phpunit(phpversion) = { name: "PHPUnit", image: "joomlaprojects/docker-images:php" + phpversion, [if phpversion == "8.0" then "failure"]: "ignore", + [if phpversion == "8.1" then "failure"]: "ignore", commands: ["vendor/bin/phpunit"] }; @@ -141,5 +142,6 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs") + pipeline("8.0", "8.0", "--ignore-platform-reqs"), + pipeline("8.1", "8.1", "--ignore-platform-reqs") ] diff --git a/.drone.yml b/.drone.yml index ff9915f0..a088e958 100644 --- a/.drone.yml +++ b/.drone.yml @@ -317,8 +317,37 @@ volumes: host: path: /tmp/composer-cache +--- +kind: pipeline +name: PHP 8.1 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php8.1 + commands: + - php -v + - composer update --ignore-platform-reqs + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: PHPUnit + image: joomlaprojects/docker-images:php8.1 + commands: + - vendor/bin/phpunit + failure: ignore + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + --- kind: signature -hmac: 991f2f86c3455e1c8ae45ec03282982fa7102b7f8fd1b7876e019fe7427499c1 +hmac: 166294199b01095c3f19756d73d1202c40bb4a41fd49d676b0bfc2cc8427c307 ... From a0c7656e95aecd728646cb2467a9f35c2929f3a0 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 01:14:58 +0100 Subject: [PATCH 29/42] Build: Allow newer versions of PHPUnit PHPUnit 6.5 fails on PHP 8.1 --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b15fe4a4..7efdb34c 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,11 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": ["joomla", "framework", "string"], + "keywords": [ + "joomla", + "framework", + "string" + ], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { @@ -11,7 +15,7 @@ "require-dev": { "joomla/coding-standards": "~2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" + "phpunit/phpunit": "^4.8.36|^5.4.3|^6.0|^7.0|^8.0" }, "suggest": { "ext-mbstring": "For improved processing" From 84c4730e01fb028ee9b407ae132f87167e13cd56 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 13:12:32 +0100 Subject: [PATCH 30/42] Revert "Build: Allow newer versions of PHPUnit" This reverts commit 27ee84f71de1431043e7248a388c0989042b8b29. --- composer.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 7efdb34c..b15fe4a4 100644 --- a/composer.json +++ b/composer.json @@ -2,11 +2,7 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": [ - "joomla", - "framework", - "string" - ], + "keywords": ["joomla", "framework", "string"], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { @@ -15,7 +11,7 @@ "require-dev": { "joomla/coding-standards": "~2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.36|^5.4.3|^6.0|^7.0|^8.0" + "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" }, "suggest": { "ext-mbstring": "For improved processing" From ec8f58fec7fde70928bbab8582ad18a4cc5bab8a Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Fri, 17 Dec 2021 13:52:12 +0100 Subject: [PATCH 31/42] Build: Allow PHP 8 and PHPUnit up to version 6 Remove 'ignore-deps' directive from PHP 8 pipelines This is an attempt to find the cause for tests not even being executed under certain, yet unknown, circumstances. --- .drone.jsonnet | 4 ++-- .drone.yml | 6 +++--- composer.json | 12 ++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 87beccc3..56fbad81 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -142,6 +142,6 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs"), - pipeline("8.1", "8.1", "--ignore-platform-reqs") + pipeline("8.0", "8.0", "--prefer-stable"), + pipeline("8.1", "8.1", "--prefer-stable") ] diff --git a/.drone.yml b/.drone.yml index a088e958..a99d73fa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -301,7 +301,7 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - php -v - - composer update --ignore-platform-reqs + - composer update --prefer-stable volumes: - name: composer-cache path: /tmp/composer-cache @@ -330,7 +330,7 @@ steps: image: joomlaprojects/docker-images:php8.1 commands: - php -v - - composer update --ignore-platform-reqs + - composer update --prefer-stable volumes: - name: composer-cache path: /tmp/composer-cache @@ -348,6 +348,6 @@ volumes: --- kind: signature -hmac: 166294199b01095c3f19756d73d1202c40bb4a41fd49d676b0bfc2cc8427c307 +hmac: f3982330baf39b4fcadb07885bb3e18b9906efeb814e4e3077b17220a85358cb ... diff --git a/composer.json b/composer.json index b15fe4a4..ca890926 100644 --- a/composer.json +++ b/composer.json @@ -2,16 +2,20 @@ "name": "joomla/string", "type": "joomla-package", "description": "Joomla String Package", - "keywords": ["joomla", "framework", "string"], + "keywords": [ + "joomla", + "framework", + "string" + ], "homepage": "https://github.com/joomla-framework/string", "license": "GPL-2.0-or-later", "require": { - "php": "^5.3.10|~7.0" + "php": "^5.3.10|^7.0|^8.0" }, "require-dev": { - "joomla/coding-standards": "~2.0@alpha", + "joomla/coding-standards": "^2.0@alpha", "joomla/test": "~1.0", - "phpunit/phpunit": "^4.8.35|^5.4.3|~6.0" + "phpunit/phpunit": "^4.8.35|^5.4.3|^6.0" }, "suggest": { "ext-mbstring": "For improved processing" From c9c6380ff6382bef4040f2d35a80d2444492ce0e Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Sat, 18 Dec 2021 12:51:44 +0100 Subject: [PATCH 32/42] Fix: Test the right thing It is not the PHP version we are interested in, but the existence of the constant. --- src/phputf8/utf8.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/phputf8/utf8.php b/src/phputf8/utf8.php index af8b4127..e498763f 100644 --- a/src/phputf8/utf8.php +++ b/src/phputf8/utf8.php @@ -34,7 +34,7 @@ * Also need to check we have the correct internal mbstring * encoding */ -if ( extension_loaded('mbstring')) { +if (extension_loaded('mbstring')) { /* * Joomla modification - As of PHP 8, the `mbstring.func_overload` configuration has been removed and the * MB_OVERLOAD_STRING constant will no longer be present, so this check only runs for PHP 7 and older @@ -42,9 +42,10 @@ * and https://github.com/php/php-src/commit/97df99a6d7d96a886ac143337fecad775907589a * for additional references */ - if ( PHP_VERSION_ID < 80000 && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { + if (defined('MB_OVERLOAD_STRING') && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING) { trigger_error('String functions are overloaded by mbstring',E_USER_ERROR); } + mb_internal_encoding('UTF-8'); } From 96de4d6d88121039fd1f1ada048c3162bc17d4d6 Mon Sep 17 00:00:00 2001 From: Niels Braczek Date: Sat, 18 Dec 2021 14:45:46 +0100 Subject: [PATCH 33/42] Tests: Don't use phpunit.xml to provide PHP values The phpunit.xml should only specify values that are required by the test environment. Everything that the tests themselves require should be made available via bootstrap.php. --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 990cf8cf..f5e011a8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ -