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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ parameters:
bootstrapFiles:
# Constants, functions, etc. used by GatherPress
- phpstan.stubs
# - vendor/pmc/unit-test/src/classes/autoloader.php
# - vendor/autoload.php
# - gatherpress.php

parallel:
maximumNumberOfProcesses: 1
processTimeout: 300.0
Expand All @@ -23,20 +21,8 @@ parameters:

paths:
- includes/
# - test/

# excludePaths:
# analyse:
# - vendor/

ignoreErrors:
- '#^Constant GATHERPRESS_CACHE_GROUP not found\.$#'
- '#^Constant GATHERPRESS_CORE_FILE not found\.$#'
- '#^Constant GATHERPRESS_CORE_PATH not found\.$#'
- '#^Constant GATHERPRESS_CORE_URL not found\.$#'
- '#^Constant GATHERPRESS_REST_NAMESPACE not found\.$#'
- '#^Constant GATHERPRESS_REQUIRES_PHP not found\.$#'

# core/classes/class-setup.php
#
# A dev-only error, which can occur if the gatherpress is symlinked into a WP instance or called via wp-env or Playground.
Expand Down
8 changes: 8 additions & 0 deletions phpstan.stubs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
*/

namespace {

define( 'GATHERPRESS_CACHE_GROUP', '');
define( 'GATHERPRESS_CORE_FILE', './gatherpress.php');
define( 'GATHERPRESS_CORE_PATH', '.');
define( 'GATHERPRESS_CORE_URL', '');
define( 'GATHERPRESS_REST_NAMESPACE', '');
define( 'GATHERPRESS_REQUIRES_PHP', '');

/**
* Used in includes/core/classes/class-export.php
*
Expand Down