Skip to content

Commit

Permalink
Merge pull request #20 from InteractionDesignFoundation/psalm
Browse files Browse the repository at this point in the history
Update dependencies, use Psalm on CI
  • Loading branch information
lptn committed Feb 13, 2023
2 parents a9ff29c + 838fee9 commit 855a32d
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/psalm.yml
@@ -0,0 +1,35 @@
name: Psalm

on:
push:
paths:
- '**.php'
- 'psalm*'

jobs:
psalm:
name: psalm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl
coverage: none

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Run composer install
run: |
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_4_LICENSE_KEY }}"
composer install -n --prefer-dist
- name: Run Psalm
run: ./vendor/bin/psalm --shepherd
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -12,11 +12,12 @@
"license": "MIT",
"require": {
"php": ">=8.0",
"laravel/nova": "^4.0"
"laravel/nova": "^4.20"
},
"require-dev": {
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6 || ^10.0",
"vimeo/psalm": "^5.6"
},
"repositories": [
{
Expand Down
17 changes: 17 additions & 0 deletions psalm-baseline.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
<file src="src/HtmlCard.php">
<MixedArgument>
<code>$htmlContent</code>
</MixedArgument>
<MixedAssignment>
<code>$htmlContent</code>
</MixedAssignment>
<PossiblyUndefinedMethod>
<code>render</code>
</PossiblyUndefinedMethod>
<PropertyNotSetInConstructor>
<code>HtmlCard</code>
</PropertyNotSetInConstructor>
</file>
</files>
22 changes: 22 additions & 0 deletions psalm.xml
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<disableExtensions>
<extension name="random"/>
<extension name="redis"/>
</disableExtensions>
</psalm>
5 changes: 4 additions & 1 deletion src/HtmlCard.php
Expand Up @@ -44,7 +44,10 @@ public function html(string $htmlContent): static
/** Set Markdown code to display in a card (converted into HTML). */
public function markdown(string $markdownContent): static
{
$htmlContent = App::make(MarkdownConverter::class)::parse($markdownContent)->toHtml();
/** @var \InteractionDesignFoundation\HtmlCard\MarkdownConverter $converter */
$converter = App::make(MarkdownConverter::class);

$htmlContent = $converter::parse($markdownContent)->toHtml();

return $this->html($htmlContent);
}
Expand Down

0 comments on commit 855a32d

Please sign in to comment.