Skip to content

Commit 5d73f19

Browse files
authored
Merge pull request #88 from andrewnicols/GHAFix
Fixes for newly introduced GH Actions
2 parents 7e367d6 + 69f5e9e commit 5d73f19

File tree

7 files changed

+46
-19
lines changed

7 files changed

+46
-19
lines changed

.github/workflows/ci.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jobs:
1818
matrix:
1919
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
2020
dependency-version: [ '' ]
21-
include:
22-
- php: '7.3'
23-
dependency-version: '--prefer-lowest'
2421
steps:
2522
- name: Checkout
2623
uses: actions/checkout@v4
@@ -30,7 +27,7 @@ jobs:
3027
php-version: ${{ matrix.php }}
3128
coverage: none
3229
- name: Cache Composer dependencies
33-
uses: actions/cache@v3
30+
uses: actions/cache@v4
3431
with:
3532
path: ~/.composer/cache
3633
key: php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}
@@ -53,7 +50,7 @@ jobs:
5350
tools: cs2pr
5451
coverage: none
5552
- name: Cache Composer dependencies
56-
uses: actions/cache@v3
53+
uses: actions/cache@v4
5754
with:
5855
path: ~/.composer/cache
5956
key: php-composer-locked-${{ hashFiles('composer.lock') }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor/
22
/composer.phar
33
/composer.lock
4+
.phpcs-cache

.phpcs.xml.dist

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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>

composer.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
},
2222
"require-dev": {
2323
"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+
}
2531
}
2632
}

src/Bridge.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace DI\Bridge\Slim;
44

55
use DI\Container;
6+
use Invoker\CallableResolver as InvokerCallableResolver;
67
use Invoker\Invoker;
78
use Invoker\ParameterResolver\AssociativeArrayResolver;
89
use Invoker\ParameterResolver\Container\TypeHintContainerResolver;
@@ -11,7 +12,6 @@
1112
use Psr\Container\ContainerInterface;
1213
use Slim\App;
1314
use Slim\Factory\AppFactory;
14-
use \Invoker\CallableResolver as InvokerCallableResolver;
1515
use Slim\Interfaces\CallableResolverInterface;
1616

1717
/**
@@ -22,7 +22,7 @@
2222
*/
2323
class Bridge
2424
{
25-
public static function create(ContainerInterface $container = null): App
25+
public static function create(?ContainerInterface $container = null): App
2626
{
2727
$container = $container ?: new Container;
2828

@@ -43,11 +43,11 @@ private static function createControllerInvoker(ContainerInterface $container):
4343
{
4444
$resolvers = [
4545
// Inject parameters by name first
46-
new AssociativeArrayResolver(),
46+
new AssociativeArrayResolver,
4747
// Then inject services by type-hints for those that weren't resolved
4848
new TypeHintContainerResolver($container),
4949
// Then fall back on parameters default values for optional route parameters
50-
new DefaultValueResolver(),
50+
new DefaultValueResolver,
5151
];
5252

5353
$invoker = new Invoker(new ResolverChain($resolvers), $container);

src/CallableResolver.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace DI\Bridge\Slim;
44

@@ -12,9 +12,7 @@
1212
*/
1313
class CallableResolver implements AdvancedCallableResolverInterface
1414
{
15-
/**
16-
* @var \Invoker\CallableResolver
17-
*/
15+
/** @var \Invoker\CallableResolver */
1816
private $callableResolver;
1917

2018
public function __construct(\Invoker\CallableResolver $callableResolver)

src/ControllerInvoker.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace DI\Bridge\Slim;
44

@@ -9,23 +9,21 @@
99

1010
class ControllerInvoker implements InvocationStrategyInterface
1111
{
12-
/**
13-
* @var InvokerInterface
14-
*/
12+
/** @var InvokerInterface */
1513
private $invoker;
1614

1715
public function __construct(InvokerInterface $invoker)
1816
{
1917
$this->invoker = $invoker;
2018
}
19+
2120
/**
2221
* Invoke a route callable.
2322
*
2423
* @param callable $callable The callable to invoke using the strategy.
2524
* @param ServerRequestInterface $request The request object.
2625
* @param ResponseInterface $response The response object.
2726
* @param array $routeArguments The route's placeholder arguments
28-
*
2927
* @return ResponseInterface|string The response from the callable.
3028
*/
3129
public function __invoke(

0 commit comments

Comments
 (0)