Skip to content

Commit bc04ee6

Browse files
authored
Merge pull request #36: Update metafiles and code style
2 parents 51f8373 + 3e4512d commit bc04ee6

21 files changed

Lines changed: 215 additions & 185 deletions

.gitattributes

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
/tests export-ignore
1+
* text=auto
2+
3+
/.* export-ignore
24
/example export-ignore
5+
/tests export-ignore
6+
/*.xml export-ignore
7+
/*.yml export-ignore
8+
/*.lock export-ignore
9+
/*.dist export-ignore
10+
/*.php export-ignore

.github/workflows/cs-fix.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on:
2+
push:
3+
branches:
4+
- '*'
5+
6+
name: Fix Code Style
7+
8+
jobs:
9+
cs-fix:
10+
permissions:
11+
contents: write
12+
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

.gitignore

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
.idea/
2-
.env
1+
/runtime
2+
/vendor
3+
/.idea
4+
/.env
35
composer.lock
4-
vendor/
5-
*.db
6-
clover.xml
76
example/vendor/
8-
go.sum
9-
builds/
10-
.phpunit.result.cache
11-
.phpunit.cache/

.php-cs-fixer.dist.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once 'vendor/autoload.php';
6+
7+
return \Spiral\CodeStyle\Builder::create()
8+
->include(__DIR__ . '/src')
9+
->include(__FILE__)
10+
->allowRisky(true)
11+
->build();

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"jetbrains/phpstorm-attributes": "^1.0",
5252
"mockery/mockery": "^1.4",
5353
"phpunit/phpunit": "^10.0",
54+
"spiral/code-style": "^2.2",
55+
"spiral/dumper": "^3.3",
5456
"vimeo/psalm": ">=5.8"
5557
},
5658
"autoload": {
@@ -66,8 +68,11 @@
6668
}
6769
},
6870
"scripts": {
69-
"tests": "phpunit",
70-
"psalm": "psalm --no-cache"
71+
"cs:diff": "php-cs-fixer fix --dry-run -v --diff --show-progress dots",
72+
"cs:fix": "php-cs-fixer fix -v",
73+
"psalm": "psalm",
74+
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
75+
"tests": "phpunit"
7176
},
7277
"config": {
7378
"sort-packages": true

phpunit.xml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false"
3-
colors="true" processIsolation="false" stopOnFailure="false" stopOnError="false" stderr="true"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache"
5-
backupStaticProperties="false">
6-
<coverage>
7-
<include>
8-
<directory>src</directory>
9-
</include>
10-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheResultFile="runtime/phpunit/result.cache"
6+
backupGlobals="false"
7+
colors="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
stopOnError="false"
11+
stderr="true"
12+
backupStaticProperties="false"
13+
>
1114
<testsuites>
1215
<testsuite name="Test Suite">
1316
<directory suffix="Test.php">tests</directory>
1417
<exclude>tests/generated</exclude>
1518
</testsuite>
1619
</testsuites>
20+
<coverage>
21+
<report>
22+
<html outputDirectory="runtime/phpunit/coverage"/>
23+
<text outputFile="runtime/phpunit/coverage.txt"/>
24+
<clover outputFile="runtime/phpunit/logs/clover.xml"/>
25+
</report>
26+
</coverage>
27+
<source>
28+
<include>
29+
<directory>src</directory>
30+
</include>
31+
<exclude>
32+
<directory>tests</directory>
33+
</exclude>
34+
</source>
1735
<php>
1836
<!-- error_reporting = E_ALL ^ E_DEPRECATED -->
1937
<ini name="error_reporting" value="24575"/>

psalm-baseline.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="dev-master@765dcbfe43002e52e4808b65561842784fe7bcc7"/>

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns="https://getpsalm.org/schema/config"
55
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
6+
errorBaseline="psalm-baseline.xml"
67
errorLevel="1"
78
hoistConstants="true"
89
resolveFromConfigFile="true"

src/Context.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ final class Context implements ContextInterface, \IteratorAggregate, \Countable,
1616
*/
1717
public function __construct(
1818
private array $values,
19-
) {
20-
}
19+
) {}
2120

2221
public function withValue(string $key, mixed $value): ContextInterface
2322
{

src/Internal/Json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public static function encode(mixed $payload): string
3333
*/
3434
public static function decode(string $payload): array
3535
{
36-
return (array)\json_decode($payload, true, self::DEFAULT_JSON_DEPTH, self::DEFAULT_JSON_FLAGS);
36+
return (array) \json_decode($payload, true, self::DEFAULT_JSON_DEPTH, self::DEFAULT_JSON_FLAGS);
3737
}
3838
}

0 commit comments

Comments
 (0)