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

Commit 6d8beb3

Browse files
committed
Merge branch 'hotfix/31'
Close #32 Fixes #31
2 parents ee413e0 + 70ed87a commit 6d8beb3

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
## 2.6.2 - TBD
5+
## 2.6.2 - 2016-02-25
66

77
### Added
88

@@ -18,7 +18,10 @@ All notable changes to this project will be documented in this file, in reverse
1818

1919
### Fixed
2020

21-
- Nothing.
21+
- [#32](https://github.com/zendframework/zend-session/pull/32) provides a better
22+
polfill for the `ValidatorChain` to ensure it can be represented in
23+
auto-generated classmaps (e.g., via `composer dump-autoload --optimize` and/or
24+
`composer dump-autoload --classmap-authoritative`).
2225

2326
## 2.6.1 - 2016-02-23
2427

src/Validator/ValidatorChainEM2.php renamed to src/Validator/AbstractValidatorChainEM2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
use Zend\Session\Storage\StorageInterface;
1313

1414
/**
15-
* Validator chain for validating sessions (for use with zend-eventmanager v2)
15+
* Abstract validator chain for validating sessions (for use with zend-eventmanager v2).
1616
*/
17-
class ValidatorChainEM2 extends EventManager
17+
abstract class AbstractValidatorChainEM2 extends EventManager
1818
{
1919
use ValidatorChainTrait;
2020

src/Validator/ValidatorChainEM3.php renamed to src/Validator/AbstractValidatorChainEM3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
use Zend\Session\Storage\StorageInterface;
1313

1414
/**
15-
* Validator chain for validating sessions (for use with zend-eventmanager v3)
15+
* Abstract validator chain for validating sessions (for use with zend-eventmanager v3)
1616
*/
17-
class ValidatorChainEM3 extends EventManager
17+
abstract class AbstractValidatorChainEM3 extends EventManager
1818
{
1919
use ValidatorChainTrait;
2020

src/ValidatorChain.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,32 @@
1212
use Zend\EventManager\GlobalEventManager;
1313

1414
/**
15-
* Polyfill for ValidatorChain
15+
* Polyfill for AbstractValidatorChain.
1616
*
1717
* The definitions for EventManagerInterface::attach differ between versions 2
1818
* and 3 of zend-eventmanager, which makes it impossible to override the method
19-
* in a way that is compatible with both. To get around that, we define 2
20-
* classes, one targeting each major version of zend-eventmanager, each
21-
* sharing the same trait, and each defining attach() per the EM version they
22-
* target. This file then aliases the appropriate one to `ValidatorChain`,
19+
* in a way that is compatible with both.
20+
*
21+
* To get around that, we define 2 abstract classes, one targeting each major
22+
* version of zend-eventmanager, and each defining attach() per the EM version
23+
* they target.
24+
*
25+
* This conditional below then aliases the appropriate one to `AbstractValidatorChain`,
2326
* based on which version of the EM is present. Since the `GlobalEventManager`
2427
* is only present in v2, we can use that as our test.
2528
*/
2629
if (class_exists(GlobalEventManager::class)) {
27-
class_alias(Validator\ValidatorChainEM2::class, ValidatorChain::class);
30+
class_alias(Validator\AbstractValidatorChainEM2::class, AbstractValidatorChain::class);
2831
} else {
29-
class_alias(Validator\ValidatorChainEM3::class, ValidatorChain::class);
32+
class_alias(Validator\AbstractValidatorChainEM3::class, AbstractValidatorChain::class);
33+
}
34+
35+
/**
36+
* Validator chain implementation.
37+
*
38+
* Extends the zend-eventmanager-version-specific base class implementation
39+
* as polyfilled above.
40+
*/
41+
class ValidatorChain extends AbstractValidatorChain
42+
{
3043
}

0 commit comments

Comments
 (0)