2
2
3
3
namespace PhpSpec \PhpMock \Runner \Maintainer ;
4
4
5
+ use PhpSpec \Runner \Maintainer \Maintainer ;
5
6
use PhpSpec \Runner \MatcherManager ;
6
7
use PhpSpec \Runner \CollaboratorManager ;
7
8
use PhpSpec \Loader \Node \ExampleNode ;
8
- use PhpSpec \SpecificationInterface ;
9
+ use PhpSpec \Specification ;
9
10
use PhpSpec \PhpMock \Wrapper \FunctionCollaborator ;
10
11
use Symfony \Component \EventDispatcher \EventDispatcherInterface as Dispatcher ;
11
12
use PhpSpec \Wrapper \Unwrapper ;
12
13
use PhpSpec \Loader \Transformer \TypeHintIndex ;
13
- use PhpSpec \Runner \Maintainer \MaintainerInterface ;
14
14
use PhpSpec \Event \MethodCallEvent ;
15
15
16
- class FunctionCollaboratorMaintainer implements MaintainerInterface
16
+ class FunctionCollaboratorMaintainer implements Maintainer
17
17
{
18
18
const FUNCTIONS_PARAMETER = 'functions ' ;
19
19
@@ -44,13 +44,14 @@ public function __construct(Dispatcher $dispatcher)
44
44
*/
45
45
public function prepare (
46
46
ExampleNode $ example ,
47
- SpecificationInterface $ context ,
47
+ Specification $ context ,
48
48
MatcherManager $ matchers ,
49
49
CollaboratorManager $ collaborators
50
50
) {
51
51
if (!$ collaborators ->has (self ::FUNCTIONS_PARAMETER )) return false ;
52
52
$ this ->collaborator = new FunctionCollaborator ($ example ->getSpecification ()->getResource ());
53
53
$ collaborators ->set (self ::FUNCTIONS_PARAMETER , $ this ->collaborator );
54
+
54
55
$ this ->dispatcher ->addListener ('beforeMethodCall ' , [$ this , 'revealFunctionProphecy ' ]);
55
56
return true ;
56
57
}
@@ -63,7 +64,7 @@ public function prepare(
63
64
*/
64
65
public function teardown (
65
66
ExampleNode $ example ,
66
- SpecificationInterface $ context ,
67
+ Specification $ context ,
67
68
MatcherManager $ matchers ,
68
69
CollaboratorManager $ collaborators
69
70
) {
@@ -83,15 +84,15 @@ public function revealFunctionProphecy(MethodCallEvent $event)
83
84
*
84
85
* @return bool
85
86
*/
86
- public function supports (ExampleNode $ example )
87
+ public function supports (ExampleNode $ example ): bool
87
88
{
88
89
return true ;
89
90
}
90
91
91
92
/**
92
93
* @return int
93
94
*/
94
- public function getPriority ()
95
+ public function getPriority (): int
95
96
{
96
97
return 40 ;
97
98
}
0 commit comments