Skip to content

Commit 0ea4709

Browse files
dev: update PHPStan to v2 and set the level to 6
1 parent 982c698 commit 0ea4709

File tree

8 files changed

+6152
-152
lines changed

8 files changed

+6152
-152
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ assets/js/src
7979
lint-staged.config.js
8080
.stylelintrc.json
8181
phpstan.neon
82+
phpstan-baseline.neon
8283
composer-dev.json
8384
composer-dev.lock
8485
SETUP.md

composer-dev.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"lint": "composer run-script phpcs",
4242
"phpcs-i": "phpcs -i",
4343
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=2G --configuration=phpstan.neon",
44+
"phpstan:generate:baseline": "./vendor/bin/phpstan analyse --memory-limit=2G --configuration=phpstan.neon --generate-baseline",
4445
"post-install-cmd": [
4546
"[ ! -z \"$GITHUB_ACTIONS\" ] && yarn run bump-vendor || true"
4647
],
@@ -54,7 +55,7 @@
5455
"optimize-autoloader": true,
5556
"platform-check": false,
5657
"platform": {
57-
"php": "7.2"
58+
"php": "7.4"
5859
},
5960
"allow-plugins": {
6061
"dealerdirect/phpcodesniffer-composer-installer": true
@@ -65,9 +66,9 @@
6566
},
6667
"require-dev": {
6768
"codeinwp/phpcs-ruleset": "dev-main",
68-
"phpstan/phpstan": "1.8.7",
69-
"szepeviktor/phpstan-wordpress": "^v1.1.7",
70-
"php-stubs/woocommerce-stubs": "^7.4.0",
71-
"php-stubs/wordpress-stubs": "^6.1"
69+
"phpstan/phpstan": "^2.1",
70+
"szepeviktor/phpstan-wordpress": "^2.0",
71+
"php-stubs/woocommerce-stubs": "^10.1",
72+
"php-stubs/wordpress-stubs": "^6.8"
7273
}
7374
}

composer-dev.lock

Lines changed: 56 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
55
"This file is @generated automatically"
66
],
7-
"content-hash": "33a849a1bb965e64c9c96d8d6dd5b79b",
7+
"content-hash": "e917b91cea30ce935bb8c26457b84fb5",
88
"packages": [
99
{
1010
"name": "codeinwp/themeisle-sdk",
@@ -268,16 +268,16 @@
268268
},
269269
{
270270
"name": "php-stubs/woocommerce-stubs",
271-
"version": "v7.4.0",
271+
"version": "v10.1.1",
272272
"source": {
273273
"type": "git",
274274
"url": "https://github.com/php-stubs/woocommerce-stubs.git",
275-
"reference": "d8f5b3027f889fdc22729575dd0040a18c5565d2"
275+
"reference": "b8e010db32f6a5876f0c49fda467e15ea5d6f97f"
276276
},
277277
"dist": {
278278
"type": "zip",
279-
"url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/d8f5b3027f889fdc22729575dd0040a18c5565d2",
280-
"reference": "d8f5b3027f889fdc22729575dd0040a18c5565d2",
279+
"url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/b8e010db32f6a5876f0c49fda467e15ea5d6f97f",
280+
"reference": "b8e010db32f6a5876f0c49fda467e15ea5d6f97f",
281281
"shasum": ""
282282
},
283283
"require": {
@@ -306,34 +306,41 @@
306306
],
307307
"support": {
308308
"issues": "https://github.com/php-stubs/woocommerce-stubs/issues",
309-
"source": "https://github.com/php-stubs/woocommerce-stubs/tree/v7.4.0"
309+
"source": "https://github.com/php-stubs/woocommerce-stubs/tree/v10.1.1"
310310
},
311-
"time": "2023-02-19T17:20:03+00:00"
311+
"time": "2025-08-20T15:58:51+00:00"
312312
},
313313
{
314314
"name": "php-stubs/wordpress-stubs",
315-
"version": "v6.1.1",
315+
"version": "v6.8.2",
316316
"source": {
317317
"type": "git",
318318
"url": "https://github.com/php-stubs/wordpress-stubs.git",
319-
"reference": "601c429ba8d91ef50a2a1bec05a7cd38b88064ff"
319+
"reference": "9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8"
320320
},
321321
"dist": {
322322
"type": "zip",
323-
"url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/601c429ba8d91ef50a2a1bec05a7cd38b88064ff",
324-
"reference": "601c429ba8d91ef50a2a1bec05a7cd38b88064ff",
323+
"url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8",
324+
"reference": "9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8",
325325
"shasum": ""
326326
},
327+
"conflict": {
328+
"phpdocumentor/reflection-docblock": "5.6.1"
329+
},
327330
"require-dev": {
328-
"nikic/php-parser": "< 4.12.0",
329-
"php": "~7.3 || ~8.0",
331+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
332+
"nikic/php-parser": "^5.5",
333+
"php": "^7.4 || ^8.0",
330334
"php-stubs/generator": "^0.8.3",
331-
"phpdocumentor/reflection-docblock": "^5.3",
332-
"phpstan/phpstan": "^1.2"
335+
"phpdocumentor/reflection-docblock": "^5.4.1",
336+
"phpstan/phpstan": "^2.1",
337+
"phpunit/phpunit": "^9.5",
338+
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1",
339+
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
333340
},
334341
"suggest": {
335342
"paragonie/sodium_compat": "Pure PHP implementation of libsodium",
336-
"symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
343+
"symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
337344
"szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan"
338345
},
339346
"type": "library",
@@ -350,9 +357,9 @@
350357
],
351358
"support": {
352359
"issues": "https://github.com/php-stubs/wordpress-stubs/issues",
353-
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.1.1"
360+
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.8.2"
354361
},
355-
"time": "2023-02-09T11:10:35+00:00"
362+
"time": "2025-07-16T06:41:00+00:00"
356363
},
357364
{
358365
"name": "phpcompatibility/php-compatibility",
@@ -530,20 +537,20 @@
530537
},
531538
{
532539
"name": "phpstan/phpstan",
533-
"version": "1.8.7",
540+
"version": "2.1.22",
534541
"source": {
535542
"type": "git",
536543
"url": "https://github.com/phpstan/phpstan.git",
537-
"reference": "536ff0ed719b5679e9f09c17aeaee9b31969cb8e"
544+
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4"
538545
},
539546
"dist": {
540547
"type": "zip",
541-
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/536ff0ed719b5679e9f09c17aeaee9b31969cb8e",
542-
"reference": "536ff0ed719b5679e9f09c17aeaee9b31969cb8e",
548+
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4",
549+
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4",
543550
"shasum": ""
544551
},
545552
"require": {
546-
"php": "^7.2|^8.0"
553+
"php": "^7.4|^8.0"
547554
},
548555
"conflict": {
549556
"phpstan/phpstan-shim": "*"
@@ -568,8 +575,11 @@
568575
"static analysis"
569576
],
570577
"support": {
578+
"docs": "https://phpstan.org/user-guide/getting-started",
579+
"forum": "https://github.com/phpstan/phpstan/discussions",
571580
"issues": "https://github.com/phpstan/phpstan/issues",
572-
"source": "https://github.com/phpstan/phpstan/tree/1.8.7"
581+
"security": "https://github.com/phpstan/phpstan/security/policy",
582+
"source": "https://github.com/phpstan/phpstan-src"
573583
},
574584
"funding": [
575585
{
@@ -579,13 +589,9 @@
579589
{
580590
"url": "https://github.com/phpstan",
581591
"type": "github"
582-
},
583-
{
584-
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
585-
"type": "tidelift"
586592
}
587593
],
588-
"time": "2022-10-04T14:09:33+00:00"
594+
"time": "2025-08-04T19:17:37+00:00"
589595
},
590596
{
591597
"name": "sirbrillig/phpcs-variable-analysis",
@@ -702,112 +708,36 @@
702708
},
703709
"time": "2023-02-22T23:07:41+00:00"
704710
},
705-
{
706-
"name": "symfony/polyfill-php73",
707-
"version": "v1.27.0",
708-
"source": {
709-
"type": "git",
710-
"url": "https://github.com/symfony/polyfill-php73.git",
711-
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9"
712-
},
713-
"dist": {
714-
"type": "zip",
715-
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
716-
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
717-
"shasum": ""
718-
},
719-
"require": {
720-
"php": ">=7.1"
721-
},
722-
"type": "library",
723-
"extra": {
724-
"branch-alias": {
725-
"dev-main": "1.27-dev"
726-
},
727-
"thanks": {
728-
"name": "symfony/polyfill",
729-
"url": "https://github.com/symfony/polyfill"
730-
}
731-
},
732-
"autoload": {
733-
"files": [
734-
"bootstrap.php"
735-
],
736-
"psr-4": {
737-
"Symfony\\Polyfill\\Php73\\": ""
738-
},
739-
"classmap": [
740-
"Resources/stubs"
741-
]
742-
},
743-
"notification-url": "https://packagist.org/downloads/",
744-
"license": [
745-
"MIT"
746-
],
747-
"authors": [
748-
{
749-
"name": "Nicolas Grekas",
750-
"email": "[email protected]"
751-
},
752-
{
753-
"name": "Symfony Community",
754-
"homepage": "https://symfony.com/contributors"
755-
}
756-
],
757-
"description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
758-
"homepage": "https://symfony.com",
759-
"keywords": [
760-
"compatibility",
761-
"polyfill",
762-
"portable",
763-
"shim"
764-
],
765-
"support": {
766-
"source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0"
767-
},
768-
"funding": [
769-
{
770-
"url": "https://symfony.com/sponsor",
771-
"type": "custom"
772-
},
773-
{
774-
"url": "https://github.com/fabpot",
775-
"type": "github"
776-
},
777-
{
778-
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
779-
"type": "tidelift"
780-
}
781-
],
782-
"time": "2022-11-03T14:55:06+00:00"
783-
},
784711
{
785712
"name": "szepeviktor/phpstan-wordpress",
786-
"version": "v1.1.7",
713+
"version": "v2.0.2",
787714
"source": {
788715
"type": "git",
789716
"url": "https://github.com/szepeviktor/phpstan-wordpress.git",
790-
"reference": "979dcb81a01942b576b9fbf72dcb9515c57a4aa8"
717+
"reference": "963887b04c21fe7ac78e61c1351f8b00fff9f8f8"
791718
},
792719
"dist": {
793720
"type": "zip",
794-
"url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/979dcb81a01942b576b9fbf72dcb9515c57a4aa8",
795-
"reference": "979dcb81a01942b576b9fbf72dcb9515c57a4aa8",
721+
"url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/963887b04c21fe7ac78e61c1351f8b00fff9f8f8",
722+
"reference": "963887b04c21fe7ac78e61c1351f8b00fff9f8f8",
796723
"shasum": ""
797724
},
798725
"require": {
799-
"php": "^7.2 || ^8.0",
800-
"php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0",
801-
"phpstan/phpstan": "^1.8.7",
802-
"symfony/polyfill-php73": "^1.12.0"
726+
"php": "^7.4 || ^8.0",
727+
"php-stubs/wordpress-stubs": "^6.6.2",
728+
"phpstan/phpstan": "^2.0"
803729
},
804730
"require-dev": {
805731
"composer/composer": "^2.1.14",
806732
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
807733
"php-parallel-lint/php-parallel-lint": "^1.1",
808-
"phpstan/phpstan-strict-rules": "^1.2",
809-
"phpunit/phpunit": "^8.0 || ^9.0",
810-
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8"
734+
"phpstan/phpstan-strict-rules": "^2.0",
735+
"phpunit/phpunit": "^9.0",
736+
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
737+
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
738+
},
739+
"suggest": {
740+
"swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods"
811741
},
812742
"type": "phpstan-extension",
813743
"extra": {
@@ -836,19 +766,9 @@
836766
],
837767
"support": {
838768
"issues": "https://github.com/szepeviktor/phpstan-wordpress/issues",
839-
"source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.1.7"
769+
"source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.2"
840770
},
841-
"funding": [
842-
{
843-
"url": "https://www.paypal.me/szepeviktor",
844-
"type": "custom"
845-
},
846-
{
847-
"url": "https://github.com/szepeviktor",
848-
"type": "github"
849-
}
850-
],
851-
"time": "2023-02-04T13:10:27+00:00"
771+
"time": "2025-02-12T18:43:37+00:00"
852772
},
853773
{
854774
"name": "wp-coding-standards/wpcs",
@@ -979,15 +899,15 @@
979899
"aliases": [],
980900
"minimum-stability": "dev",
981901
"stability-flags": {
982-
"wptt/webfont-loader": 20,
983-
"codeinwp/phpcs-ruleset": 20
902+
"codeinwp/phpcs-ruleset": 20,
903+
"wptt/webfont-loader": 20
984904
},
985905
"prefer-stable": true,
986906
"prefer-lowest": false,
987-
"platform": [],
988-
"platform-dev": [],
907+
"platform": {},
908+
"platform-dev": {},
989909
"platform-overrides": {
990-
"php": "7.2"
910+
"php": "7.4"
991911
},
992912
"plugin-api-version": "2.6.0"
993913
}

functions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@
4444
);
4545
}
4646
/**
47-
* A list of files to check for existance before bootstraping.
47+
* A list of files to check for existence before bootstrapping.
4848
*
49-
* @var array Files to check for existance.
49+
* @var non-falsy-string[] Files to check for existence.
5050
*/
51-
5251
$_files_to_check = defined( 'NEVE_IGNORE_SOURCE_CHECK' ) ? [] : [
5352
NEVE_MAIN_DIR . 'vendor/autoload.php',
5453
NEVE_MAIN_DIR . 'style-main-new.css',

0 commit comments

Comments
 (0)