ramsey / conventional-commits

:yo_yo: A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook plugin!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHPStan fails for the current codebase

hussainweb opened this issue · comments

Description

PHPStan reports errors when run manually or during a CI run. I saw this first when working on #58 but then I reproduced this on the main branch as well. That is the reason I am creating a new issue and a PR.

Steps to reproduce

  1. Make sure you are on the latest dependencies with composer update
  2. Run composer dev:analyze:phpstan

Expected behavior

We should see a message from PHPStan saying [OK] No errors.

Screenshots or output

See output below or on one of the recent CI runs.

❯ composer dev:analyze:phpstan
> phpstan analyse --ansi
Note: Using configuration file /Users/hw/work/php/conventional-commits/phpstan.neon.dist.
 96/96 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Line   src/ConventionalCommits/Configuration/DefaultConfiguration.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  88     Offset 'bodyWrapWidth' on array{typeCase?: string|null, types?: array<string>, scopeRequired?: bool, scopeCase?: string|null, scopes?: array<string>, descriptionCase?: string|null, descriptionEndMark?: string|null,
         bodyRequired?: bool, ...} on left side of ?? always exists and is not nullable.
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Line   tests/ConventionalCommits/Configuration/DefaultConfigurationTest.php
 ------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  38     Call to method PHPUnit\Framework\Assert::assertSame() with array{typeCase: null, types: array{}, scopeCase: null, scopeRequired: false, scopes: array{}, descriptionCase: null, descriptionEndMark: null, bodyRequired:
         false, ...} and array{typeCase?: string|null, types?: array<string>, scopeRequired?: bool, scopeCase?: string|null, scopes?: array<string>, descriptionCase?: string|null, descriptionEndMark?: string|null, bodyRequired?:
         bool, ...} will always evaluate to false.
  88     Call to method PHPUnit\Framework\Assert::assertSame() with array{typeCase: 'kebab', types: array{'foo', 'bar', 'baz-qux'}, scopeCase: 'lower', scopeRequired: true, scopes: array{'component', 'unit', 'foo'},
         descriptionCase: 'sentence', descriptionEndMark: '.', bodyRequired: true, ...} and array{typeCase?: string|null, types?: array<string>, scopeRequired?: bool, scopeCase?: string|null, scopes?: array<string>,
         descriptionCase?: string|null, descriptionEndMark?: string|null, bodyRequired?: bool, ...} will always evaluate to false.
 ------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Environment details

  • version of this package: main
  • PHP version: 8.1.10
  • OS: macOS

Additional context

None

Fixed in #64