Skip to content

Commit

Permalink
Add paragraph about deprecation warnings (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire authored and soullivaneuh committed Jun 1, 2016
1 parent a70d041 commit b17f2b0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions project/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ interface BarInterface
}
```

In some cases, you will have the possibility to warn the user that things will change,
and recommend a new way of doing things. You can do so by triggering the dedicated kind of error, like this:

```php
<?php
if (/* some condition showing the user is using the legacy way */) {
@trigger_error(
'The '.__METHOD__.' method is deprecated since 42.x, to be removed in 43.0. '.
'Use FooClass::barMethod() instead.',
E_USER_DEPRECATED
);
} else {
// new way of doing things
}
```

In that case, unit tests might show your deprecation notice. You must mark such tests with the `@group legacy` annotation,
and if need be, isolate them in a new test method that can simply be removed in the non-BC PR.

Be aware that pull requests with BC breaks could be rejected
or postponed to next major release if BC is not possible.

Expand Down

0 comments on commit b17f2b0

Please sign in to comment.