Skip to content

Commit

Permalink
feat: add PHP 8.0 support, action workflow, and php stan
Browse files Browse the repository at this point in the history
  • Loading branch information
antiseptikk committed Mar 19, 2021
1 parent c0b86b9 commit 1afaa91
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/quality-assurance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Quality Assurance

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

env:
APP_ENV: test
PHP_EXTENSIONS: mbstring, bcmath, sqlite3, gd, intl

jobs:
coding-standards:
name: "Coding Standards"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.4', '8.0' ]
steps:
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.PHP_EXTENSIONS }}

- name: "Checkout"
uses: actions/checkout@v2

- name: "Composer Install"
run: composer install --no-interaction --no-progress --no-suggest

- name: "Easy coding standard"
run: ./vendor/bin/ecs check ./src
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
}
],
"require": {
"php": "^7.4"
"php": ">=7.4 || 8.0"
},
"require-dev": {
"antiseptikk/dev-kit": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.0",
"phpunit/phpunit": "^7.3.0",
"brain/monkey": "^2.2.0",
"giacocorsiglia/wordpress-stubs": "^4.9.5"
"giacocorsiglia/wordpress-stubs": "^4.9.5",
"szepeviktor/phpstan-wordpress": "^0.7.4",
"humanmade/psalm-plugin-wordpress": "^2.0",
"php-stubs/wordpress-stubs": "^5.7"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon

parameters:
level: 5
paths:
- plugin.php
- uninstall.php
- src/
21 changes: 21 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="PsalmWordPress\Plugin"/>
</plugins>
<stubs>
<file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php" />
</stubs>
</psalm>
2 changes: 1 addition & 1 deletion src/Encore.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Encore
*/
private string $rootUrl = '';

public function __construct($outputPath, $version, $url, $themePath = null)
public function __construct(string $outputPath, string $version, string $url, ?string $themePath = null)
{
$this->outputPath = $outputPath;
$this->version = $version;
Expand Down

0 comments on commit 1afaa91

Please sign in to comment.