Skip to content

Commit 855a32d

Browse files
authored
Merge pull request #20 from InteractionDesignFoundation/psalm
Update dependencies, use Psalm on CI
2 parents a9ff29c + 838fee9 commit 855a32d

File tree

5 files changed

+81
-3
lines changed

5 files changed

+81
-3
lines changed

.github/workflows/psalm.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Psalm
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'psalm*'
8+
9+
jobs:
10+
psalm:
11+
name: psalm
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.2'
20+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl
21+
coverage: none
22+
23+
- name: Cache composer dependencies
24+
uses: actions/cache@v3
25+
with:
26+
path: vendor
27+
key: composer-${{ hashFiles('composer.lock') }}
28+
29+
- name: Run composer install
30+
run: |
31+
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_4_LICENSE_KEY }}"
32+
composer install -n --prefer-dist
33+
34+
- name: Run Psalm
35+
run: ./vendor/bin/psalm --shepherd

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
"license": "MIT",
1313
"require": {
1414
"php": ">=8.0",
15-
"laravel/nova": "^4.0"
15+
"laravel/nova": "^4.20"
1616
},
1717
"require-dev": {
1818
"orchestra/testbench": "^7.0",
19-
"phpunit/phpunit": "^9.5"
19+
"phpunit/phpunit": "^9.6 || ^10.0",
20+
"vimeo/psalm": "^5.6"
2021
},
2122
"repositories": [
2223
{

psalm-baseline.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
3+
<file src="src/HtmlCard.php">
4+
<MixedArgument>
5+
<code>$htmlContent</code>
6+
</MixedArgument>
7+
<MixedAssignment>
8+
<code>$htmlContent</code>
9+
</MixedAssignment>
10+
<PossiblyUndefinedMethod>
11+
<code>render</code>
12+
</PossiblyUndefinedMethod>
13+
<PropertyNotSetInConstructor>
14+
<code>HtmlCard</code>
15+
</PropertyNotSetInConstructor>
16+
</file>
17+
</files>

psalm.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="false"
10+
errorBaseline="psalm-baseline.xml"
11+
>
12+
<projectFiles>
13+
<directory name="src" />
14+
<ignoreFiles>
15+
<directory name="vendor" />
16+
</ignoreFiles>
17+
</projectFiles>
18+
<disableExtensions>
19+
<extension name="random"/>
20+
<extension name="redis"/>
21+
</disableExtensions>
22+
</psalm>

src/HtmlCard.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public function html(string $htmlContent): static
4444
/** Set Markdown code to display in a card (converted into HTML). */
4545
public function markdown(string $markdownContent): static
4646
{
47-
$htmlContent = App::make(MarkdownConverter::class)::parse($markdownContent)->toHtml();
47+
/** @var \InteractionDesignFoundation\HtmlCard\MarkdownConverter $converter */
48+
$converter = App::make(MarkdownConverter::class);
49+
50+
$htmlContent = $converter::parse($markdownContent)->toHtml();
4851

4952
return $this->html($htmlContent);
5053
}

0 commit comments

Comments
 (0)