Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phpstan: Use stubs, instead of ignoring #938

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

carstingaxion
Copy link
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
Copy link

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.

@mauteri mauteri merged commit fd44c01 into GatherPress:main Oct 4, 2024
3 checks passed
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