Skip to content

php8.4 #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f483301
php update poc
rdss-sknott Feb 7, 2025
4acef3f
Small PHP8.4 feature port
rdss-sknott Feb 7, 2025
0b6eb9b
Ignore error that arrays are not a callable
PatrickJanzen Feb 25, 2025
e1347de
Ignore error that arrays are not a callable
PatrickJanzen Feb 25, 2025
d1be547
update php action
PatrickJanzen Feb 25, 2025
c751e83
code style
PatrickJanzen Feb 25, 2025
6b95c2f
code style
PatrickJanzen Feb 25, 2025
3ba991d
Fix safe version 3 compatibility
rdss-sknott Feb 26, 2025
015d094
Replace deprecated Sniff
rdss-sknott Feb 26, 2025
f0edbe3
replace more rules from phpmd by phpstan and phpcs
rdss-sknott Feb 26, 2025
3ad27d6
Replaced some phpmd rules and fixed cs
rdss-sknott Feb 26, 2025
6fd55d4
Too many methods and properties
rdss-sknott Feb 27, 2025
a6ae99b
More PHPMD replacements
rdss-sknott Mar 18, 2025
be639b0
code style - phpmd removal WIP
PatrickJanzen Mar 20, 2025
674e15e
code style - phpmd removal WIP
PatrickJanzen Mar 21, 2025
07ef81d
code style - phpmd removal WIP
PatrickJanzen Mar 21, 2025
3772eb4
code style - fixes
PatrickJanzen Mar 21, 2025
2e08881
code style - fixes
PatrickJanzen Mar 21, 2025
5f68c86
remove debug output
PatrickJanzen Mar 21, 2025
86a2f5f
added annotations where needed
PatrickJanzen Mar 21, 2025
19f4f8b
modify autoload trigger for Tokens Class
PatrickJanzen Mar 24, 2025
fcd7b84
modify autoload trigger for Tokens Class
PatrickJanzen Mar 24, 2025
76c3092
switch to implementation from branch 8.4-variant
PatrickJanzen Mar 25, 2025
ff1e1d5
phpmd removal
PatrickJanzen Mar 25, 2025
2230ddc
Mention Safe version in exception
rdss-sknott Mar 25, 2025
6d4f6b6
Cleanup Implementation
rdss-sknott Mar 27, 2025
a308c2f
Sniff must not fail in constructor
rdss-sknott Mar 27, 2025
e359cfb
Letting users know what went wront with safe
rdss-sknott Mar 27, 2025
3990552
Kill the CheckSafe mutants
rdss-sknott Mar 28, 2025
4550f24
set required version of mikey179/vfsstream fix to v1.6.12
rdss-pkuehn Mar 31, 2025
5e48e9b
improove tests
rdss-pkuehn Mar 31, 2025
f960af3
Piun the execution order to get more comparable infection results
rdss-sknott Mar 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ jobs:
${{ runner.os }}-codestyle-${{ env.cache-name }}-

- name: Setup PHP and Composer
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d
uses: shivammathur/setup-php@e77cdb393f70751e0417891f9ae9de6a41096210
with:
php-version: '8.2'
php-version: '8.4'
extensions: gd
tools: cs2pr, composer
env:
Expand Down Expand Up @@ -118,9 +118,9 @@ jobs:
${{ runner.os }}-tests-${{ env.cache-name }}-

- name: Setup PHP and Composer
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d
uses: shivammathur/setup-php@e77cdb393f70751e0417891f9ae9de6a41096210
with:
php-version: '8.2'
php-version: '8.4'
tools: composer:${{ matrix.composer_version }}
extensions: xdebug
env:
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM php:8.2-cli-alpine
FROM php:8.4-cli-alpine

RUN set -eux ; \
apk add --no-cache --virtual .composer-rundeps \
apk add --update --no-cache --virtual .composer-rundeps \
bash \
coreutils \
git \
nodejs \
npm \
openssh-client \
sqlite-dev \
tini \
unzip \
zip \
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Coding Standard.
It incorporates
* [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
and its configuration
* [PHP Mess Detector](https://github.com/phpmd/phpmd) and its configuration
* [PHP Copy Paste Detector](https://github.com/sebastianbergmann/phpcpd)
* [PHP-Parallel-Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint)
* [PHPStan - PHP Static Analysis Tool](https://github.com/phpstan/phpstan)
Expand Down
226 changes: 113 additions & 113 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,118 +1,118 @@
{
"name": "zooroyal/coding-standard-source",
"description": "This is the ZooRoyal coding standard source package.",
"type": "phpcodesniffer-standard",
"keywords": [
"ZooRoyal",
"phpcs",
"standards",
"phpmd",
"phpcpd",
"lint"
],
"homepage": "https://github.com/ZooRoyal/coding-standard-source",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Sebastian Knott",
"email": "sebastian.knott@rewe-digital.com"
}
],
"support": {
"issues": "https://github.com/ZooRoyal/coding-standard-source/issues",
"wiki": "https://github.com/ZooRoyal/coding-standard-source/wiki",
"source": "https://github.com/ZooRoyal/coding-standard-source"
},
"require": {
"php": "^8.2.0",
"ext-json": "*",
"ext-xml": "*",
"composer-runtime-api": "^2.0",
"bamarni/composer-bin-plugin": "^1.8",
"composer/semver": "^3.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"nette/neon": "^3.3",
"nikic/php-parser": "^4.18",
"php-di/php-di": "^7.0.1",
"phpcompatibility/php-compatibility": "dev-develop#a8d67148fb990fbf5c2f6166d54bc91cc01fc655",
"slevomat/coding-standard": "^8.10.0",
"squizlabs/php_codesniffer": "^3.9.0",
"symfony/console": " ^6.2.8",
"symfony/event-dispatcher": "^6.2.2",
"symfony/filesystem": " ^6.2.0",
"symfony/process": " ^6.2.0",
"thecodingmachine/safe": "^2.5",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"amphp/amp": "^v2.6.2",
"amphp/phpunit-util": "^2.0.0",
"amphp/process": "^v1.1.4",
"brianium/paratest": "^6.11.0",
"infection/infection": ">=0.27.11",
"mockery/mockery": "^1.6.7",
"phpunit/phpunit": "^9.6.16",
"roave/security-advisories": "dev-latest",
"sebastianknott/hamcrest-object-accessor": "^3.0.0"
},
"replace": {
"zooroyal/coding-standard": "self.version"
},
"autoload": {
"psr-4": {
"Zooroyal\\CodingStandard\\": "src/main/php/"
}
},
"autoload-dev": {
"psr-4": {
"Zooroyal\\CodingStandard\\Tests\\": "tests/"
},
"files": [
"vendor/squizlabs/php_codesniffer/autoload.php",
"vendor/squizlabs/php_codesniffer/src/Util/Tokens.php",
"vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php",
"vendor/slevomat/coding-standard/autoload-bootstrap.php"
]
},
"bin": [
"src/bin/coding-standard"
],
"scripts": {
"post-update-cmd": "npm update",
"post-install-cmd": "npm install",
"ci": [
"@test-prepare",
"@test",
"@infection-command"
"name": "zooroyal/coding-standard-source",
"description": "This is the ZooRoyal coding standard source package.",
"type": "phpcodesniffer-standard",
"keywords": [
"ZooRoyal",
"phpcs",
"standards",
"phpcpd",
"lint"
],
"test-mkdirs": "mkdir -p tmp/phpunit",
"test-paratest-command": "paratest -p$(getconf _NPROCESSORS_ONLN)",
"test-prepare": "mkdir -p tmp/phpunit",
"test": [
"@test-prepare",
"@test-paratest-command"
"homepage": "https://github.com/ZooRoyal/coding-standard-source",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Sebastian Knott",
"email": "sebastian.knott@rewe-digital.com"
}
],
"infection-command": "infection -n --threads=$(getconf _NPROCESSORS_ONLN) --skip-initial-tests --coverage=tmp/phpunit --no-progress",
"infection": [
"@test-prepare",
"@test --testsuite=InfectionRelevant",
"@infection-command"
]
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"process-timeout": 600,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true,
"bamarni/composer-bin-plugin": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": true
"support": {
"issues": "https://github.com/ZooRoyal/coding-standard-source/issues",
"wiki": "https://github.com/ZooRoyal/coding-standard-source/wiki",
"source": "https://github.com/ZooRoyal/coding-standard-source"
},
"require": {
"php": "^8.4.0",
"ext-json": "*",
"ext-xml": "*",
"composer-runtime-api": "^2.0",
"bamarni/composer-bin-plugin": "^1.8.2",
"composer/semver": "^3.4.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"nette/neon": "^3.4.4",
"nette/utils": "^4.0.5",
"nikic/php-parser": "^5.4.0",
"php-di/php-di": "^7.0.1",
"slevomat/coding-standard": "^8.16.1",
"squizlabs/php_codesniffer": "^3.12.0",
"symfony/console": " ^7.2.1",
"symfony/event-dispatcher": "^7.2.0",
"symfony/filesystem": " ^7.2.0",
"symfony/process": " ^7.2.4",
"thecodingmachine/safe": "^3.0.2",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"amphp/amp": "^v2.6.2",
"amphp/phpunit-util": "^2.0.1",
"amphp/process": "^v1.1.9",
"brianium/paratest": "^v6.11.1",
"infection/infection": ">=0.29.14",
"mikey179/vfsstream": "^1.6.12",
"mockery/mockery": "1.6.11",
"phpunit/phpunit": "^9.6.22",
"roave/security-advisories": "dev-latest",
"sebastianknott/hamcrest-object-accessor": "^3.0.0"
},
"replace": {
"zooroyal/coding-standard": "self.version"
},
"autoload": {
"psr-4": {
"Zooroyal\\CodingStandard\\": "src/main/php/"
}
},
"autoload-dev": {
"psr-4": {
"Zooroyal\\CodingStandard\\Tests\\": "tests/"
},
"files": [
"vendor/squizlabs/php_codesniffer/autoload.php",
"vendor/squizlabs/php_codesniffer/src/Util/Tokens.php",
"vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php",
"vendor/slevomat/coding-standard/autoload-bootstrap.php"
]
},
"bin": [
"src/bin/coding-standard"
],
"scripts": {
"post-update-cmd": "npm update",
"post-install-cmd": "npm install",
"ci": [
"@test-prepare",
"@test",
"@infection-command"
],
"test-mkdirs": "mkdir -p tmp/phpunit",
"test-paratest-command": "paratest -p$(getconf _NPROCESSORS_ONLN)",
"test-prepare": "mkdir -p tmp/phpunit",
"test": [
"@test-prepare",
"@test-paratest-command"
],
"infection-command": "infection -n --threads=$(getconf _NPROCESSORS_ONLN) --skip-initial-tests --coverage=tmp/phpunit --no-progress",
"infection": [
"@test-prepare",
"@test-paratest-command --testsuite=InfectionRelevant",
"@infection-command"
]
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"process-timeout": 600,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true,
"bamarni/composer-bin-plugin": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": true
}
}
}
}
34 changes: 24 additions & 10 deletions config/phpcs/ZooRoyal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</rule>

<rule ref="PHPCompatibility">
<!-- Sniff generates false positives if classname is used in another namespace -->
<exclude name="PHPCompatibility.Classes.NewClasses.attributeFound"/>
<exclude name="PHPCompatibility.Attributes.NewAttributes.Found"/>
</rule>

<!-- Custom Rule-->
<rule ref="../../../src/main/php/Sniffs/ObjectCalisthenics/Standards/ZooRoyal"/>
<rule ref="../../../src/main/php/Sniffs/PHPCodeSniffer/Standards/ZooRoyal"/>
<rule ref="../../../src/main/php/Sniffs/Rdss/Standards/ZooRoyal"/>

Expand Down Expand Up @@ -78,15 +73,17 @@
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DiscourageGoto"/>
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions"
type="array"
value="sizeof=>count,delete=>unset,print=>echo,is_null=>null,create_function=>null,ob_end_flush=>null,chop=>rtrim,close=>closedir,die=>exit,diskfreespace=>disk_free_space,doubleval=>floatval,fputs=>fwrite,gzputs=>gzwrite,i18n_convert=>mb_convert_encoding,i18n_discover_encoding=>mb_detect_encoding,i18n_http_input=>mb_http_input,i18n_http_output=>mb_http_output,i18n_internal_encoding=>mb_internal_encoding,i18n_ja_jp_hantozen=>mb_convert_kana,i18n_mime_header_decode=>mb_decode_mimeheader,i18n_mime_header_encode=>mb_encode_mimeheader,imap_create=>imap_createmailbox,imap_fetchtext=>imap_body,imap_getmailboxes=>imap_list_full,imap_getsubscribed=>imap_lsub_full,imap_header=>imap_headerinfo,imap_listmailbox=>imap_list,imap_listsubscribed=>imap_lsub,imap_rename=>imap_renamemailbox,imap_scan=>imap_listscan,imap_scanmailbox=>imap_listscan,ini_alter=>ini_set,is_double=>is_float,is_integer=>is_int,is_long=>is_int,is_real=>is_float,is_writeable=>is_writable,join=>implode,key_exists=>array_key_exists,ldap_close=>ldap_unbind,magic_quotes_runtime=>set_magic_quotes_runtime,mbstrcut=>mb_strcut,mbstrlen=>mb_strlen,mbstrpos=>mb_strpos,mbstrrpos=>mb_strrpos,mbsubstr=>mb_substr,mysql=>mysql_db_query,mysql_createdb=>mysql_create_db,mysql_db_name=>mysql_result,mysql_dbname=>mysql_result,mysql_dropdb=>mysql_drop_db,mysql_fieldflags=>mysql_field_flags,mysql_fieldlen=>mysql_field_len,mysql_fieldname=>mysql_field_name,mysql_fieldtable=>mysql_field_table,mysql_fieldtype=>mysql_field_type,mysql_freeresult=>mysql_free_result,mysql_listdbs=>mysql_list_dbs,mysql_listfields=>mysql_list_fields,mysql_listtables=>mysql_list_tables,mysql_numfields=>mysql_num_fields,mysql_numrows=>mysql_num_rows,mysql_selectdb=>mysql_select_db,mysql_tablename=>mysql_result,odbc_do=>odbc_exec,odbc_field_precision=>odbc_field_len,pdf_add_outline=>pdf_add_bookmark,pg_clientencoding=>pg_client_encoding,pg_setclientencoding=>pg_set_client_encoding,pos=>current,recode=>recode_string,show_source=>highlight_file,sizeof=>count,snmpwalkoid=>snmprealwalk,strchr=>strstr,xptr_new_context=>xpath_new_context"
value="sizeof=>count,delete=>unset,print=>echo,is_null=>null,create_function=>null,ob_end_flush=>null,chop=>rtrim,close=>closedir,die=>exit,diskfreespace=>disk_free_space,doubleval=>floatval,fputs=>fwrite,gzputs=>gzwrite,i18n_convert=>mb_convert_encoding,i18n_discover_encoding=>mb_detect_encoding,i18n_http_input=>mb_http_input,i18n_http_output=>mb_http_output,i18n_internal_encoding=>mb_internal_encoding,i18n_ja_jp_hantozen=>mb_convert_kana,i18n_mime_header_decode=>mb_decode_mimeheader,i18n_mime_header_encode=>mb_encode_mimeheader,imap_create=>imap_createmailbox,imap_fetchtext=>imap_body,imap_getmailboxes=>imap_list_full,imap_getsubscribed=>imap_lsub_full,imap_header=>imap_headerinfo,imap_listmailbox=>imap_list,imap_listsubscribed=>imap_lsub,imap_rename=>imap_renamemailbox,imap_scan=>imap_listscan,imap_scanmailbox=>imap_listscan,ini_alter=>ini_set,is_double=>is_float,is_integer=>is_int,is_long=>is_int,is_real=>is_float,is_writeable=>is_writable,join=>implode,key_exists=>array_key_exists,ldap_close=>ldap_unbind,magic_quotes_runtime=>set_magic_quotes_runtime,mbstrcut=>mb_strcut,mbstrlen=>mb_strlen,mbstrpos=>mb_strpos,mbstrrpos=>mb_strrpos,mbsubstr=>mb_substr,mysql=>mysql_db_query,mysql_createdb=>mysql_create_db,mysql_db_name=>mysql_result,mysql_dbname=>mysql_result,mysql_dropdb=>mysql_drop_db,mysql_fieldflags=>mysql_field_flags,mysql_fieldlen=>mysql_field_len,mysql_fieldname=>mysql_field_name,mysql_fieldtable=>mysql_field_table,mysql_fieldtype=>mysql_field_type,mysql_freeresult=>mysql_free_result,mysql_listdbs=>mysql_list_dbs,mysql_listfields=>mysql_list_fields,mysql_listtables=>mysql_list_tables,mysql_numfields=>mysql_num_fields,mysql_numrows=>mysql_num_rows,mysql_selectdb=>mysql_select_db,mysql_tablename=>mysql_result,odbc_do=>odbc_exec,odbc_field_precision=>odbc_field_len,pdf_add_outline=>pdf_add_bookmark,pg_clientencoding=>pg_client_encoding,pg_setclientencoding=>pg_set_client_encoding,pos=>current,recode=>recode_string,show_source=>highlight_file,sizeof=>count,snmpwalkoid=>snmprealwalk,strchr=>strstr,xptr_new_context=>xpath_new_context,exit=>null"
/>
</properties>
</rule>
Expand Down Expand Up @@ -121,6 +118,11 @@
<rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/>
<rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.Classes.ClassLength">
<properties>
<property name="maxLinesLength" value="1000" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<properties>
Expand All @@ -147,6 +149,11 @@
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/>
<rule ref="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature">
<properties>
<property name="minLineLength" value="130"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration"/>
<rule ref="SlevomatCodingStandard.Commenting.DisallowCommentAfterCode"/>
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
Expand Down Expand Up @@ -192,7 +199,12 @@
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
<!--<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>-->
<rule ref="SlevomatCodingStandard.Functions.FunctionLength">
<properties>
<property name="maxLinesLength" value="39"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.NamedArgumentSpacing"/>
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse"/>
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
Expand Down Expand Up @@ -231,13 +243,15 @@
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
<properties>
<property name="withSpaces" type="bool" value="false"/>
<property name="withSpacesAroundOperators" type="bool" value="false"/>
<property name="withSpacesInsideParentheses" type="bool" value="false"/>
<property name="shortNullable" type="bool" value="true"/>
<property name="nullPosition" type="bool" value="last"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
<!--
https://packagist.org/packages/bmitch/codor are planed for PHP > 7.0

Expand Down
Loading
Loading