Deprecate ProvidesEvents trait #5283

Merged
merged 3 commits into from Oct 23, 2013

5 participants

@EvanDotPro
Zend Framework member

This trait was added before we had a naming convention for traits, and
has since been replaced by EventManagerAwareTrait. To help people
understand this, we should have the actual code in the correct trait,
and proxy the old one to the new one with a comment explaining what's
going on.

I also improved the docblocks a little bit while I was in there.

EvanDotPro added some commits Oct 16, 2013
@EvanDotPro EvanDotPro Deprecate ProvidesEvents trait.
This trait was added before we had a naming convention for traits, and
has since been replaced by EventManagerAwareTrait. To help people
understand this, we should have the actual code in the correct trait,
and proxy the old one to the new one with a comment explaining what's
going on.
7be6162
@EvanDotPro EvanDotPro Improve EventManagerAwareTrait comments 120766c
@Maks3w Maks3w commented on an outdated diff Oct 16, 2013
library/Zend/EventManager/ProvidesEvents.php
@@ -12,55 +12,11 @@
use Traversable;
/**
- * A trait for objects that provide events
+ * NOTE: THIS TRAIT IS DEPRECATED! Please use EventManagerAwareTrait instead.
+ * This trait exists solely for backwards compatibility in the 2.x branch and
+ * willl likely be removed in 3.x.
@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

a lot l in `will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w Maks3w commented on an outdated diff Oct 16, 2013
library/Zend/EventManager/ProvidesEvents.php
@@ -12,55 +12,11 @@
use Traversable;
/**
- * A trait for objects that provide events
+ * NOTE: THIS TRAIT IS DEPRECATED! Please use EventManagerAwareTrait instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w Maks3w commented on an outdated diff Oct 16, 2013
library/Zend/EventManager/EventManagerAwareTrait.php
@@ -11,7 +11,65 @@
use \Zend\EventManager\ProvidesEvents;
@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

Off-Topic: use statements must not have leading slash

@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

Also this use is not longer necessary.

@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

Also 2: A use for Traversable is missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w Maks3w commented on an outdated diff Oct 16, 2013
library/Zend/EventManager/EventManagerAwareTrait.php
@@ -11,7 +11,65 @@
use \Zend\EventManager\ProvidesEvents;
+/**
+ * A trait for objects that provide events.
+ *
+ * If you use this trait in an object, you will probably want to also implement
+ * EventManagerAwareInterface, which will make it so the default initializer in
+ * a ZF2 MVC application will automatically inject an instance of the
+ * EventManager into your object when it is pulled from the ServiceManager.
+ */
@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

Add @see annotation for reference to other components.

http://www.phpdoc.org/docs/latest/for-users/phpdoc/tags/see.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w
Zend Framework member

Review end.

@Maks3w Maks3w commented on an outdated diff Oct 16, 2013
library/Zend/EventManager/ProvidesEvents.php
@@ -12,55 +12,11 @@
use Traversable;
@Maks3w
Zend Framework member
Maks3w added a note Oct 16, 2013

This can be removed too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@marc-mabe
Zend Framework member

Should we add a trigger_error(..., E_USER_DEPRECATED) on loading the deprecated trait?

@EvanDotPro
Zend Framework member

@marc-mabe if so, I'd say maybe not until 2.3, but that's just a gut feeling.

@mwillbanks

@EvanDotPro @marc-mabe I agree that we should throw the E_USER_DEPRECATED in this sense.

@weierophinney
Zend Framework member

Add the E_USER_DEPRECATED call here, and target for 2.3.0, please.

@weierophinney weierophinney added a commit that referenced this pull request Oct 23, 2013
@weierophinney weierophinney Merge branch 'feature/5283' into develop
Close #5283
c9f5a51
@weierophinney weierophinney merged commit 266649d into zendframework:develop Oct 23, 2013

1 check failed

Details default The Travis CI build failed
@weierophinney
Zend Framework member

I added the E_USER_DEPRECATED notice to the classfile, and added a note in the README for the release.

@weierophinney weierophinney added a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zendframework#5283 from EvanDotPro/f…
…eature/deprecate-old-traits

Deprecate ProvidesEvents trait
382717d
@weierophinney weierophinney added a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015
@weierophinney weierophinney [zendframework/zendframework#5283] Add E_USER_DEPRECATED error on loa…
…ding old trait
e892111
@weierophinney weierophinney added a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'feature/5283' into develop 26213ed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment