Skip to content

Drop PHP 7#767

Merged
phil-davis merged 9 commits into
sabre-io:masterfrom
phil-davis:drop-php7-20260611
Jun 15, 2026
Merged

Drop PHP 7#767
phil-davis merged 9 commits into
sabre-io:masterfrom
phil-davis:drop-php7-20260611

Conversation

@phil-davis

@phil-davis phil-davis commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
  • drop PHP 7.4 8.0 and 8.1 support
  • apply cs-fixer and rector automated changes
  • make changes to test code and real code to get phpstan to pass

@phil-davis

Copy link
Copy Markdown
Contributor Author
fopen(foo.json): Failed to open stream: No such file or directory

I have no idea how the tests found foo.json previous to the changes in this PR. It doesn't seem to exist as a fixture anywhere in this repo. The tests are broken now, but they passed in master that has PHPunit9. This has PHPunit11. No idea if that is relevant. I get the same stuff failing locally on my laptop.

@phil-davis

phil-davis commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

git log --all --full-history -- "*foo*"

Finds nothing. So there never has been any file in this repo with "foo" in its name. And I don't see any code that will create foo.json or foo.ics. So how did this ever work?

Edit add:

The test cases actually expected the Cli to exit with status "2". So they did expect that a problem would be reported - the input file does not exist. Due to changes in PHPunit11, the test code was now exposed to the PHP warning from fopen. So I needed to handle that in the test code, and make a small addition to the real code to throw an InvalidDataException when fopen returns false. That is then handled causing exit 2, the previous behavior.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.81818% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.66%. Comparing base (85d5d6f) to head (013f8bb).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
lib/TimezoneGuesser/FindFromTimezoneMap.php 0.00% 2 Missing ⚠️
lib/Cli.php 95.65% 1 Missing ⚠️
lib/PHPUnitAssertions.php 90.00% 1 Missing ⚠️
lib/Property/Boolean.php 0.00% 1 Missing ⚠️
lib/TimezoneGuesser/FindFromTimezoneIdentifier.php 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #767      +/-   ##
============================================
- Coverage     98.69%   98.66%   -0.04%     
+ Complexity     1891     1757     -134     
============================================
  Files            71       71              
  Lines          5300     5163     -137     
============================================
- Hits           5231     5094     -137     
  Misses           69       69              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@phil-davis phil-davis force-pushed the drop-php7-20260611 branch from 81982c8 to 29260f7 Compare June 14, 2026 03:57
And adjust the related unit test testConvertDefaultFormats so that
it handles the PHP warning that is emitted by fopen.

The Cli code catches InvalidDataException and exits with status 2,
which is what was always expected by the unit test code. So this
should preserve the real behavior.

The test changes are necessary because PHPunit11 now exposes the
PHP warning coming from fopen. So we catch and expect that in an
error handler in the test.
@phil-davis phil-davis force-pushed the drop-php7-20260611 branch from 29260f7 to 5a4792f Compare June 14, 2026 03:58
@phil-davis phil-davis force-pushed the drop-php7-20260611 branch from 6b07557 to 9f6cd1c Compare June 14, 2026 07:25
@phil-davis phil-davis marked this pull request as ready for review June 14, 2026 07:25
Comment thread lib/Document.php Outdated
Comment thread tests/VObject/CliTest.php Outdated
@phil-davis phil-davis requested a review from staabm June 14, 2026 09:38
@marclaporte

Copy link
Copy Markdown

Will this lead to a new major release? (does dropping old PHP versions trigger SemVer?)

@phil-davis

Copy link
Copy Markdown
Contributor Author

Will this lead to a new major release? (does dropping old PHP versions trigger SemVer?)

Normally I would just make a minor release for dropping PHP versions. composer looks after knowing which version suits the PHP version(s) supported by a project.
But there are also a lot of changes/enhancements in master that have parameter and return type definitions, and other PHPdoc stuff. So I think that consumers might find it a bit of effort to implement, particularly if they are currently calling methods with wrong parameter types that have been coerced by PHP, but now the types will be strictly enforced.

So I will make this a major version. That gives consumers the option to specifically choose to update.

Comment thread lib/PHPUnitAssertions.php Outdated
Comment thread lib/Property.php Outdated
@phil-davis phil-davis force-pushed the drop-php7-20260611 branch from 2d35ee7 to 0d7d134 Compare June 15, 2026 00:47
@phil-davis phil-davis merged commit 10ca60f into sabre-io:master Jun 15, 2026
4 of 6 checks passed
@phil-davis phil-davis deleted the drop-php7-20260611 branch June 15, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants