amp-toolbox-php icon indicating copy to clipboard operation
amp-toolbox-php copied to clipboard

Raise PHPStan level for the `amp/common` package to 5

Open schlessera opened this issue 5 years ago • 2 comments

Feature description

The Common package (ampproject/common) is currently sitting at and enforcing level 4 of PHPStan static analysis.

There are 2 errors that need to be fixed so that we can raise the level to 5 and enforce this new quality level in Travis CI.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • PHPStan does not show any detected errors when run on level 5.

Implementation brief

  • Change the level to 5 in the file phpstan.neon.dist.
  • Run composer analyze.
  • Fix detected errors until no more are found.

QA testing instructions

Demo

Changelog entry

schlessera avatar May 12 '20 20:05 schlessera

Exception/FailedToGetFromRemoteUrl.php

Line Error
66 Parameter ampproject/amp-wp#2 $code of class AmpProject\Exception\FailedToGetFromRemoteUrl constructor expects int, null given.

RuntimeVersion.php

Line Error
102 Parameter ampproject/amp-wp#3 $pad_string of function str_pad expects string, int given.

schlessera avatar May 12 '20 20:05 schlessera

Moving this to amp-toolbox-php since the code has moved there.

westonruter avatar Apr 14 '22 16:04 westonruter