Skip to content
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

CI: Introduce PHP compatibility check #7844

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

Wirone
Copy link
Member

@Wirone Wirone commented Feb 17, 2024

Inspired by this finding, bug introduced in #7616, reproduced here - we have invalid return type in code and none of the tools caught this. I thought this is because we run PHPStan on 8.3 which then assumes it's valid return type, but I modified dev-tools/composer.json, allowed PHP 7.4 and checked on it, but PHPStan still did not report it, even on max level. I believe this is a bug (CC: @ondrejmirtes), but anyway I thought maybe it's a good idea to introduce PHPCompatibility check, which is more focused on differences between PHP versions.

This is a draft and CI will fail, because we need to decide how we want to handle dynamic usages of PHP consts etc. I believe that sniffs should not report these problems if constant is used in if condition, like:

if (\defined('T_READONLY')) {
    // Skip readonly classes for PHP 8.2+
    $acceptTypes[] = T_READONLY;
}

but this is separate problem that should be addressed and fixed in long-term (CC: @jrfnl).

PS. There is 10.x-dev as 9.99.0 constraint because 10.x development version has more checks, but at the same time is not compatible with phpcompatibility/phpcompatibility-symfony which handles Symfony polyfills. We've been using this setup for months in GetResponse and it helped us with migration from 7.4 to 8.2, so I assume it as safe enough 🙂.

@Wirone Wirone added the topic/ci Github Actions, tooling label Feb 17, 2024
@Wirone Wirone self-assigned this Feb 17, 2024
@Wirone Wirone force-pushed the codito/phpcompatibility branch 2 times, most recently from 787f171 to ad6eaf7 Compare February 17, 2024 20:57
@coveralls
Copy link

coveralls commented Feb 17, 2024

Coverage Status

coverage: 94.769%. remained the same
when pulling 9cdb005 on Wirone:codito/phpcompatibility
into ea01071 on PHP-CS-Fixer:master.

@Wirone Wirone force-pushed the codito/phpcompatibility branch from ad6eaf7 to 9cdb005 Compare February 17, 2024 21:01
@ondrejmirtes
Copy link

Please don't cc me on other repositories. If you want, you can isolate the bug, reproduce it and report it properly on PHPStan's issue tracker.

composer.json Show resolved Hide resolved

This comment was marked as outdated.

This comment was marked as outdated.

@github-actions github-actions bot added the status/to recover PRs that were closed without being merged, but can be refreshed and continued label Aug 30, 2024
@github-actions github-actions bot closed this Aug 30, 2024
@keradus keradus reopened this Aug 30, 2024
@github-actions github-actions bot added status/to verify issue needs to be confirmed or analysed to continue and removed status/to recover PRs that were closed without being merged, but can be refreshed and continued status/stale labels Aug 31, 2024
@PHP-CS-Fixer PHP-CS-Fixer deleted a comment from github-actions bot Jan 9, 2025
# Conflicts:
#	.gitignore
#	composer.json
#	dev-tools/composer.json
#	dev-tools/composer.lock
#	tests/AutoReview/CiConfigurationTest.php
Copy link
Member

@keradus keradus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+0.5

@Wirone , is this compat package still maintained?
is last release 5 years old ? ref

@Wirone
Copy link
Member Author

Wirone commented Jan 9, 2025

@keradus it's maintained, but not 9.x 🙂. Please see the PS in PR's description. For wider context you can look at my Twitter thread, it sparked PHPCompatibility/PHPCompatibility#1480 which then was implemented in PHPCompatibility/PHPCompatibility#1730. So yeah, this is actively developed (last commit month ago, maybe holidays 😉).

@Wirone Wirone removed the status/to verify issue needs to be confirmed or analysed to continue label Jan 9, 2025
@Wirone Wirone marked this pull request as ready for review January 9, 2025 13:28
@keradus
Copy link
Member

keradus commented Jan 9, 2025

it's maintained, but not 9.x 🙂

last release 5 years ago sounds to me like not maintained fully. I understand there is ongoing development to make 10.x, but it's never officially release for last 5 years. At least 10.0-alpha.1 or sth..., just dev-master isn't best versioning/release cycle

@keradus keradus merged commit 6c5c0b9 into PHP-CS-Fixer:master Jan 9, 2025
28 checks passed
@keradus
Copy link
Member

keradus commented Jan 9, 2025

thank you @Wirone

@Wirone
Copy link
Member Author

Wirone commented Jan 9, 2025

it's maintained, but not 9.x 🙂

last release 5 years ago sounds to me like not maintained fully. I understand there is ongoing development to make 10.x, but it's never officially release for last 5 years. At least 10.0-alpha.1 or sth..., just dev-master isn't best versioning/release cycle

@jrfnl did you consider tagging a 10.* release, even alpha/beta/RC? What's the status of phpcompatibility/phpcompatibility-symfony? Thanks in advance for the feedback 🙂.

@Wirone Wirone deleted the codito/phpcompatibility branch January 9, 2025 13:58
@keradus
Copy link
Member

keradus commented Jan 9, 2025

I aksed them in their repo earlier - PHPCompatibility/PHPCompatibility#1312 (comment) .

I know for lot of ppl monitoring questions in each repo is not manageable and they focus on their repos for communication.

@Wirone
Copy link
Member Author

Wirone commented Jan 9, 2025

@keradus *her 😉. And from my experience she does not have a problem with mentioning outside of PHPCompatibility org.

@coveralls
Copy link

coveralls commented Jan 9, 2025

Coverage Status

coverage: 94.965%. remained the same
when pulling a333eb9 on Wirone:codito/phpcompatibility
into ea13be1 on PHP-CS-Fixer:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ci Github Actions, tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants