File tree Expand file tree Collapse file tree 6 files changed +44
-14
lines changed Expand file tree Collapse file tree 6 files changed +44
-14
lines changed Original file line number Diff line number Diff line change 1
1
/vendor /
2
2
/composer.phar
3
3
/composer.lock
4
+ .phpcs-cache
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <ruleset >
3
+ <arg name =" basepath" value =" ." />
4
+ <arg name =" extensions" value =" php" />
5
+ <arg name =" cache" value =" .phpcs-cache" />
6
+ <!-- Show sniff names -->
7
+ <arg value =" s" />
8
+
9
+ <file >src</file >
10
+
11
+ <rule ref =" HardMode" />
12
+
13
+ <rule ref =" SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint" >
14
+ <exclude-pattern type =" relative" >src/CallableResolver.php</exclude-pattern >
15
+ </rule >
16
+ <rule ref =" SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint" >
17
+ <exclude-pattern type =" relative" >src/CallableResolver.php</exclude-pattern >
18
+ </rule >
19
+
20
+ <rule ref =" SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix" >
21
+ <severity >0</severity >
22
+ </rule >
23
+ <rule ref =" SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix" >
24
+ <severity >0</severity >
25
+ </rule >
26
+
27
+ </ruleset >
Original file line number Diff line number Diff line change 21
21
},
22
22
"require-dev" : {
23
23
"laminas/laminas-diactoros" : " ^2.1" ,
24
- "phpunit/phpunit" : " >= 7.0 < 10"
24
+ "phpunit/phpunit" : " >= 7.0 < 10" ,
25
+ "mnapoli/hard-mode" : " ^0.3.0"
26
+ },
27
+ "config" : {
28
+ "allow-plugins" : {
29
+ "dealerdirect/phpcodesniffer-composer-installer" : true
30
+ }
25
31
}
26
32
}
Original file line number Diff line number Diff line change 3
3
namespace DI \Bridge \Slim ;
4
4
5
5
use DI \Container ;
6
+ use Invoker \CallableResolver as InvokerCallableResolver ;
6
7
use Invoker \Invoker ;
7
8
use Invoker \ParameterResolver \AssociativeArrayResolver ;
8
9
use Invoker \ParameterResolver \Container \TypeHintContainerResolver ;
11
12
use Psr \Container \ContainerInterface ;
12
13
use Slim \App ;
13
14
use Slim \Factory \AppFactory ;
14
- use \Invoker \CallableResolver as InvokerCallableResolver ;
15
15
use Slim \Interfaces \CallableResolverInterface ;
16
16
17
17
/**
22
22
*/
23
23
class Bridge
24
24
{
25
- public static function create (ContainerInterface $ container = null ): App
25
+ public static function create (? ContainerInterface $ container = null ): App
26
26
{
27
27
$ container = $ container ?: new Container ;
28
28
@@ -43,11 +43,11 @@ private static function createControllerInvoker(ContainerInterface $container):
43
43
{
44
44
$ resolvers = [
45
45
// Inject parameters by name first
46
- new AssociativeArrayResolver () ,
46
+ new AssociativeArrayResolver ,
47
47
// Then inject services by type-hints for those that weren't resolved
48
48
new TypeHintContainerResolver ($ container ),
49
49
// Then fall back on parameters default values for optional route parameters
50
- new DefaultValueResolver () ,
50
+ new DefaultValueResolver ,
51
51
];
52
52
53
53
$ invoker = new Invoker (new ResolverChain ($ resolvers ), $ container );
Original file line number Diff line number Diff line change 1
- <?php
1
+ <?php declare (strict_types= 1 );
2
2
3
3
namespace DI \Bridge \Slim ;
4
4
12
12
*/
13
13
class CallableResolver implements AdvancedCallableResolverInterface
14
14
{
15
- /**
16
- * @var \Invoker\CallableResolver
17
- */
15
+ /** @var \Invoker\CallableResolver */
18
16
private $ callableResolver ;
19
17
20
18
public function __construct (\Invoker \CallableResolver $ callableResolver )
Original file line number Diff line number Diff line change 1
- <?php
1
+ <?php declare (strict_types= 1 );
2
2
3
3
namespace DI \Bridge \Slim ;
4
4
9
9
10
10
class ControllerInvoker implements InvocationStrategyInterface
11
11
{
12
- /**
13
- * @var InvokerInterface
14
- */
12
+ /** @var InvokerInterface */
15
13
private $ invoker ;
16
14
17
15
public function __construct (InvokerInterface $ invoker )
18
16
{
19
17
$ this ->invoker = $ invoker ;
20
18
}
19
+
21
20
/**
22
21
* Invoke a route callable.
23
22
*
24
23
* @param callable $callable The callable to invoke using the strategy.
25
24
* @param ServerRequestInterface $request The request object.
26
25
* @param ResponseInterface $response The response object.
27
26
* @param array $routeArguments The route's placeholder arguments
28
- *
29
27
* @return ResponseInterface|string The response from the callable.
30
28
*/
31
29
public function __invoke (
You can’t perform that action at this time.
0 commit comments