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

Add compatibility for PHP8 #116

Merged
merged 10 commits into from
Mar 1, 2021
Merged

Add compatibility for PHP8 #116

merged 10 commits into from
Mar 1, 2021

Conversation

amotl
Copy link
Member

@amotl amotl commented Feb 24, 2021

Hi there,

PHP 8.0.2 has been released and PHP 8.1.x is in the making. This addresses #115 by adding compatibility for PHP8.0 and deprecating support for PHP7.2, which reached end of life. At the same time, we upgraded to PHPUnit 9.x.

Because PHP's PDO interface has changed, we tried to align to what Doctrine and Drupal were doing to be compatible with both PHP7 and PHP8.

Reason:

Implementation derived and inspired from:

With kind regards,
Andreas.

@amotl amotl force-pushed the amo/php8 branch 2 times, most recently from d354a02 to e188f32 Compare February 24, 2021 17:32
@coveralls
Copy link

coveralls commented Feb 24, 2021

Coverage Status

Coverage decreased (-12.5%) to 76.395% when pulling e155bae on amo/php8 into 45b4229 on main.

@amotl amotl force-pushed the amo/php8 branch 2 times, most recently from 71f5c13 to 43b04c2 Compare February 24, 2021 21:27
We found that Coveralls is not able to merge coverage reports from
different job runs. Since supporting PHP8, we have different code
branches in order to support the old and the new PDO interface.

So, it is crucial to merge coverage reports from two job runs, one
for PHP7.4 and another for PHP8.
This will aid on running the tests with coverage on both PHP7 and PHP8,
merge coverage reports and render them as HTML to be inspected by
humans.

It's not completely maintenance free because some paths will probably
have to be adjusted for others, but it's way better than nothing.
With the introduction of PHP8 compatibility, some `class_alias` code
has been introduced. We have not been able to make PHPUnit grok the
coverage of this code by other means.

Additionally, some annotations have been added to improve code coverage
metrics on code which actually has been covered but was not accounted.
@amotl amotl requested review from seut and nomicode February 25, 2021 16:32
@amotl amotl marked this pull request as ready for review February 25, 2021 16:34
@amotl amotl requested a review from a team February 25, 2021 16:34
Comment on lines +42 to +45
if ($fetchMode !== null) {
throw new UnsupportedException('PDO::query $fetchMode not implemented yet');
}
// FIXME: return $this->doQuery($query, $fetchMode, ...$fetchModeArgs);
Copy link
Member Author

@amotl amotl Feb 25, 2021

Choose a reason for hiding this comment

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

With the updates to the PHP PDO interface, query() operations using fetch styles/modes are now possible directly on the main PDO object reference. In earlier versions, a PDOStatement was needed for that.

While this patch already brings in PHP8 compatibility in general, this specific detail has not been implemented yet and has to be eventually followed up on, see #117.

@amotl amotl linked an issue Feb 25, 2021 that may be closed by this pull request
@amotl amotl removed a link to an issue Feb 25, 2021
Copy link
Member

@seut seut left a comment

Choose a reason for hiding this comment

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

Great stuff, added some questions.

CHANGES.rst Outdated Show resolved Hide resolved
composer.json Show resolved Hide resolved
Copy link
Member

@seut seut left a comment

Choose a reason for hiding this comment

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

👍

@amotl amotl added the ready-to-merge Let Mergify merge the PR once approved and checks pass label Feb 26, 2021
@nomicode nomicode merged commit 4a57b13 into main Mar 1, 2021
@nomicode nomicode deleted the amo/php8 branch March 1, 2021 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Let Mergify merge the PR once approved and checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants