Skip to content

Commit

Permalink
Merge pull request #79 from EscolaLMS/feature/WELLMS-334
Browse files Browse the repository at this point in the history
Added phpstan
  • Loading branch information
daVitekPL committed Jul 22, 2024
2 parents 577b51f + df0b7bc commit faf776c
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 9 deletions.
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

0 comments on commit faf776c

Please sign in to comment.