Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,59 @@ name: PHP tests

on:
push:
branches: [ main ]
branches:
- main
- release/**
pull_request:
branches: [ main ]
branches:
- main

jobs:
build:

strategy:
matrix:
php-versions: ['7.4']
php: ['8.1', '8.2', '8.3']
symfony: ['6.4', '7.1']
exclude:
- php: '8.1'
symfony: '7.1'

runs-on: ubuntu-latest

name: On PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }}

steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php }}
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180

- uses: actions/checkout@v2

- name: Check PHP version
run: php -v

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress

- name: Code lint PHP files
run: ./vendor/bin/phplint
- name: Install Symfony ${{ matrix.symfony }} packages
run: |
composer update symfony/http-kernel:^${{ matrix.symfony }}

- name: Lint PHP files
run: |
curl -Ls https://github.com/overtrue/phplint/releases/latest/download/phplint.phar -o /usr/local/bin/phplint
chmod +x /usr/local/bin/phplint
/usr/local/bin/phplint --no-cache --no-progress -v

- name: Coding standards
run: ./vendor/bin/phpcs
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: release-please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
# Uses https://github.com/marketplace/actions/release-please-action
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
release-type: php

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ Please note this software is in development, usage may change before the 1.0 rel

## Requirements

* PHP 7.4+
* Symfony 5.2+
* PHP 8.1+
* Symfony 6.4+
* [Composer](https://getcomposer.org/)

## Installation

Install via Composer:

```
composer require strata/symfony-frontend:^0.8
composer require strata/symfony-frontend:^0.9
```

Please see [Strata Frontend installation docs](https://docs.strata.dev/frontend/getting-started/installation).
Please see [Strata Frontend installation docs](https://docs.strata.dev/frontend/installation).

## Contributing

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
}
],
"require": {
"php": ">=7.4",
"strata/frontend": "^0.8",
"symfony/http-kernel": "^5.3",
"twig/twig": "^3.0",
"symfony/framework-bundle": "^5.3"
"php": "^8.1",
"strata/frontend": "^0.9",
"symfony/http-kernel": "^6.4|^7.1",
"twig/twig": "^3.10"
},
"autoload": {
"psr-4": {
Expand All @@ -27,10 +26,11 @@
}
},
"require-dev": {
"overtrue/phplint": "^2.3",
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.5",
"symfony/test-pack": "^1.0"
"phpunit/phpunit": "9.5",
"squizlabs/php_codesniffer": "^3.10",
"phpstan/phpstan": "^1.11",
"roave/security-advisories": "dev-latest",
"symfony/test-pack": "^1.1"
},
"config": {
"allow-plugins": false
Expand Down
5 changes: 3 additions & 2 deletions src/ResponseHelper/SymfonyResponseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Strata\SymfonyBundle\ResponseHelper;

use Strata\Data\Helper\UnionTypes;
use Strata\Frontend\ResponseHelper\HeaderValue;
use Strata\Frontend\ResponseHelper\ResponseHelperAbstract;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -21,7 +20,9 @@ class SymfonyResponseHelper extends ResponseHelperAbstract
*/
public function apply($response): Response
{
UnionTypes::assert('response', $response, Response::class);
if ($response instanceof Response === false) {
throw new \InvalidArgumentException('Response must be an instance of Symfony\Component\HttpFoundation\Response');
}

foreach ($this->getHeaders() as $name => $values) {
/** @var HeaderValue $header */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

declare(strict_types=1);

namespace Test\ResponseHelper;
namespace Strata\SymfonyBundle\ResponseHelper;

use FOS\HttpCache\ResponseTagger;
use PHPUnit\Framework\TestCase;
use Strata\Data\Http\Rest;
use Strata\Data\Query\Query;
use Strata\Data\Query\QueryManager;
use Strata\SymfonyBundle\ResponseHelper\SymfonyResponseHelper;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Component\HttpFoundation\Response;
Expand Down