diff --git a/.gitattributes b/.gitattributes index 331e303e3..75acaa968 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,6 +7,7 @@ /.editorconfig export-ignore /.php-cs-fixer.dist.php export-ignore /phpstan.neon export-ignore +/phpstan-baseline.neon export-ignore /phpunit.php export-ignore /phpunit.xml.dist export-ignore /.travis.yml export-ignore diff --git a/composer.json b/composer.json index e55188c86..e4dcd7875 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "ext-ftp": "*", "microsoft/azure-storage-blob": "^1.1", "phpunit/phpunit": "^9.5.11|^10.0", - "phpstan/phpstan": "^0.12.26", + "phpstan/phpstan": "^1.10", "phpseclib/phpseclib": "^3.0.14", "aws/aws-sdk-php": "^3.220.0", "composer/semver": "^3.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..6a6a79e21 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,150 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\$connection of method League\\\\Flysystem\\\\Ftp\\\\FtpAdapter\\:\\:resolveConnectionRoot\\(\\) has invalid type FTP\\\\Connection\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Unsafe access to private property League\\\\Flysystem\\\\GoogleCloudStorage\\\\GoogleCloudStorageAdapter\\:\\:\\$algoToInfoMap through static\\:\\:\\.$#" + count: 1 + path: src/GoogleCloudStorage/GoogleCloudStorageAdapter.php + + - + message: "#^Unsafe access to private property League\\\\Flysystem\\\\GoogleCloudStorage\\\\GoogleCloudStorageAdapterTest\\:\\:\\$adapterPrefix through static\\:\\:\\.$#" + count: 3 + path: src/GoogleCloudStorage/GoogleCloudStorageAdapterTest.php + + - + message: "#^Unsafe access to private property League\\\\Flysystem\\\\GoogleCloudStorage\\\\GoogleCloudStorageAdapterTest\\:\\:\\$bucket through static\\:\\:\\.$#" + count: 5 + path: src/GoogleCloudStorage/GoogleCloudStorageAdapterTest.php + + - + message: "#^Unsafe access to private property League\\\\Flysystem\\\\GoogleCloudStorage\\\\GoogleCloudStorageAdapterTest\\:\\:\\$prefixer through static\\:\\:\\.$#" + count: 3 + path: src/GoogleCloudStorage/GoogleCloudStorageAdapterTest.php + + - + message: "#^Offset 2 does not exist on array\\{League\\\\Flysystem\\\\FilesystemOperator, string\\}\\.$#" + count: 1 + path: src/MountManager.php + + - + message: "#^Unsafe access to private property League\\\\Flysystem\\\\ZipArchive\\\\ZipArchiveAdapterTestCase\\:\\:\\$archiveProvider through static\\:\\:\\.$#" + count: 10 + path: src/ZipArchive/ZipArchiveAdapterTestCase.php + - + message: "#^Parameter \\#1 \\$ftp of function ftp_chdir expects FTP\\\\Connection, resource given\\.$#" + count: 2 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_chmod expects FTP\\\\Connection, resource given\\.$#" + count: 2 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_delete expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_fget expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_fput expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_mdtm expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_mkdir expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_raw expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_rawlist expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_rename expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_rmdir expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_size expects FTP\\\\Connection, resource given\\.$#" + count: 2 + path: src/Ftp/FtpAdapter.php + + - + message: "#^Method League\\\\Flysystem\\\\Ftp\\\\FtpConnectionProvider\\:\\:createConnectionResource\\(\\) should return resource but returns FTP\\\\Connection\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_close expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_login expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_pasv expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_raw expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_set_option expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProvider.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_close expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/FtpConnectionProviderTest.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_raw expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/NoopCommandConnectivityChecker.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_close expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/NoopCommandConnectivityCheckerTest.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_rawlist expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/RawListFtpConnectivityChecker.php + + - + message: "#^Parameter \\#1 \\$ftp of function ftp_close expects FTP\\\\Connection, resource given\\.$#" + count: 1 + path: src/Ftp/RawListFtpConnectivityCheckerTest.php diff --git a/phpstan.neon b/phpstan.neon index fe58406ba..6e2190380 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,5 @@ +includes: + - phpstan-baseline.neon parameters: level: 6 paths: @@ -7,7 +9,7 @@ parameters: checkGenericClassInNonGenericObjectType: false scanFiles: - src/AdapterTestUtilities/test-functions.php - excludes_analyse: + excludePaths: - src/AdapterTestUtilities/ - src/AsyncAwsS3 - src/AwsS3V3