Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Deprecates PHP5#246

Merged
sanpii merged 1 commit intomasterfrom
deprecates-php5
Apr 8, 2018
Merged

Deprecates PHP5#246
sanpii merged 1 commit intomasterfrom
deprecates-php5

Conversation

@sanpii
Copy link
Copy Markdown
Member

@sanpii sanpii commented Mar 22, 2018

Fixes #244

@sanpii sanpii added this to the 3.2 milestone Mar 22, 2018
Comment thread src/Extension.php Outdated
public function initialize(ExtensionManager $extensionManager)
{
if (PHP_MAJOR_VERSION === 5) {
trigger_error('Behatch context extension stop supporting PHP5 in version 4.0', E_USER_DEPRECATED);
Copy link
Copy Markdown
Contributor

@OskarStark OskarStark Mar 22, 2018

Choose a reason for hiding this comment

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

would write it like that:

@trigger_error('PHP 5 support is deprecated since 3.x and will be removed in 4.0', E_USER_DEPRECATED);

WDYT?

Copy link
Copy Markdown
Member Author

@sanpii sanpii Mar 22, 2018

Choose a reason for hiding this comment

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

Silencing the deprecation notices it’s great when you handle them with another component (for example, the symfony debug toolbar). But here there is nothing to handle notices, they will never displayed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

but in this case, the code execution will be interrupted, or am I wrong?
And in this case, it is no soft deprecation...

But in the first place you want to tell the user, silently (via the logfile), that it IS still working, but WILL NOT be working with the next major version.
Otherwise you break PHP 5 support directly

We always use @trigger_error here: https://github.com/sonata-project

@greg0ire WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

@sanpii sanpii Mar 23, 2018

Choose a reason for hiding this comment

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

but in this case, the code execution will be interrupted, or am I wrong?

No, PHP5 tests still pass https://travis-ci.org/Behatch/contexts/jobs/356812969#L688 (with inelegant deprecation notice).

http://symfony.com/doc/current/components/phpunit_bridge.html#trigger-deprecation-notices

How do you opt-in deprecation notices in behat?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Behatch context extension stop supporting PHP5 in version 4.0

"The behatch context extension will drop support for PHP 5 in version 4.0"

Regarding the @, it's fine with or without, it really is your choice. Putting the @ makes it opt in, not putting it makes it opt out. Regarding behat, here is the error handling method: https://github.com/Behat/Behat/blob/efea9c2dea5694e8c029c392fe2bb7880925d9e1/src/Behat/Behat/Definition/Annotation/Definition.php#L119-L126
Not sure how to replace it with a better error handler.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@greg0ire thank you for the corrections.

I found caciobanu/behat-deprecation-extension, but it may be a good idea to improve the behat error handler.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In that case, I'd recommend adding the @ and adding a link to the behat extension in the README

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I added a note in UPGRADE-4.0.md file.

Comment thread UPGRADE-4.0.md Outdated
@@ -0,0 +1,3 @@
# Upgrade from 3.x to 4.0

* PHP 5 is not suported, please upgrade to PHP 7
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

supported

@sanpii sanpii force-pushed the deprecates-php5 branch 2 times, most recently from d24a79b to 5fe2f9e Compare March 23, 2018 13:22
@sanpii sanpii force-pushed the deprecates-php5 branch from 5fe2f9e to f766370 Compare April 8, 2018 13:28
@sanpii sanpii merged commit f766370 into master Apr 8, 2018
@sanpii sanpii deleted the deprecates-php5 branch August 9, 2018 15:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants