Skip to content

Commit 573e77f

Browse files
authored
chore: bump PHPStan to v2.0.x (#118)
* chore: bump PHPStan to v2.0.x * chore: scan `seo-by-rank-math/includes` * chore: more PHPStan fixes
1 parent 477ff13 commit 573e77f

File tree

10 files changed

+108
-70
lines changed

10 files changed

+108
-70
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
- chore: bump PHPStan to v2.0.x
6+
57
## [0.3.3]
68

79
This _minor_ release adds a GraphQL Debug message to the response when attempting to use `Page.seo` for the Posts Archive. It also tests compatibility with WordPress 6.7.2 and WPGraphQL 2.0.0.

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"axepress/wp-graphql-plugin-boilerplate": "^0.1.0"
3232
},
3333
"require-dev": {
34-
"lucatume/wp-browser": "<3.5",
34+
"axepress/wp-graphql-cs": "^2.0.0-beta",
35+
"axepress/wp-graphql-stubs": "^2.0.0",
3536
"codeception/lib-innerbrowser": "^1.0",
3637
"codeception/module-asserts": "^1.0",
3738
"codeception/module-cli": "^1.0",
@@ -42,16 +43,15 @@
4243
"codeception/module-webdriver": "^1.0",
4344
"codeception/phpunit-wrapper": "^9.0",
4445
"codeception/util-universalframework": "^1.0",
45-
"phpunit/phpunit": "^9.5",
46-
"wp-graphql/wp-graphql-testcase": "~3.4.0",
47-
"phpstan/phpstan": "^1.2",
48-
"phpstan/extension-installer": "^1.1",
49-
"szepeviktor/phpstan-wordpress": "^1.0",
50-
"axepress/wp-graphql-stubs": "^1.22.1",
51-
"axepress/wp-graphql-cs": "^2.0.0-beta",
46+
"lucatume/wp-browser": "<3.5",
47+
"php-coveralls/php-coveralls": "^2.5",
5248
"phpcompatibility/php-compatibility": "dev-develop as 9.9.9",
49+
"phpstan/extension-installer": "^1.1",
50+
"phpstan/phpstan": "^2.1.5",
51+
"phpunit/phpunit": "^9.5",
52+
"szepeviktor/phpstan-wordpress": "^2.0.1",
5353
"wp-cli/wp-cli-bundle": "^2.8.1",
54-
"php-coveralls/php-coveralls": "^2.5"
54+
"wp-graphql/wp-graphql-testcase": "~3.4.0"
5555
},
5656
"config": {
5757
"allow-plugins": {

composer.lock

Lines changed: 27 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon.dist

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,31 @@ parameters:
22
level: 8
33
treatPhpDocTypesAsCertain: false
44
inferPrivatePropertyTypeFromConstructor: true
5-
checkAlwaysTrueCheckTypeFunctionCall: true
6-
checkAlwaysTrueInstanceof: true
7-
checkAlwaysTrueStrictComparison: true
85
checkExplicitMixedMissingReturn: true
96
checkFunctionNameCase: true
107
checkInternalClassCaseSensitivity: true
11-
checkMissingIterableValueType: true
128
checkTooWideReturnTypesInProtectedAndPublicMethods: true
139
polluteScopeWithAlwaysIterableForeach: false
1410
polluteScopeWithLoopInitialAssignments: false
1511
reportAlwaysTrueInLastCondition: true
1612
reportStaticMethodSignatures: true
1713
reportWrongPhpDocTypeInVarTag: true
18-
featureToggles:
19-
disableRuntimeReflectionProvider: true
14+
bootstrapFiles:
15+
- phpstan/constants.php
2016
dynamicConstantNames:
2117
- WPGRAPHQL_SEO_AUTOLOAD
2218
stubFiles:
2319
# Simulate added properties
24-
- phpstan/rank-math.stub
2520
- phpstan/class-breadcrumbs.stub
2621
- phpstan/class-choices.stub
27-
- phpstan/class-singular.stub
22+
- phpstan/class-database.stub
2823
- phpstan/class-helpers.stub
24+
- phpstan/class-singular.stub
25+
- phpstan/namespace-rank-math.stub
26+
- phpstan/rank-math.stub
2927
- vendor/axepress/wp-graphql-plugin-boilerplate/phpstan/class-wp-post-type.stub
3028
- vendor/axepress/wp-graphql-plugin-boilerplate/phpstan/class-wp-taxonomy.stub
3129
- vendor/axepress/wp-graphql-plugin-boilerplate/phpstan/Model.stub
32-
bootstrapFiles:
33-
- phpstan/constants.php
3430
paths:
3531
- wp-graphql-rank-math.php
3632
- access-functions.php
@@ -39,10 +35,11 @@ parameters:
3935
- src/
4036
excludePaths:
4137
analyse:
42-
- vendor-prefixed
38+
- vendor-prefixed/
4339
scanFiles:
4440
- vendor/axepress/wp-graphql-stubs/wp-graphql-stubs.php
4541
scanDirectories:
46-
- ../seo-by-rank-math
47-
- ../wp-graphql-woocommerce
42+
- ../seo-by-rank-math/
43+
- ../seo-by-rank-math/includes/
44+
- ../wp-graphql-woocommerce/includes/
4845
- vendor-prefixed/axepress/wp-graphql-plugin-boilerplate/src/

phpstan/class-database.stub

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* The Database.
4+
*
5+
* @since 1.0.0
6+
* @package MyThemeShop
7+
* @subpackage MyThemeShop\Database
8+
* @author MyThemeShop <[email protected]>
9+
*/
10+
11+
namespace MyThemeShop\Database;
12+
13+
/**
14+
* Database class.
15+
*/
16+
class Database {
17+
/**
18+
* Retrieve a Database instance by table name.
19+
*
20+
* @param string $table_name A Database instance id.
21+
*
22+
* @return \MyThemeShop\Database\Query_Builder
23+
*/
24+
public static function table( $table_name ) {}
25+
}
26+
27+
/**
28+
* Query_Builder class.
29+
*/
30+
class Query_Builder {}

phpstan/namespace-rank-math.stub

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace RankMath;
4+
5+
class Frontend_SEO_Score {}
6+
7+
class Settings {}
8+
9+
namespace RankMath\Replace_Variables;
10+
11+
class Manager {}
12+
13+
namespace RankMath\Module;
14+
15+
class Manager {}
16+

src/Modules/Redirection/Connection/RedirectionConnection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ protected static function type_name(): string {
3232
* {@inheritDoc}
3333
*/
3434
public static function register(): void {
35-
/** @var array<string,mixed> $config */
3635
$config = self::get_connection_config(
3736
[
3837
'fromType' => 'RootQuery',

src/Modules/Redirection/Model/Redirection.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
/**
1717
* Class - Redirection
1818
*
19-
* @property ?int $databaseId The redirection database ID.
20-
* @property ?string $dateCreated The date the redirection was created.
19+
* @property ?int $databaseId The redirection database ID.
20+
* @property ?string $dateCreated The date the redirection was created.
2121
* @property ?string $dateCreatedGmt The GMT date the redirection was created.
22-
* @property ?string $dateModified The date the redirection was last modified.
23-
* @property ?string $dateModifiedGmt The GMT date the redirection was last modified.
24-
* @property ?string $dateLastAccessed The date the redirection was last accessed.
25-
* @property ?string $dateLastAccessedGmt The GMT date the redirection was last accessed.
26-
* @property ?int $hits The number of hits for this redirection.
27-
* @property string $id The global ID of the redirection.
28-
* @property ?string $redirectToUrl The URL to redirect to.
29-
* @property ?array $sources The sources for this redirection.
30-
* @property ?string $status The status of the redirection.
31-
* @property ?int $type The type of redirection.
22+
* @property ?string $dateModified The date the redirection was last modified.
23+
* @property ?string $dateModifiedGmt The GMT date the redirection was last modified.
24+
* @property ?string $dateLastAccessed The date the redirection was last accessed.
25+
* @property ?string $dateLastAccessedGmt The GMT date the redirection was last accessed.
26+
* @property ?int $hits The number of hits for this redirection.
27+
* @property string $id The global ID of the redirection.
28+
* @property ?string $redirectToUrl The URL to redirect to.
29+
* @property ?array<string,mixed> $sources The sources for this redirection.
30+
* @property ?string $status The status of the redirection.
31+
* @property ?int $type The type of redirection.
3232
*/
3333
class Redirection extends Model {
3434
/**

src/Utils/RMUtils.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ public static function has_cap( string $capability ): bool {
5454
* @return \MyThemeShop\Database\Query_Builder
5555
*/
5656
public static function get_redirections_table() {
57-
/**
58-
* Query_Builder gives us the methods we need to interact with.
59-
*
60-
* @var \MyThemeShop\Database\Query_Builder
61-
*/
6257
return Database::table( 'rank_math_redirections' );
6358
}
6459

vendor/composer/installed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'axepress/wp-graphql-rank-math',
44
'pretty_version' => 'dev-develop',
55
'version' => 'dev-develop',
6-
'reference' => '1cf41e140fb2c8b810cdb4dc93f6befec9bf482a',
6+
'reference' => '191148867d74f25ed7ae2ffd3fef88dd8c1f77a1',
77
'type' => 'wordpress-plugin',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -22,7 +22,7 @@
2222
'axepress/wp-graphql-rank-math' => array(
2323
'pretty_version' => 'dev-develop',
2424
'version' => 'dev-develop',
25-
'reference' => '1cf41e140fb2c8b810cdb4dc93f6befec9bf482a',
25+
'reference' => '191148867d74f25ed7ae2ffd3fef88dd8c1f77a1',
2626
'type' => 'wordpress-plugin',
2727
'install_path' => __DIR__ . '/../../',
2828
'aliases' => array(),

0 commit comments

Comments
 (0)