Skip to content

Commit aea163d

Browse files
committed
TASK: Add PSR12 and PhpStan analysis
1 parent 16a42c5 commit aea163d

File tree

7 files changed

+70
-2
lines changed

7 files changed

+70
-2
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PHP Test
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})"
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
php-versions: ['8.2', '8.3']
20+
neos-versions: ['8.3']
21+
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Validate composer.json and composer.lock
28+
run: composer validate --strict
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v3
33+
with:
34+
path: vendor
35+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-php-
38+
39+
- name: Set Neos Version
40+
run: composer require neos/neos ^${{ matrix.neos-versions }} --no-progress --no-interaction
41+
42+
- name: Install dependencies
43+
run: composer install --prefer-dist --no-progress
44+
45+
- name: Run test suite
46+
run: composer test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
composer.lock
2+
Packages
3+
vendor

Classes/Aspects/ContentCacheAspect.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Flowpack\FullPageCache\Aspects;
34

45
use Neos\Cache\Frontend\StringFrontend;

Classes/Cache/MetadataAwareStringFrontend.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Flowpack\FullPageCache\Cache;
34

45
use Neos\Cache\Frontend\StringFrontend;

Classes/Middleware/FusionAutoconfigurationMiddleware.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Flowpack\FullPageCache\Middleware;

Classes/Middleware/RequestCacheMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Flowpack\FullPageCache\Middleware;
@@ -10,7 +11,6 @@
1011
use Psr\Http\Server\MiddlewareInterface;
1112
use Psr\Http\Server\RequestHandlerInterface;
1213
use GuzzleHttp\Psr7\Message;
13-
use function GuzzleHttp\Psr7\str;
1414

1515
class RequestCacheMiddleware implements MiddlewareInterface
1616
{
@@ -106,7 +106,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
106106
->withHeader('Cache-Control', 'public, max-age=' . $publicLifetime);
107107
}
108108

109-
$this->cacheFrontend->set($entryIdentifier,[ 'timestamp' => time(), 'response' => Message::toString($response) ], $tags, $lifetime);
109+
$this->cacheFrontend->set($entryIdentifier, [ 'timestamp' => time(), 'response' => Message::toString($response) ], $tags, $lifetime);
110110
$response->getBody()->rewind();
111111
return $response->withHeader(self::HEADER_INFO, 'MISS: ' . $entryIdentifier);
112112
}

composer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"neos/neos": "^8.0 || ^9.0 || dev-master",
88
"guzzlehttp/psr7": "^1.7, !=1.8.0 || ~2.0"
99
},
10+
"require-dev": {
11+
"phpstan/phpstan": "^1.8",
12+
"squizlabs/php_codesniffer": "^3.7"
13+
},
1014
"autoload": {
1115
"psr-4": {
1216
"Flowpack\\FullPageCache\\": "Classes/"
@@ -16,5 +20,17 @@
1620
"neos": {
1721
"package-key": "Flowpack.FullPageCache"
1822
}
23+
},
24+
"scripts": {
25+
"fix:style": "phpcbf --colors --standard=PSR12 Classes",
26+
"test:style": "phpcs --colors -n --standard=PSR12 Classes",
27+
"test:stan": "phpstan analyse Classes",
28+
"cc": "phpstan clear cache",
29+
"test": ["composer test:style" , "composer test:stan"]
30+
},
31+
"config": {
32+
"allow-plugins": {
33+
"neos/composer-plugin": true
34+
}
1935
}
2036
}

0 commit comments

Comments
 (0)