Skip to content

Fix phpstan: Use stubs, instead of ignoring#938

Merged
mauteri merged 2 commits intoGatherPress:mainfrom
carstingaxion:fix/phpstan-ignores-2-stubs
Oct 4, 2024
Merged

Fix phpstan: Use stubs, instead of ignoring#938
mauteri merged 2 commits intoGatherPress:mainfrom
carstingaxion:fix/phpstan-ignores-2-stubs

Conversation

@carstingaxion
Copy link
Copy Markdown
Collaborator

@carstingaxion carstingaxion commented Oct 4, 2024

After #931 was merged, I realized, that GatherPress could still benefit from type checking for the ignored, not-loaded constants.

Description of the Change

Instead of ignoring, I created stubs, that provide at least the type of data.

Closes #

How to test the Change

composer test:phpstan

Changelog Entry

Fixed - phpstan: Use stubs, instead of ignoring

Credits

Props @carstingaxion

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@carstingaxion carstingaxion marked this pull request as ready for review October 4, 2024 23:12
@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented Oct 4, 2024

PR Summary

  • Enhancement in Code Quality Configuration Files

    • An ongoing process to improve our software's code quality involved the refinement of our phpstan.neon.dist file. This file enables us to check our code's reliability systematically. We've eradicated unnecessary commented-out paths, contributing to a more streamlined, readable configuration.
  • Removal of Ignoring Unknown Constants

    • This update also eradicates some ignore error patterns from the phpstan.neon.dist file. These were earlier employed to overlook undefined constants, like GATHERPRESS_CACHE_GROUP, GATHERPRESS_CORE_FILE, etc. that came across in the code quality checks. This clean-up attempt results in more comprehensive and accurate code quality checks.
  • Explicit Declaration of Constant Definitions

    • We've revisited phpstan.stubs file, enabling us to declare the constants (GATHERPRESS_CACHE_GROUP, GATHERPRESS_CORE_FILE, GATHERPRESS_CORE_PATH, GATHERPRESS_CORE_URL, GATHERPRESS_REST_NAMESPACE, GATHERPRESS_REQUIRES_PHP) explicitly with default values. It fosters improved code understanding, readability, and predictability.

@carstingaxion carstingaxion requested a review from mauteri October 4, 2024 23:13
@mauteri mauteri merged commit fd44c01 into GatherPress:main Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants