Skip to content

Commit a79563e

Browse files
committed
Housekeeping for 3.0
This commit does the minimum to start a new 3.0 series development. - Removed obsolete files (travis.yml, scrutinizer.yml, couscous.yml) and added a GitHub workflow. - Updated the code enough to run on PHP 8.5. - Updated dependencies and changed just enough to run. - Updated tests just enough to run them.
1 parent 4eaa861 commit a79563e

16 files changed

Lines changed: 109 additions & 157 deletions

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
php: [ '8.5' ]
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php }}
22+
23+
- name: Get composer cache
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.cache/composer
27+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-composer-
30+
31+
- name: Install dependencies
32+
run: composer install --no-progress --no-suggest --prefer-dist --no-interaction
33+
34+
- name: Run PHPUnit
35+
run: vendor/bin/phpunit --configuration phpunit.xml.dist

.scrutinizer.yml

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

.travis.yml

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

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Respect\Config
22

3-
[![Build Status](https://img.shields.io/travis/Respect/Config.svg?style=flat-square)](http://travis-ci.org/Respect/Config)
4-
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Respect/Config.svg?style=flat-square)](https://scrutinizer-ci.com/g/Respect/Config/?branch=master)
53
[![Latest Stable Version](https://img.shields.io/packagist/v/respect/config.svg?style=flat-square)](https://packagist.org/packages/respect/config)
64
[![Total Downloads](https://img.shields.io/packagist/dt/respect/config.svg?style=flat-square)](https://packagist.org/packages/respect/config)
75
[![License](https://img.shields.io/packagist/l/respect/config.svg?style=flat-square)](https://packagist.org/packages/respect/config)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
}
1818
},
1919
"require": {
20-
"php": ">=5.3.0",
21-
"container-interop/container-interop": "^1.1"
20+
"php": ">=8.5.0",
21+
"psr/container": "^2.0"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "~4.4",
25-
"respect/test": "dev-master"
24+
"phpunit/phpunit": "^10.0",
25+
"mikey179/vfsstream": "^1.6"
2626
},
2727
"extra": {
2828
"branch-alias": {

couscous.yml

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

library/Respect/Config/Container.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use ArrayObject;
77
use ReflectionClass;
88
use ReflectionFunction;
9-
use Interop\Container\ContainerInterface;
9+
use Psr\Container\ContainerInterface;
1010

1111
class Container extends ArrayObject implements ContainerInterface
1212
{
@@ -22,13 +22,13 @@ public function __isset($name)
2222
return $this->has($name);
2323
}
2424

25-
public function has($name)
25+
public function has(string $id): bool
2626
{
2727
if ($this->configurator) {
2828
$this->configure();
2929
}
3030

31-
return parent::offsetExists($name);
31+
return parent::offsetExists($id);
3232
}
3333

3434
public function __invoke($spec)
@@ -46,7 +46,7 @@ public function __invoke($spec)
4646
$container = $this;
4747
$arguments = array_map(
4848
function ($param) use ($container) {
49-
if ($paramClass = $param->getClass()) {
49+
if ($paramClass = $param->getType()) {
5050
$paramClassName = $paramClass->getName();
5151

5252
return $container->getItem($paramClassName);
@@ -125,9 +125,9 @@ public function getItem($name, $raw = false)
125125
return $this->lazyLoad($name);
126126
}
127127

128-
public function get($name)
128+
public function get(string $id)
129129
{
130-
return $this->getItem($name);
130+
return $this->getItem($id);
131131
}
132132

133133
public function loadString($configurator)
@@ -288,14 +288,14 @@ protected function parseConstants($value)
288288
protected function matchSequence(&$value)
289289
{
290290
if (preg_match('/^\[(.*?,.*?)\]$/', $value, $match)) {
291-
return (boolean) ($value = $match[1]);
291+
return (bool) ($value = $match[1]);
292292
}
293293
}
294294

295295
protected function matchReference(&$value)
296296
{
297297
if (preg_match('/^\[([[:alnum:]_\\\\]+)\]$/', $value, $match)) {
298-
return (boolean) ($value = $match[1]);
298+
return (bool) ($value = $match[1]);
299299
}
300300
}
301301

library/Respect/Config/Instantiator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct($className)
2525
list($mode, $className) = explode(' ', $className, 2);
2626
$this->mode = $mode;
2727
}
28+
2829
$this->reflection = new ReflectionClass($className);
2930
$this->constructor = $this->findConstructorParams($this->reflection);
3031
$this->className = $className;

library/Respect/Config/NotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Respect\Config;
44

5-
use Interop\Container\Exception\NotFoundException as BaseNotFoundException;
5+
use Psr\Container\NotFoundExceptionInterface as BaseNotFoundException;
66

77
class NotFoundException extends \Exception implements BaseNotFoundException
88
{

phpunit.xml.dist

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
<phpunit backupGlobals="false"
2-
backupStaticAttributes="false"
3-
cacheTokens="true"
4-
convertErrorsToExceptions="true"
5-
convertNoticesToExceptions="true"
6-
convertWarningsToExceptions="true"
72
processIsolation="false"
8-
stopOnFailure="false"
9-
syntaxCheck="false"
10-
verbose="false">
3+
stopOnFailure="false">
114
<testsuites>
12-
<testsuite>
5+
<testsuite name="Respect\Config">
136
<directory suffix="Test.php">tests</directory>
147
</testsuite>
158
</testsuites>

0 commit comments

Comments
 (0)