Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 2fb2ae6

Browse files
committed
Merge branch 'feature/sem-refactor' into develop
Close #4
2 parents 1a56fce + 63cdc32 commit 2fb2ae6

File tree

90 files changed

+5332
-2369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+5332
-2369
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ clover.xml
1212
composer.lock
1313
coveralls-upload.json
1414
phpunit.xml
15-
vendor
15+
doc/html/
16+
vendor/

.php_cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

.travis.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ matrix:
1717
- php: 5.5
1818
env:
1919
- EXECUTE_CS_CHECK=true
20+
- EXECUTE_DOC_CHECK=true
2021
- php: 5.6
2122
env:
2223
- EXECUTE_TEST_COVERALLS=true
@@ -33,15 +34,21 @@ notifications:
3334
before_install:
3435
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
3536
- composer self-update
37+
- if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then composer require --dev --no-update phly/bookdown2mkdocs ; fi
3638
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
3739

3840
install:
39-
- travis_retry composer install --no-interaction --ignore-platform-reqs
41+
- travis_retry composer install --no-interaction --ignore-platform-reqs --prefer-source
42+
- composer info -i
43+
44+
before_script:
45+
- if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then cp mkdocs.yml mkdocs.yml.orig ; fi
4046

4147
script:
4248
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
4349
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
44-
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi
50+
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi
51+
- if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then make mkdocs ; diff mkdocs.yml mkdocs.yml.orig ; return $? ; fi
4552

4653
after_script:
4754
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi

CHANGELOG.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,86 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5+
## 3.0.0 - TBD
6+
7+
### Added
8+
9+
- [Migration documentation](doc/book/migration/) was added.
10+
- [Automated benchmarks](benchmarks/) were added.
11+
- `EventManager::__construct()` now accepts an optional
12+
`SharedEventManagerInterface` instance as the first argument, and an optional
13+
array of identifiers as the second. As identifiers have no meaning without a
14+
shared manager present, they are secondary to providing the shared manager.
15+
- `EventManagerInterface::trigger()` changes its signature to
16+
`trigger($eventName, $target = null, $argv = [])`; each argument has exactly
17+
one possible meaning; the `$eventName` can only be a string event name. The
18+
fourth `$callback` argument is removed.
19+
- `EventManagerInterface::triggerUntil()` changes its signature to
20+
`triggerUntil(callable $callback, $eventName, $target = null, $argv = null)`.
21+
Each argument has exactly one meaning.
22+
- `EventManagerInterface` adds two new methods for triggering provided
23+
`EventInterface` arguments: `triggerEvent(EventInterface $event)` and
24+
`triggerEventUntil(callable $callback, EventInterface $event)`.
25+
- `EventManagerInterface::attach()` and `detach()` change their signatures to
26+
`attach($eventName, callable $listener, $priority = 1)` and `detach(callable
27+
$listener, $eventName = null)`, respectively. Note that `$eventName` can now
28+
only be a string event name, not an array or `Traversable`.
29+
- `EventManagerInterface::setIdentifiers()` and `addIdentifiers()` change their
30+
signatures to each only accept an *array* of identifiers.
31+
- `SharedEventManagerInterface::getListeners()` changes signature to
32+
`getListeners(array $identifiers, $eventName)` and now guarantees return of an
33+
array. Note that the second argument is now *required*.
34+
- `SharedEventManagerInterface::attach()` changes signature to
35+
`attach($identifier, $eventName, callable $listener, $priority = 1)`. The
36+
`$identifier` and `$eventName` **must** be strings.
37+
- `SharedEventManagerInterface::detach()` changes signature to `detach(callable
38+
$listener, $identifier = null, $eventName = null)`; `$identifier` and
39+
`$eventName` **must** be strings if passed.
40+
- `ListenerAggregateInterface::attach()` adds an optional `$priority = 1`
41+
argument. This was used already in v2, but not dictated by the interface.
42+
- `FilterInterface::attach()` and `detach()` have changed signature to
43+
`attach(callable $callback)` and `detach(callable $ilter)`, respectively.
44+
- `LazyListener` allows wrapping:
45+
- fetching a listener service from a container-interop container, and
46+
- invoking a designated listener method with the provided event.
47+
- `LazyEventListener` extends `LazyListener`, and provides metadata for
48+
discovering the intended event name and priority at which to attach the lazy
49+
listener; these are consumed by:
50+
- `LazyListenerAggregate`, which, provided a list of `LazyEventListeners` and/or
51+
definitions to use to create them, acts as an aggregate for attaching a number
52+
of such listeners at once.
53+
54+
### Deprecated
55+
56+
- Nothing.
57+
58+
### Removed
59+
60+
- `GlobalEventManager` and `StaticEventManager` are removed (with prejudice!).
61+
- `ProvidesEvents`, which was previously deprecated, is removed.
62+
- `EventManagerInterface::setSharedManager()` is removed. Shared managers are
63+
now expected to be injected during instantiation.
64+
- `EventManagerInterface::getEvents()` and `getListeners()` are removed; they
65+
had now purpose within the implementation.
66+
- `EventManagerInterface::setEventClass()` was renamed to `setEventPrototype()`,
67+
which now expects an `EventInterface` instance. That instance will be cloned
68+
whenever a new event is created.
69+
- `EventManagerInterface::attachAggregate()` and `detachAggregate()` are
70+
removed. Users should use the `attach()` and `detach()` methods of the
71+
aggregates themselves.
72+
- `SharedEventAggregateAwareInterface` and `SharedListenerAggregateInterface`
73+
are removed. This was an undocumented and largely unused feature.
74+
- `SharedEventManagerAwareInterface` is removed. A new interface,
75+
`SharedEventsCapableInterface` defines the `getSharedManager()` method from
76+
the interface, and `EventManagerInterface` extends that new interface.
77+
- `SharedEventManagerInterface::getEvents()` is removed, as it had no purpose in
78+
the implementation.
79+
- `ResponseCollection::setStopped()` no longer implements a fluent interface.
80+
81+
### Fixed
82+
83+
- `FilterIterator::insert()` has been modified to raise an exception if the value provided is not a callable.
84+
585
## 2.6.0 - TBD
686

787
### Added

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# zend-eventmanager Makefile
2+
#
3+
# Primary purpose is for generating the mkdocs.yml from the bookdown.json
4+
# sources.
5+
#
6+
# Configurable variables:
7+
# - BOOKDOWN2MKDOCS - specify the path to the executable; defaults to
8+
# ./vendor/bin/bookdown2mkdocs
9+
#
10+
# Available targets:
11+
# - mkdocs - regenerate mkdocs.yml
12+
# - all - synonym for mkdocs target
13+
14+
BOOKDOWN2MKDOCS?=$(CURDIR)/vendor/bin/bookdown2mkdocs.php
15+
16+
.PHONY : all mkdocs bookdown2mkdocs
17+
18+
all : mkdocs
19+
20+
mkdocs :
21+
@echo "Generating mkdocs.yml from bookdown.json..."
22+
-$(BOOKDOWN2MKDOCS) convert --site-name=zend-eventmanager --repo-url=https://github.com/zendframework/zend-eventmanager --copyright-url=http://www.zend.com/ --copyright-author="Zend Technologies USA Inc."
23+
@echo "[DONE] Generating mkdocs.yml from bookdown.json"

benchmarks/MultipleEventIndividualSharedListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public function setUp()
2323
foreach ($this->getEventList() as $event) {
2424
$this->sharedEvents->attach($identifiers[0], $event, $this->generateCallback());
2525
}
26-
$this->events = new EventManager();
27-
$this->events->setSharedManager($this->sharedEvents);
28-
$this->events->setIdentifiers([$identifiers[0]]);
26+
$this->events = new EventManager($this->sharedEvents, [$identifiers[0]]);
2927

3028
$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
3129
return ($value !== '*');

