Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added phpstan #79

Merged
merged 5 commits into from
Jul 22, 2024
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
39 changes: 39 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests PHPStan in environments

on: [pull_request]

jobs:
php82-laravel-latest-phpstan-postgres:
runs-on: ubuntu-latest
container:
image: escolalms/php:8.2

services:
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
TZ: Europe/Warsaw
ports:
- 5432:5432

steps:
- name: Instantiate package
uses: actions/checkout@v2

- name: Setup environment
run: cp env/postgres/* .

- name: Update composer
run: COMPOSER_ROOT_VERSION=0.9.9 composer update

- name: Clear config
run: vendor/bin/testbench config:clear

- name: Publish things
run: vendor/bin/testbench migrate:fresh

- name: Run tests
run: vendor/bin/phpstan analyse
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ jobs:
- name: Instantiate package
uses: actions/checkout@v2

- name: Update composer
run: composer update

- name: Setup environment
run: cp env/postgres/* .

- name: Update composer
run: composer update

- name: Clear config
run: vendor/bin/testbench config:clear

Expand Down Expand Up @@ -147,12 +147,12 @@ jobs:
- name: Instantiate package
uses: actions/checkout@v2

- name: Update composer
run: composer update

- name: Setup environment
run: cp env/postgres/* .

- name: Update composer
run: composer update

- name: Clear config
run: vendor/bin/testbench config:clear

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"escolalms/topic-type-project": "^0",
"escolalms/assign-without-account": "^0",
"escolalms/video": "^0",
"orchestra/testbench": "^5.0|^6.0",
"phpunit/phpunit": "^9.0"
"orchestra/testbench": ">=5.0",
"phpunit/phpunit": "^9.0",
"nunomaduro/larastan": "^2.0"
},
"suggest": {
"escolalms/auth": "^0.1.54",
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon

parameters:

paths:
- src/

# The level 9 is the highest level
level: 1
3 changes: 3 additions & 0 deletions src/Core/EmailChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ private static function fixHtml(string $html): string
public static function sections(): Collection
{
return new Collection([
// @phpstan-ignore-next-line
new TemplateSectionSchema('title', TemplateSectionTypeEnum::SECTION_TEXT(), true),
// @phpstan-ignore-next-line
new TemplateSectionSchema('content', TemplateSectionTypeEnum::SECTION_MJML(), true),
// @phpstan-ignore-next-line
new TemplateSectionSchema('contentHtml', TemplateSectionTypeEnum::SECTION_HTML(), false, true),
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/MjmlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function render(string $mjml): string
throw new Exception('Missing MJML API id and/or secret');
}

$renderer = new ApiRenderer($apiId, $apiSecret);
$renderer = new ApiRenderer($apiId);
} else {
$renderer = new BinaryRenderer();
}
Expand Down
Loading