- Issue created by @Eli-T
- Merge request !15Issue #3409513: šØ Fix PHPCS and PHPStan issues reported by Gitlab CI ā (Merged) created by Eli-T
- Status changed to Needs work
11 months ago 6:19pm 18 December 2023 - š¬š§United Kingdom Eli-T Manchester
MR 15 fixes the PHPCS issues.
I'm thinking about splitting this issue as fixing all the PHPStan issues will necessitate potentially breaking backwards compatibility.
- Status changed to Needs review
11 months ago 5:27pm 20 December 2023 - š¬š§United Kingdom Eli-T Manchester
With respect to #3409514-3: Fix PHPCS and PHPStan issues reported by Gitlab CI ā and having read Drupal's BC policy especially concerning constructors being considered internal, I think we can resolve all the PHPCS and PHPStan issues without forcing a new release.
- thakurnishant_06 India
Hello @Eli-T,
I ran the pipeline, and no errors were reported. However, when I ran PHPStan locally with level 0, it highlighted many errors and warnings. - š¬š§United Kingdom Eli-T Manchester
Thanks @thakurnishant_06
Are you sure you are running phpstan against the fork used by the merge request?
Running locally with level 0 I get
~/code/d10stans3 via š v8.1.13 on āļø (eu-west-1) took 4s āÆ vendor/bin/phpstan Note: Using configuration file /Users/eli/code/d10stans3/phpstan.neon. 11/11 [āāāāāāāāāāāāāāāāāāāāāāāāāāāā] 100% [OK] No errors
- š¬š§United Kingdom Eli-T Manchester
@thakurnishant_06 If you are definitely running against the correct code can you please share your full phpstan.neon and your output of running phpstan?
- thakurnishant_06 India
Hi @Eli-t,
Apologies for the delayed response. Here are the warnings and errors reported by PHPStan when i ran it locally.
vendor/bin/phpstan Note: Using configuration file /home/svinfotech/Pictures/drupal9/phpstan.neon. 11/11 [āāāāāāāāāāāāāāāāāāāāāāāāāāāā] 100% ------ -------------------------------------------------------------------------------------------- Line src/AwsCacheAdapter.php ------ -------------------------------------------------------------------------------------------- 11 Class Drupal\flysystem_s3\AwsCacheAdapter implements unknown interface Aws\CacheInterface. š” Learn more at https://phpstan.org/user-guide/discovering-symbols ------ -------------------------------------------------------------------------------------------- ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Line src/Controller/S3CorsUploadAjaxController.php ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 64 Parameter $flysystem_factory of method Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::__construct() has invalid type Drupal\flysystem\FlysystemFactory. 111 Instantiated class Aws\S3\PostObjectV4 not found. š” Learn more at https://phpstan.org/user-guide/discovering-symbols ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Line src/Flysystem/Adapter/S3Adapter.php ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 Class Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter extends unknown class League\Flysystem\AwsS3v3\AwsS3Adapter. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 26 Parameter $client of method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::__construct() has invalid type Aws\S3\S3ClientInterface. 34 Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::__construct() calls parent::__construct() but Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter does not extend any class. 42 Call to an undefined method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::applyPathPrefix(). 44 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$bucket. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 44 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$options. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 44 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$s3Client. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 47 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$bucket. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 47 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$s3Client. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 51 Call to an undefined method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::doesDirectoryExist(). 54 Caught class Aws\S3\Exception\S3Exception not found. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 63 Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::getMetadata() calls parent::getMetadata() but Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter does not extend any class. 70 Access to constant VISIBILITY_PUBLIC on an unknown class League\Flysystem\AdapterInterface. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 80 Parameter $config of method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::upload() has invalid type League\Flysystem\Config. 81 Call to an undefined method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::applyPathPrefix(). 82 Call to an undefined method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::getOptionsFromConfig(). 87 Call to static method guessMimeType() on an unknown class League\Flysystem\Util. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 90 Call to static method detectByFilename() on an unknown class League\Flysystem\Util\MimeType. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 95 Call to static method contentSize() on an unknown class League\Flysystem\Util. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 95 Call to static method getStreamSize() on an unknown class League\Flysystem\Util. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 98 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$bucket. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 98 Access to an undefined property Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::$s3Client. š” Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 100 Call to an undefined method Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::normalizeResponse(). ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- Line src/Flysystem/S3.php ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- Class Drupal\flysystem\Plugin\FlysystemUrlTrait was not found while trying to analyse it - discovering symbols is probably not configured properly. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 99 Class Drupal\flysystem\Plugin\FlysystemUrlTrait was not found while trying to analyse it - discovering symbols is probably not configured properly. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 114 Class Drupal\flysystem\Plugin\FlysystemUrlTrait was not found while trying to analyse it - discovering symbols is probably not configured properly. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 122 Class Drupal\flysystem\Plugin\FlysystemUrlTrait was not found while trying to analyse it - discovering symbols is probably not configured properly. š” Learn more at https://phpstan.org/user-guide/discovering-symbols ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Line tests/src/Functional/ModuleInstallUninstallWebTest.php ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 12 Class Drupal\Tests\flysystem_s3\Functional\ModuleInstallUninstallWebTest extends unknown class Drupal\Tests\flysystem\Functional\ModuleInstallUninstallWebTest. š” Learn more at https://phpstan.org/user-guide/discovering-symbols ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ------ ------------------------------------------------------------------------------------------------------------ Line tests/src/Unit/AwsCacheAdapterTest.php ------ ------------------------------------------------------------------------------------------------------------ 14 Class Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest extends unknown class PHPUnit\Framework\TestCase. š” Learn more at https://phpstan.org/user-guide/discovering-symbols 24 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertSame(). 27 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertSame(). 28 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertSame(). 31 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertNull(). 33 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertFalse(). 48 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertSame(). 51 Call to an undefined method Drupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::assertSame(). ------ ------------------------------------------------------------------------------------------------------------ ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- Line tests/src/Unit/Flysystem/S3Test.php ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- Class Drupal\flysystem\Plugin\FlysystemUrlTrait was not found while trying to analyse it - discovering symbols is probably not configured properly. š” Learn more at https://phpstan.org/user-guide/discovering-symbols ------ ----------------------------------------------------------------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------- Error -- ----------------------------------------------------------------------------------------- Ignored error pattern #^Unsafe usage of new static# was not matched in reported errors. -- ----------------------------------------------------------------------------------------- [ERROR] Found 41 errors
- š¬š§United Kingdom Eli-T Manchester
@thakurnishant_06 looks like you haven't installed the composer dependencies?
- thakurnishant_06 India
@Eli-T, I have installed all the dependencies required for PHPStan, but I'm still encountering errors in my local setup.
- š¬š§United Kingdom Eli-T Manchester
It's not the dependencies for PHPStan that are the issue here, it's the dependencies for flysystem_s3 that are missing.
- thakurnishant_06 India
Added the missing dependencies, executed the test, and verified that it doesn't raise any new errors.
svinfotech1@svinfotech1:/opt/lampp/htdocs/testing$ vendor/bin/phpstan analyze web/modules/flysystem/ -c web/modules/flysystem/phpstan.neon 11/11 [āāāāāāāāāāāāāāāāāāāāāāāāāāāā] 100% [OK] No errors
The last pipe line run was also clean .
Moving it to RTBC.
Thank you. - Status changed to RTBC
11 months ago 9:13am 28 December 2023 - Status changed to Needs review
11 months ago 9:19am 2 January 2024 - š¬š§United Kingdom Eli-T Manchester
Moving back to needs review as I'd like someone using the module to check it for regression. There's no evidence that the module has actually been tested yet.
- š¬š§United Kingdom Eli-T Manchester
Tested with no regressions found. Merged to 2.1.x.
- Status changed to Fixed
11 months ago 2:15pm 4 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.