benchmarks/MultipleEventMultipleLocalAndSharedListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ public function setUp()
2525
$this->sharedEvents->attach($identifier, $event, $this->generateCallback());
2626
}
2727
}
28-
$this->events = new EventManager();
29-
$this->events->setSharedManager($this->sharedEvents);
30-
$this->events->setIdentifiers($identifiers);
28+
$this->events = new EventManager($this->sharedEvents, $identifiers);
3129

3230
$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
3331
return ($value !== '*');

benchmarks/MultipleEventMultipleSharedListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ public function setUp()
2525
$this->sharedEvents->attach($identifier, $event, $this->generateCallback());
2626
}
2727
}
28-
$this->events = new EventManager();
29-
$this->events->setSharedManager($this->sharedEvents);
30-
$this->events->setIdentifiers($identifiers);
28+
$this->events = new EventManager($this->sharedEvents, $identifiers);
3129

3230
$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
3331
return ($value !== '*');

benchmarks/SingleEventMultipleSharedListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ public function setUp()
2121
for ($i = 0; $i < $this->numListeners; $i += 1) {
2222
$this->sharedEvents->attach($identifiers[0], 'dispatch', $this->generateCallback());
2323
}
24-
$this->events = new EventManager();
25-
$this->events->setSharedManager($this->sharedEvents);
26-
$this->events->setIdentifiers([$identifiers[0]]);
24+
$this->events = new EventManager($this->sharedEvents, [$identifiers[0]]);
2725
}
2826

2927
/**

benchmarks/SingleEventSingleSharedListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public function setUp()
1919
$identifiers = $this->getIdentifierList();
2020
$this->sharedEvents = new SharedEventManager();
2121
$this->sharedEvents->attach($identifiers[0], 'dispatch', $this->generateCallback());
22-
$this->events = new EventManager();
23-
$this->events->setSharedManager($this->sharedEvents);
24-
$this->events->setIdentifiers([$identifiers[0]]);
22+
$this->events = new EventManager($this->sharedEvents, [$identifiers[0]]);
2523
}
2624

2725
/**

composer.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
{
22
"name": "zendframework/zend-eventmanager",
3-
"description": " ",
3+
"description": "Trigger and listen to events within a PHP application",
44
"license": "BSD-3-Clause",
55
"keywords": [
66
"zf2",
7+
"event",
8+
"events",
79
"eventmanager"
810
],
911
"homepage": "https://github.com/zendframework/zend-eventmanager",
10-
"autoload": {
11-
"psr-4": {
12-
"Zend\\EventManager\\": "src/"
13-
}
14-
},
15-
"require": {
16-
"php": ">=5.5",
17-
"zendframework/zend-stdlib": "~2.5",
18-
"athletic/athletic": "dev-master"
19-
},
2012
"minimum-stability": "dev",
2113
"prefer-stable": true,
2214
"extra": {
2315
"branch-alias": {
2416
"dev-master": "2.5-dev",
25-
"dev-develop": "2.6-dev"
17+
"dev-develop": "3.0-dev"
18+
}
19+
},
20+
"autoload": {
21+
"psr-4": {
22+
"Zend\\EventManager\\": "src/"
2623
}
2724
},
2825
"autoload-dev": {
@@ -31,8 +28,18 @@
3128
"ZendBench\\EventManager\\": "benchmarks/"
3229
}
3330
},
31+
"require": {
32+
"php": ">=5.5"
33+
},
3434
"require-dev": {
35-
"fabpot/php-cs-fixer": "1.7.*",
36-
"phpunit/PHPUnit": "~4.0"
35+
"phpunit/PHPUnit": "~4.0",
36+
"athletic/athletic": "^0.1",
37+
"squizlabs/php_codesniffer": "^2.0@dev",
38+
"zendframework/zend-stdlib": "^2.7.3",
39+
"container-interop/container-interop": "^1.1.0"
40+
},
41+
"suggest": {
42+
"container-interop/container-interop": "^1.1.0, to use the lazy listeners feature",
43+
"zendframework/zend-stdlib": "^2.7.3, to use the FilterChain feature"
3744
}
3845
}

0 commit comments

Comments
 (0)