Skip to content

Commit 26f1117

Browse files
committedApr 6, 2023
fix the tests,
fix phpstan level 3, run phpspec (it fails but at least its running), lock the php-etl packages version numbers
1 parent c989599 commit 26f1117

File tree

7 files changed

+946
-348
lines changed

7 files changed

+946
-348
lines changed
 

‎.github/workflows/phpspec.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3
8+
- uses: shivammathur/setup-php@v2
9+
with:
10+
php-version: '8.2'
11+
tools: composer:v2
12+
coverage: pcov
813
- uses: php-actions/composer@v6
914
with:
1015
args: --prefer-dist

‎composer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@
2222
"symfony/expression-language": "^6.0",
2323
"symfony/cache": "^6.0",
2424
"doctrine/inflector": "^2.0",
25-
"php-etl/metadata": "^0.4.0",
26-
"php-etl/mapping-contracts": "^0.4.0",
27-
"php-etl/metadata-contracts": "^0.2.0",
28-
"php-etl/satellite-toolbox": "^0.5.0"
25+
"php-etl/metadata": "*",
26+
"php-etl/mapping-contracts": "0.4.0",
27+
"php-etl/metadata-contracts": "0.2.0",
28+
"php-etl/satellite-toolbox": "*"
2929
},
3030
"require-dev": {
3131
"mikey179/vfsstream": "^1.6",
3232
"phpunit/phpunit": "^10.0",
3333
"phpunit/php-invoker": "*",
3434
"friendsofphp/php-cs-fixer": "^3.0",
3535
"phpstan/phpstan": "^1.10",
36-
"rector/rector": "^0.15"
36+
"rector/rector": "^0.15",
37+
"php-etl/phpspec-extension": "0.4.0"
3738
},
3839
"autoload": {
3940
"psr-4": {

‎composer.lock

+926-119
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎functional/MappingTest.php

-216
This file was deleted.

‎src/Compiler/Compiler.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Kiboko\Contract\Mapping\Compiler\Strategy\StrategyInterface;
1414
use Kiboko\Contract\Mapping\MapperInterface;
1515
use org\bovigo\vfs\vfsStream;
16+
use org\bovigo\vfs\vfsStreamFile;
1617
use PhpParser\PrettyPrinter;
1718

1819
class Compiler
@@ -56,13 +57,13 @@ public function compile(
5657
include_once $context->getFilePath();
5758
}
5859
} else {
59-
if (!\in_array('vfs', stream_get_wrappers())) {
60-
$fs = vfsStream::setup();
61-
}
60+
$fs = vfsStream::setup();
6261

63-
$filename = 'vfs://'.hash('sha512', random_bytes(512)).'.php';
64-
file_put_contents($filename, $prettyPrinter->prettyPrintFile($tree));
65-
include_once $filename;
62+
$filename = hash('sha512', random_bytes(512)).'.php';
63+
$file = new vfsStreamFile($filename);
64+
$file->setContent($prettyPrinter->prettyPrintFile($tree));
65+
$fs->addChild($file);
66+
include_once vfsStream::url('root/'.$filename);
6667
}
6768

6869
return new $fqcn();

‎src/Mapping/Field.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
public function __construct(
1919
private PropertyPathInterface $path,
20-
private Mapping\FieldMapperInterface $child
20+
private Mapping\CompilableMapperInterface&Mapping\FieldMapperInterface $child
2121
) {
2222
$this->accessor = PropertyAccess::createPropertyAccessor();
2323
}

‎src/Mapping/ListField.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(
2424
private PropertyPathInterface $outputPath,
2525
private readonly ExpressionLanguage $interpreter,
2626
private readonly Expression $inputExpression,
27-
private readonly Mapping\ArrayMapperInterface $child
27+
private readonly Mapping\CompilableMapperInterface&Mapping\ArrayMapperInterface $child
2828
) {
2929
$this->accessor = PropertyAccess::createPropertyAccessor();
3030
}

0 commit comments

Comments
 (0)
Please sign in to comment.