From 91e6d5b85aba32aac578f5508fd77778f1859167 Mon Sep 17 00:00:00 2001 From: Rene Schmidt Date: Tue, 11 Jun 2024 17:15:15 +0200 Subject: [PATCH 1/2] feature: removed phpcpd, introduced PHPStan --- bin/run_tests.sh | 23 +- composer.json | 4 +- phpstan-baseline.neon | 581 ++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 5 + 4 files changed, 590 insertions(+), 23 deletions(-) create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon diff --git a/bin/run_tests.sh b/bin/run_tests.sh index 58583e8..70e289b 100755 --- a/bin/run_tests.sh +++ b/bin/run_tests.sh @@ -3,24 +3,5 @@ mkdir -p ./build/logs -file=/tmp/psr-2-rsd_ruleset_`date +"%d"`.xml -url=https://raw.githubusercontent.com/rene-s/psr-2-rsd/master/psr-2-rsd_ruleset.xml -size=`stat --printf="%s" $file 2>/dev/null` - -if [ ! -f $file ] || [ $size -eq 0 ]; then - wget $url -O $file -fi - -if [ -f $file ]; then - ./vendor/bin/phpcs \ - --report=checkstyle \ - --report-file=./build/logs/checkstyle.xml \ - --standard=./build/phpcs.xml \ - -v ./src ./test \ - --ignore=./test/bootstrap.php \ - --ignore=./test/ui \ - --standard=$file -fi - -./vendor/bin/phpcpd ./src ./test --exclude=./test/ui -./vendor/bin/phpunit --log-junit ./build/logs/junit.xml test +./vendor/bin/phpstan analyse --configuration phpstan.neon src test +./vendor/bin/phpunit --log-junit ./build/logs/junit.xml test \ No newline at end of file diff --git a/composer.json b/composer.json index 857b59d..39d743d 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ "require-dev": { "monolog/monolog": " ~2.9", "phpunit/phpunit": "~9.6", - "sebastian/phpcpd": "~6.0", "squizlabs/php_codesniffer": "~3.7", "phpunit/php-timer": "~5.0", - "fzaninotto/faker": "~1.5" + "fzaninotto/faker": "~1.5", + "phpstan/phpstan": "^1.11" }, "type": "library", "autoload": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..6fcfd50 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,581 @@ +parameters: + ignoreErrors: + - + message: "#^Class Seafile\\\\Client\\\\Http\\\\Client extends @final class GuzzleHttp\\\\Client\\.$#" + count: 1 + path: src/Http/Client.php + + - + message: "#^Method Seafile\\\\Client\\\\Http\\\\Client\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Http/Client.php + + - + message: "#^Method Seafile\\\\Client\\\\Http\\\\Client\\:\\:delete\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Http/Client.php + + - + message: "#^Method Seafile\\\\Client\\\\Http\\\\Client\\:\\:get\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Http/Client.php + + - + message: "#^Method Seafile\\\\Client\\\\Http\\\\Client\\:\\:put\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Http/Client.php + + - + message: "#^Strict comparison using \\=\\=\\= between bool and '/' will always evaluate to false\\.$#" + count: 1 + path: src/Resource/Directory.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\File\\:\\:getMultiPartParams\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/File.php + + - + message: "#^Parameter \\#2 \\$uri of method GuzzleHttp\\\\Client\\:\\:request\\(\\) expects Psr\\\\Http\\\\Message\\\\UriInterface\\|string, array\\\\|string given\\.$#" + count: 1 + path: src/Resource/File.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Library\\:\\:decrypt\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Library.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Library\\:\\:sharePersonal\\(\\) has parameter \\$users with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Library.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Multi\\:\\:copy\\(\\) has parameter \\$srcPaths with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Multi.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Multi\\:\\:delete\\(\\) has parameter \\$paths with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Multi.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Multi\\:\\:move\\(\\) has parameter \\$srcPaths with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Multi.php + + - + message: "#^Method Seafile\\\\Client\\\\Resource\\\\Multi\\:\\:preparePaths\\(\\) has parameter \\$paths with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Resource/Multi.php + + - + message: "#^PHPDoc tag @return with type mixed is not subtype of native type string\\.$#" + count: 1 + path: src/Resource/Resource.php + + - + message: "#^PHPDoc tag @return with type mixed is not subtype of native type string\\.$#" + count: 1 + path: src/Resource/ResourceInterface.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\DirectoryItem\\:\\:fromArray\\(\\) has parameter \\$fromArray with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/DirectoryItem.php + + - + message: "#^Property Seafile\\\\Client\\\\Type\\\\DirectoryItem\\:\\:\\$dir \\(bool\\) does not accept default value of type string\\.$#" + count: 1 + path: src/Type/DirectoryItem.php + + - + message: "#^Property Seafile\\\\Client\\\\Type\\\\SharedLink\\:\\:\\$permissions type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/SharedLink.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\Type\\:\\:__construct\\(\\) has parameter \\$fromArray with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\Type\\:\\:fromArray\\(\\) has parameter \\$fromArray with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\Type\\:\\:getDateTime\\(\\) should return DateTime but returns DateTime\\|false\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\Type\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\Type\\:\\:toJson\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Parameter \\#2 \\$datetime of static method DateTime\\:\\:createFromFormat\\(\\) expects string, float\\|int\\ given\\.$#" + count: 1 + path: src/Type/Type.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\TypeInterface\\:\\:fromArray\\(\\) has parameter \\$fromArray with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/TypeInterface.php + + - + message: "#^Method Seafile\\\\Client\\\\Type\\\\TypeInterface\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Type/TypeInterface.php + + - + message: "#^Right side of && is always true\\.$#" + count: 1 + path: test/bootstrap.php + + - + message: "#^Access to an undefined property Faker\\\\Generator\\|Faker\\\\Provider\\\\Internet\\|Faker\\\\Provider\\\\Lorem\\|Faker\\\\Provider\\\\Person\\:\\:\\$safeEmail\\.$#" + count: 1 + path: test/functional/Resource/AccountTest.php + + - + message: "#^Call to an undefined method Faker\\\\Generator\\|Faker\\\\Provider\\\\Internet\\|Faker\\\\Provider\\\\Lorem\\|Faker\\\\Provider\\\\Person\\:\\:name\\(\\)\\.$#" + count: 1 + path: test/functional/Resource/AccountTest.php + + - + message: "#^Call to an undefined method Faker\\\\Generator\\|Faker\\\\Provider\\\\Internet\\|Faker\\\\Provider\\\\Lorem\\|Faker\\\\Provider\\\\Person\\:\\:sentence\\(\\)\\.$#" + count: 1 + path: test/functional/Resource/AccountTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\AccountTest\\:\\:testAccount\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/AccountTest.php + + - + message: "#^Call to an undefined method Seafile\\\\Client\\\\Type\\\\Library\\:\\:decrypt\\(\\)\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\FileTest\\:\\:testCreate\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\FileTest\\:\\:testHistory\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\FileTest\\:\\:testList\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\FileTest\\:\\:testRename\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Property Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\FileTest\\:\\:\\$libraryResource \\(Seafile\\\\Client\\\\Resource\\\\Library\\|null\\) does not accept Seafile\\\\Client\\\\Type\\\\Library\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Strict comparison using \\=\\=\\= between string and true will always evaluate to false\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Variable \\$cfg in isset\\(\\) is never defined\\.$#" + count: 1 + path: test/functional/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\GroupTest\\:\\:testGetAll\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/GroupTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\ShareLinksTest\\:\\:testShareLinks\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/ShareLinksTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Functional\\\\Resource\\\\StarredFileTest\\:\\:testStarFile\\(\\) has no return type specified\\.$#" + count: 1 + path: test/functional/Resource/StarredFileTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 4 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\AccountTest\\:\\:dataProviderCreateUpdate\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\AccountTest\\:\\:dataProviderRemove\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\AccountTest\\:\\:testCreateUpdate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\AccountTest\\:\\:testRemove\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Account constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 6 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 2 + path: test/unit/Resource/AccountTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 3 + path: test/unit/Resource/AvatarTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Avatar constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 2 + path: test/unit/Resource/AvatarTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 1 + path: test/unit/Resource/AvatarTest.php + + - + message: "#^Parameter \\#5 \\$size of method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\AvatarTest\\:\\:doGetAvatar\\(\\) expects string, int given\\.$#" + count: 3 + path: test/unit/Resource/AvatarTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 6 + path: test/unit/Resource/DirectoryTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 6 + path: test/unit/Resource/DirectoryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\DirectoryTest\\:\\:createNonRecursiveDataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/DirectoryTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Directory constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 7 + path: test/unit/Resource/DirectoryTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 8 + path: test/unit/Resource/DirectoryTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 5 + path: test/unit/Resource/FileTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 3 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:dataProviderCopyInvalid\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:dataProviderCopyMove\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:dataProviderTestRenameInvalidFilename\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:dataProviderTestUrlEncodePath\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:testCopyInvalid\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\FileTest\\:\\:testCopyMove\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/FileTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\File constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 18 + path: test/unit/Resource/FileTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Tests\\\\Unit\\\\Stubs\\\\FileResourceStub constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 7 + path: test/unit/Resource/FileTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 4 + path: test/unit/Resource/FileTest.php + + - + message: "#^Property Seafile\\\\Client\\\\Type\\\\FileHistoryItem\\:\\:\\$id \\(string\\) does not accept int\\.$#" + count: 2 + path: test/unit/Resource/FileTest.php + + - + message: "#^Property Seafile\\\\Client\\\\Type\\\\Library\\:\\:\\$id \\(string\\) does not accept int\\.$#" + count: 4 + path: test/unit/Resource/FileTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Group constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 1 + path: test/unit/Resource/GroupTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 1 + path: test/unit/Resource/GroupTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:dataProviderCreate\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:dataProviderCreateInvalid\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:dataProviderExists\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:testCreate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:testCreateInvalid\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\LibraryTest\\:\\:testExists\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Library constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 9 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 7 + path: test/unit/Resource/LibraryTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 2 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 2 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\MultiTest\\:\\:dataProviderCopyMove\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\MultiTest\\:\\:dataProviderDelete\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\MultiTest\\:\\:testCopyMove\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\MultiTest\\:\\:testDelete\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Multi constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 4 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 2 + path: test/unit/Resource/MultiTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 3 + path: test/unit/Resource/ResourceTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\Directory constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 1 + path: test/unit/Resource/ResourceTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\ShareLinks constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 1 + path: test/unit/Resource/ResourceTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 3 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:method\\(\\)\\.$#" + count: 1 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\ShareLinksTest\\:\\:dataProviderCreate\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\ShareLinksTest\\:\\:dataProviderRemove\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\ShareLinks constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 3 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Parameter \\#1 \\$expected of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) expects class\\-string\\, string given\\.$#" + count: 1 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 1 + path: test/unit/Resource/ShareLinksTest.php + + - + message: "#^Call to an undefined method PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client\\:\\:expects\\(\\)\\.$#" + count: 8 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\StarredFileTest\\:\\:dataProviderUnstar\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Resource\\\\StarredFileTest\\:\\:testUnstar\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Parameter \\#1 \\$client of class Seafile\\\\Client\\\\Resource\\\\StarredFile constructor expects Seafile\\\\Client\\\\Http\\\\Client, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\|Seafile\\\\Client\\\\Http\\\\Client given\\.$#" + count: 6 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Parameter \\#3 \\$body of class GuzzleHttp\\\\Psr7\\\\Response constructor expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string\\|null, string\\|false given\\.$#" + count: 1 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Property Seafile\\\\Client\\\\Type\\\\Library\\:\\:\\$id \\(string\\) does not accept int\\.$#" + count: 4 + path: test/unit/Resource/StarredFileTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\DirectoryItemUnitTest\\:\\:dataFromArray\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/DirectoryItemUnitTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\DirectoryItemUnitTest\\:\\:testFromArray\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/DirectoryItemUnitTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\TypeUnitTest\\:\\:dataProviderTestToArrayAssoc\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/TypeUnitTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\TypeUnitTest\\:\\:dataProviderTestToArrayMultiPart\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/TypeUnitTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\TypeUnitTest\\:\\:testToArrayAssoc\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/TypeUnitTest.php + + - + message: "#^Method Seafile\\\\Client\\\\Tests\\\\Unit\\\\Type\\\\TypeUnitTest\\:\\:testToArrayMultiPart\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + count: 1 + path: test/unit/Type/TypeUnitTest.php + + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" + count: 1 + path: test/unit/Type/TypeUnitTest.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..d11daea --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 7 \ No newline at end of file From 6155cd2b78a6f02a54f8bf949aae260c5a6fec2b Mon Sep 17 00:00:00 2001 From: Rene Schmidt Date: Tue, 11 Jun 2024 21:55:58 +0200 Subject: [PATCH 2/2] feature: removed phpcpd, introduced PHPStan --- .forgejo/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 8d120fe..a5f8472 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v3 - name: Setup PHP - uses: shivammathur/setup-php@v2 + uses: https://github.com/shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo # Add your extensions here. @@ -23,7 +23,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: https://github.com/actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}