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

Cleanup #1

Draft
wants to merge 7 commits into
base: feature/saccas
Choose a base branch
from
Draft
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
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on:
push:
branches:
- '**'

jobs:
check-composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Validate composer.json
run: composer validate

php-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none

- name: PHP lint
run: "find *.php src/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"

coding-guideline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer install --no-progress

- name: Coding Guideline
run: PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff

code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies with expected TYPO3 version
run: composer install --no-progress

- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/composer.lock
/vendor/
64 changes: 64 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src/',
])
;

$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'php_unit_test_annotation' => ['style' => 'annotation'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder)
;
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ericmartel/codeception-email-mailhog",
"name": "saccas/codeception-email-mailhog",
"description": "Provides test helpers for Codeception when testing email functionality with MailHog",
"license": "MIT",
"authors": [
Expand All @@ -9,12 +9,17 @@
}
],
"require": {
"ericmartel/codeception-email": "^1.0",
"guzzlehttp/guzzle": "^6.1 || ^7.0"
"php": "~8.1.0",
"guzzlehttp/guzzle": "^6.1 || ^7.0",
"codeception/codeception": "^5.0"
},
"autoload": {
"psr-4": {
"Codeception\\Module\\": "src"
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.22",
"phpstan/phpstan": "^1.10"
}
}
51 changes: 51 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
ignoreErrors:
-
message: "#^Access to an undefined property object\\:\\:\\$Body\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Access to an undefined property object\\:\\:\\$Content\\.$#"
count: 11
path: src/MailHog.php

-
message: "#^Access to an undefined property object\\:\\:\\$MIME\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Cannot access property \\$ID on object\\|null\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Method Codeception\\\\Module\\\\MailHog\\:\\:getFullEmail\\(\\) should return object but returns mixed\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Parameter \\#1 \\$inbox of method Codeception\\\\Module\\\\MailHog\\:\\:sortEmails\\(\\) expects array\\<object\\>, mixed given\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Parameter \\#1 \\$string of function mb_decode_mimeheader expects string, string\\|null given\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|string given\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Property Codeception\\\\Module\\\\MailHog\\:\\:\\$fetchedEmails \\(array\\<object\\>\\) does not accept mixed\\.$#"
count: 1
path: src/MailHog.php

-
message: "#^Variable \\$response might not be defined\\.$#"
count: 1
path: src/MailHog.php
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon
parameters:
level: max
phpVersion: 80100
reportUnmatchedIgnoredErrors: true
paths:
- src
Loading