Skip to content

Commit

Permalink
Merge pull request #141 from coenjacobs/cleanup-tests
Browse files Browse the repository at this point in the history
Cleanup test suite
  • Loading branch information
coenjacobs authored Oct 22, 2022
2 parents 75ae1f9 + ee76077 commit 4f9d00f
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 313 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/analysis.yml

This file was deleted.

32 changes: 25 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and test
name: Lint, analyse and test

on:
push:
Expand All @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.3', '7.4', '8.0']
php: ['7.3', '7.4', '8.0', '8.1']
name: PHP ${{ matrix.php }} tests
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@1.3.7
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Debugging
Expand All @@ -30,13 +30,31 @@ jobs:
run: composer install --prefer-dist --no-suggest --no-progress
- name: Run tests
run: vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer
analysis:
runs-on: ubuntu-latest
name: Analysis of code
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress
- name: Run validate
run: composer run analysis
lint:
runs-on: ubuntu-latest
name: Lint project files
name: Lint all project files
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@1.3.7
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Debugging
Expand Down
15 changes: 14 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,30 @@
"CoenJacobs\\Mozart\\": "src/"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"mheap/phpunit-github-actions-printer": "^1.4",
"vimeo/psalm": "^4.4"
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/extension-installer": "^1.2"
},
"scripts": {
"lint": [
"composer validate",
"phpcs"
],
"analysis": [
"@analysis:phpstan"
],
"analysis:phpstan": [
"./vendor/bin/phpstan --memory-limit=2G"
],
"test": [
"phpunit"
]
Expand Down
211 changes: 211 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
parameters:
ignoreErrors:
-
message: "#^Method CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Autoloader\\:\\:getSearchNamespace\\(\\) has no return type specified\\.$#"
count: 1
path: src/Composer/Autoload/Autoloader.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Autoloader\\:\\:processConfig\\(\\) has no return type specified\\.$#"
count: 1
path: src/Composer/Autoload/Autoloader.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Autoloader\\:\\:processConfig\\(\\) has parameter \\$autoloadConfig with no type specified\\.$#"
count: 1
path: src/Composer/Autoload/Autoloader.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Classmap\\:\\:processConfig\\(\\) has parameter \\$autoloadConfig with no type specified\\.$#"
count: 1
path: src/Composer/Autoload/Classmap.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Classmap\\:\\:\\$files type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Composer/Autoload/Classmap.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Classmap\\:\\:\\$paths type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Composer/Autoload/Classmap.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\NamespaceAutoloader\\:\\:processConfig\\(\\) has parameter \\$autoloadConfig with no type specified\\.$#"
count: 1
path: src/Composer/Autoload/NamespaceAutoloader.php

-
message: "#^PHPDoc tag @var has invalid value \\(\\)\\: Unexpected token \"\\*/\", expected type at offset 9$#"
count: 1
path: src/Composer/Package.php

-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
path: src/Composer/Package.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Composer\\\\Package\\:\\:\\$config has no type specified\\.$#"
count: 1
path: src/Composer/Package.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Composer\\\\Package\\:\\:\\$dependencies type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Composer/Package.php

-
message: "#^Access to an undefined property object\\:\\:\\$dep_namespace\\.$#"
count: 2
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:getAllDependenciesOfPackage\\(\\) has parameter \\$dependencies with no value type specified in iterable type array\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:getAllDependenciesOfPackage\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:movePackage\\(\\) has parameter \\$package with no type specified\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:movePackages\\(\\) has parameter \\$packages with no value type specified in iterable type array\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:replacePackage\\(\\) has parameter \\$package with no type specified\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:replacePackages\\(\\) has parameter \\$packages with no value type specified in iterable type array\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:replaceParentInTree\\(\\) has parameter \\$packages with no value type specified in iterable type array\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^PHPDoc tag @var has invalid value \\(\\)\\: Unexpected token \"\\*/\", expected type at offset 9$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 2
path: src/Console/Commands/Compose.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:\\$config has no type specified\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Console\\\\Commands\\\\Compose\\:\\:\\$workingDir \\(string\\) does not accept string\\|false\\.$#"
count: 1
path: src/Console/Commands/Compose.php

-
message: "#^Access to an undefined property CoenJacobs\\\\Mozart\\\\Composer\\\\Autoload\\\\Autoloader\\:\\:\\$namespace\\.$#"
count: 1
path: src/Mover.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Mover\\:\\:__construct\\(\\) has parameter \\$config with no type specified\\.$#"
count: 1
path: src/Mover.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Mover\\:\\:__construct\\(\\) has parameter \\$workingDir with no type specified\\.$#"
count: 1
path: src/Mover.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Mover\\:\\:\\$movedPackages type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Mover.php

-
message: "#^Anonymous function has an unused use \\$contents\\.$#"
count: 1
path: src/Replace/ClassmapReplacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\ClassmapReplacer\\:\\:replace\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: src/Replace/ClassmapReplacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\ClassmapReplacer\\:\\:saveReplacedClass\\(\\) has parameter \\$classname with no type specified\\.$#"
count: 1
path: src/Replace/ClassmapReplacer.php

-
message: "#^Strict comparison using \\=\\=\\= between false and non\\-falsy\\-string will always evaluate to false\\.$#"
count: 1
path: src/Replace/ClassmapReplacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\NamespaceReplacer\\:\\:replace\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: src/Replace/NamespaceReplacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\Replacer\\:\\:replace\\(\\) has no return type specified\\.$#"
count: 1
path: src/Replace/Replacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\Replacer\\:\\:replace\\(\\) has parameter \\$contents with no type specified\\.$#"
count: 1
path: src/Replace/Replacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replace\\\\Replacer\\:\\:setAutoloader\\(\\) has no return type specified\\.$#"
count: 1
path: src/Replace/Replacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replacer\\:\\:__construct\\(\\) has parameter \\$config with no type specified\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replacer\\:\\:__construct\\(\\) has parameter \\$workingDir with no type specified\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Method CoenJacobs\\\\Mozart\\\\Replacer\\:\\:replaceInFile\\(\\) has parameter \\$targetFile with no type specified\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Parameter \\#2 \\$contents of method League\\\\Flysystem\\\\Filesystem\\:\\:put\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Parameter \\#3 \\$subject of function preg_replace_callback expects array\\|string, string\\|null given\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Property CoenJacobs\\\\Mozart\\\\Replacer\\:\\:\\$replacedClasses type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Replacer.php

-
message: "#^Strict comparison using \\=\\=\\= between false and non\\-falsy\\-string will always evaluate to false\\.$#"
count: 2
path: src/Replacer.php
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon

parameters:
level: 8
reportUnmatchedIgnoredErrors: false
paths:
- ./src
15 changes: 0 additions & 15 deletions psalm.xml

This file was deleted.

2 changes: 0 additions & 2 deletions src/Console/Commands/Compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ public function replacePackage($package): void
* @param ((int|string)|mixed)[] $slugs
*
* @return Package[]
*
* @psalm-return array<array-key, Package>
*/
private function findPackages(array $slugs): array
{
Expand Down
Loading

0 comments on commit 4f9d00f

Please sign in to comment.