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

Set minimum PHP to 7.4 #220

Merged
merged 6 commits into from
Aug 17, 2022
Merged

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Aug 12, 2022

  1. drop support for PHP 7.1 7.2 and 7.3. Support PHP 7.4 8.0 and 8.1
  2. bump code style and analysis tools to their latest versions
  3. adjust parameter types, return types, constants, variable types.... to be as specific as possible, using features available since PHP 7.4
  4. bump the major version from 2 to 3, so that existing systems only grab this new code by specifying a major version bump - because they might have to touch some code (e.g. adding : void to a child function...) in order to use this.

This fixes issue #215 for this repo.

There are no other open PRs here, so I think we can do this one right away. If a serious bug is noticed in the old code, and we really need to make a patch release of 2.x then we can make a branch for that and backport the fix... But it is probably not worth bothering to set that up here - it might never be used.

@phil-davis phil-davis self-assigned this Aug 12, 2022
@codecov
Copy link

codecov bot commented Aug 12, 2022

Codecov Report

Merging #220 (66d35b4) into master (7c400d8) will decrease coverage by 0.20%.
The diff coverage is 100.00%.

❗ Current head 66d35b4 differs from pull request most recent head 4617c78. Consider uploading reports for the commit 4617c78 to get more accurate results

@@             Coverage Diff              @@
##             master     #220      +/-   ##
============================================
- Coverage     96.89%   96.68%   -0.21%     
  Complexity      116      116              
============================================
  Files            13       13              
  Lines           483      453      -30     
============================================
- Hits            468      438      -30     
  Misses           15       15              
Impacted Files Coverage Δ
lib/Deserializer/functions.php 89.69% <ø> (ø)
lib/LibXMLException.php 100.00% <ø> (ø)
lib/Serializer/functions.php 97.77% <ø> (-0.19%) ⬇️
lib/ContextStackTrait.php 100.00% <100.00%> (ø)
lib/Element/Base.php 100.00% <100.00%> (ø)
lib/Element/Cdata.php 100.00% <100.00%> (ø)
lib/Element/Elements.php 100.00% <100.00%> (ø)
lib/Element/KeyValue.php 100.00% <100.00%> (ø)
lib/Element/Uri.php 100.00% <100.00%> (ø)
lib/Element/XmlFragment.php 100.00% <100.00%> (ø)
... and 15 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -50,7 +52,7 @@ public function __construct($value = null)
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Xml\Writer $writer)
public function xmlSerialize(Xml\Writer $writer): void
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO this sort of change is what forces us to make a major version bump to v3 - anything that currently has Base.php as its parent will notice this change. xmlSerialize "suddenly" has a return type restricted to void. A child that re-implements xmlSerialize is likely to not be specifying any return type. PHP will start complaining when it notices that the child "specifies" a wider return type than the parent, violating LSP.

The child will have to add : void - so we can't release this as a 2.x version, because then composer might give the new version to projects automagically before thir code is ready.

Copy link
Member

Choose a reason for hiding this comment

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

Agree.

Alternatively do the PR on 2.x with all changes but these and do the BC breaking stuff separately

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively do the PR on 2.x with all changes but these and do the BC breaking stuff separately

IMO the other parameter type changes... are "not that exciting" and mostly just in the test code. So there is not really much value for current users that are on PHP 7.1 7.2 7.3 to get those, they don't fix anything real.

@phil-davis phil-davis marked this pull request as ready for review August 17, 2022 09:03
.php-cs-fixer.dist.php Outdated Show resolved Hide resolved
lib/ContextStackTrait.php Outdated Show resolved Hide resolved
@@ -50,7 +52,7 @@ public function __construct($value = null)
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Xml\Writer $writer)
public function xmlSerialize(Xml\Writer $writer): void
Copy link
Member

Choose a reason for hiding this comment

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

Agree.

Alternatively do the PR on 2.x with all changes but these and do the BC breaking stuff separately

@phil-davis phil-davis merged commit 542a2e1 into sabre-io:master Aug 17, 2022
@phil-davis phil-davis deleted the minimum-php-7.4 branch August 17, 2022 09:20
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.

2 participants