diff --git a/composer.json b/composer.json
index ac72d3b..3bdf5d3 100644
--- a/composer.json
+++ b/composer.json
@@ -2,9 +2,9 @@
"require-dev": {
"wp-coding-standards/wpcs": "3.2.0",
"phpcsstandards/php_codesniffer": "^4.0",
- "phpstan/phpstan": "^1.12",
- "phpstan/extension-installer": "^1.3",
- "szepeviktor/phpstan-wordpress": "^1.3",
+ "phpstan/phpstan": "^2.0",
+ "phpstan/extension-installer": "^1.4",
+ "szepeviktor/phpstan-wordpress": "^2.0",
"php-stubs/acf-pro-stubs": "^6.0"
},
"config": {
diff --git a/composer.lock b/composer.lock
index 8199118..4fbc7f9 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "1d1d9439e85715855b5c0cf5751a306a",
+ "content-hash": "8e80be06340ac6b1eedc480c15edafc2",
"packages": [],
"packages-dev": [
{
@@ -512,15 +512,15 @@
},
{
"name": "phpstan/phpstan",
- "version": "1.12.33",
+ "version": "2.2.1",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/37982d6fc7cbb746dda7773530cda557cdf119e1",
- "reference": "37982d6fc7cbb746dda7773530cda557cdf119e1",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dea9c8f2d25cc849391042b71e429c1a4bf82660",
+ "reference": "dea9c8f2d25cc849391042b71e429c1a4bf82660",
"shasum": ""
},
"require": {
- "php": "^7.2|^8.0"
+ "php": "^7.4|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
@@ -539,6 +539,17 @@
"license": [
"MIT"
],
+ "authors": [
+ {
+ "name": "Ondřej Mirtes"
+ },
+ {
+ "name": "Markus Staab"
+ },
+ {
+ "name": "Vincent Langlet"
+ }
+ ],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
@@ -561,7 +572,7 @@
"type": "github"
}
],
- "time": "2026-02-28T20:30:03+00:00"
+ "time": "2026-05-28T14:44:12+00:00"
},
{
"name": "squizlabs/php_codesniffer",
@@ -642,112 +653,32 @@
],
"time": "2025-11-04T16:30:35+00:00"
},
- {
- "name": "symfony/polyfill-php73",
- "version": "v1.37.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php73.git",
- "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
- "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
- "shasum": ""
- },
- "require": {
- "php": ">=7.2"
- },
- "type": "library",
- "extra": {
- "thanks": {
- "url": "https://github.com/symfony/polyfill",
- "name": "symfony/polyfill"
- }
- },
- "autoload": {
- "files": [
- "bootstrap.php"
- ],
- "psr-4": {
- "Symfony\\Polyfill\\Php73\\": ""
- },
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php73/tree/v1.37.0"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://github.com/nicolas-grekas",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2024-09-09T11:45:10+00:00"
- },
{
"name": "szepeviktor/phpstan-wordpress",
- "version": "v1.3.5",
+ "version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/szepeviktor/phpstan-wordpress.git",
- "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7"
+ "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7",
- "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7",
+ "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/aa722f037b2d034828cd6c55ebe9e5c74961927e",
+ "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e",
"shasum": ""
},
"require": {
- "php": "^7.2 || ^8.0",
- "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0",
- "phpstan/phpstan": "^1.10.31",
- "symfony/polyfill-php73": "^1.12.0"
+ "php": "^7.4 || ^8.0",
+ "php-stubs/wordpress-stubs": "^6.6.2",
+ "phpstan/phpstan": "^2.0"
},
"require-dev": {
"composer/composer": "^2.1.14",
+ "composer/semver": "^3.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.1",
- "phpstan/phpstan-strict-rules": "^1.2",
- "phpunit/phpunit": "^8.0 || ^9.0",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpunit/phpunit": "^9.0",
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
},
@@ -781,9 +712,9 @@
],
"support": {
"issues": "https://github.com/szepeviktor/phpstan-wordpress/issues",
- "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.5"
+ "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.3"
},
- "time": "2024-06-28T22:27:19+00:00"
+ "time": "2025-09-14T02:58:22+00:00"
},
{
"name": "wp-coding-standards/wpcs",
diff --git a/package.json b/package.json
index 46ab1c4..220581d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@bsu/wp-coding-standards",
- "version": "3.3.0",
+ "version": "3.3.1",
"description": "PHP tool binaries for BSU WordPress development \u2014 ships PHPCS, WPCS, and PHPStan",
"author": "BSU|NTC Web Services",
"license": "Copyright Web Services, Bemidji State University - All Rights Reserved. Unauthorized copying of any files or code in this package, via any medium is strictly prohibited.",
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 56b69c4..467fbfe 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -7,7 +7,6 @@
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
- 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php',
'PHPCSUtils\\BackCompat\\BCFile' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php',
'PHPCSUtils\\BackCompat\\BCTokens' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php',
diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php
index 018ec18..b62e293 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -7,5 +7,4 @@
return array(
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
- '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
);
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index bce2976..b86bbb7 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -7,7 +7,6 @@
return array(
'SzepeViktor\\PHPStan\\WordPress\\' => array($vendorDir . '/szepeviktor/phpstan-wordpress/src'),
- 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
'PHPStan\\ExtensionInstaller\\' => array($vendorDir . '/phpstan/extension-installer/src'),
'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
);
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 91e5b8f..b6ba5ed 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -8,14 +8,12 @@ class ComposerStaticInitdf83cb10d40801d8f6980eab5e171777
{
public static $files = array (
'9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php',
- '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'SzepeViktor\\PHPStan\\WordPress\\' => 30,
- 'Symfony\\Polyfill\\Php73\\' => 23,
),
'P' =>
array (
@@ -29,10 +27,6 @@ class ComposerStaticInitdf83cb10d40801d8f6980eab5e171777
array (
0 => __DIR__ . '/..' . '/szepeviktor/phpstan-wordpress/src',
),
- 'Symfony\\Polyfill\\Php73\\' =>
- array (
- 0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
- ),
'PHPStan\\ExtensionInstaller\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/extension-installer/src',
@@ -45,7 +39,6 @@ class ComposerStaticInitdf83cb10d40801d8f6980eab5e171777
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
- 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php',
'PHPCSUtils\\BackCompat\\BCFile' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php',
'PHPCSUtils\\BackCompat\\BCTokens' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 273cd6f..d1626fe 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -526,21 +526,21 @@
},
{
"name": "phpstan/phpstan",
- "version": "1.12.33",
- "version_normalized": "1.12.33.0",
+ "version": "2.2.1",
+ "version_normalized": "2.2.1.0",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/37982d6fc7cbb746dda7773530cda557cdf119e1",
- "reference": "37982d6fc7cbb746dda7773530cda557cdf119e1",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dea9c8f2d25cc849391042b71e429c1a4bf82660",
+ "reference": "dea9c8f2d25cc849391042b71e429c1a4bf82660",
"shasum": ""
},
"require": {
- "php": "^7.2|^8.0"
+ "php": "^7.4|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
- "time": "2026-02-28T20:30:03+00:00",
+ "time": "2026-05-28T14:44:12+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@@ -556,6 +556,17 @@
"license": [
"MIT"
],
+ "authors": [
+ {
+ "name": "Ondřej Mirtes"
+ },
+ {
+ "name": "Markus Staab"
+ },
+ {
+ "name": "Vincent Langlet"
+ }
+ ],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
@@ -662,123 +673,40 @@
],
"install-path": "../squizlabs/php_codesniffer"
},
- {
- "name": "symfony/polyfill-php73",
- "version": "v1.37.0",
- "version_normalized": "1.37.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php73.git",
- "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
- "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
- "shasum": ""
- },
- "require": {
- "php": ">=7.2"
- },
- "time": "2024-09-09T11:45:10+00:00",
- "type": "library",
- "extra": {
- "thanks": {
- "url": "https://github.com/symfony/polyfill",
- "name": "symfony/polyfill"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "files": [
- "bootstrap.php"
- ],
- "psr-4": {
- "Symfony\\Polyfill\\Php73\\": ""
- },
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php73/tree/v1.37.0"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://github.com/nicolas-grekas",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "install-path": "../symfony/polyfill-php73"
- },
{
"name": "szepeviktor/phpstan-wordpress",
- "version": "v1.3.5",
- "version_normalized": "1.3.5.0",
+ "version": "v2.0.3",
+ "version_normalized": "2.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/szepeviktor/phpstan-wordpress.git",
- "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7"
+ "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7",
- "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7",
+ "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/aa722f037b2d034828cd6c55ebe9e5c74961927e",
+ "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e",
"shasum": ""
},
"require": {
- "php": "^7.2 || ^8.0",
- "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0",
- "phpstan/phpstan": "^1.10.31",
- "symfony/polyfill-php73": "^1.12.0"
+ "php": "^7.4 || ^8.0",
+ "php-stubs/wordpress-stubs": "^6.6.2",
+ "phpstan/phpstan": "^2.0"
},
"require-dev": {
"composer/composer": "^2.1.14",
+ "composer/semver": "^3.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.1",
- "phpstan/phpstan-strict-rules": "^1.2",
- "phpunit/phpunit": "^8.0 || ^9.0",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpunit/phpunit": "^9.0",
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
},
"suggest": {
"swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods"
},
- "time": "2024-06-28T22:27:19+00:00",
+ "time": "2025-09-14T02:58:22+00:00",
"type": "phpstan-extension",
"extra": {
"phpstan": {
@@ -807,7 +735,7 @@
],
"support": {
"issues": "https://github.com/szepeviktor/phpstan-wordpress/issues",
- "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.5"
+ "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.3"
},
"install-path": "../szepeviktor/phpstan-wordpress"
},
@@ -892,7 +820,6 @@
"phpstan/extension-installer",
"phpstan/phpstan",
"squizlabs/php_codesniffer",
- "symfony/polyfill-php73",
"szepeviktor/phpstan-wordpress",
"wp-coding-standards/wpcs"
]
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index 715ad57..f89c16c 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '7d14e07bea2cb1511cd904dfd032619031773246',
+ 'reference' => 'cb52fa2b79b1da92e13a9c56e391b6481308aa76',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '7d14e07bea2cb1511cd904dfd032619031773246',
+ 'reference' => 'cb52fa2b79b1da92e13a9c56e391b6481308aa76',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -83,9 +83,9 @@
'dev_requirement' => true,
),
'phpstan/phpstan' => array(
- 'pretty_version' => '1.12.33',
- 'version' => '1.12.33.0',
- 'reference' => '37982d6fc7cbb746dda7773530cda557cdf119e1',
+ 'pretty_version' => '2.2.1',
+ 'version' => '2.2.1.0',
+ 'reference' => 'dea9c8f2d25cc849391042b71e429c1a4bf82660',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpstan',
'aliases' => array(),
@@ -100,19 +100,10 @@
'aliases' => array(),
'dev_requirement' => true,
),
- 'symfony/polyfill-php73' => array(
- 'pretty_version' => 'v1.37.0',
- 'version' => '1.37.0.0',
- 'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
- 'aliases' => array(),
- 'dev_requirement' => true,
- ),
'szepeviktor/phpstan-wordpress' => array(
- 'pretty_version' => 'v1.3.5',
- 'version' => '1.3.5.0',
- 'reference' => '7f8cfe992faa96b6a33bbd75c7bace98864161e7',
+ 'pretty_version' => 'v2.0.3',
+ 'version' => '2.0.3.0',
+ 'reference' => 'aa722f037b2d034828cd6c55ebe9e5c74961927e',
'type' => 'phpstan-extension',
'install_path' => __DIR__ . '/../szepeviktor/phpstan-wordpress',
'aliases' => array(),
diff --git a/vendor/phpstan/extension-installer/src/GeneratedConfig.php b/vendor/phpstan/extension-installer/src/GeneratedConfig.php
index f54221b..f98f648 100644
--- a/vendor/phpstan/extension-installer/src/GeneratedConfig.php
+++ b/vendor/phpstan/extension-installer/src/GeneratedConfig.php
@@ -12,7 +12,7 @@ final class GeneratedConfig
public const EXTENSIONS = array (
'szepeviktor/phpstan-wordpress' =>
array (
- 'install_path' => '/Users/cp9965pa.b/Dropbox/Sites/repos/bsu-repos/npm/wp-coding-standards2/vendor/szepeviktor/phpstan-wordpress',
+ 'install_path' => '/Users/cp9965pa.b/Dropbox/Sites/repos/bsu-repos/npm/wp-coding-standards/vendor/szepeviktor/phpstan-wordpress',
'relative_install_path' => '../../../szepeviktor/phpstan-wordpress',
'extra' =>
array (
@@ -21,8 +21,8 @@ final class GeneratedConfig
0 => 'extension.neon',
),
),
- 'version' => 'v1.3.5',
- 'phpstanVersionConstraint' => '>=1.10.31.0-dev, <2.0.0.0-dev',
+ 'version' => 'v2.0.3',
+ 'phpstanVersionConstraint' => '>=2.0.0.0-dev, <3.0.0.0-dev',
),
);
@@ -30,7 +30,7 @@ final class GeneratedConfig
);
/** @var string|null */
- public const PHPSTAN_VERSION_CONSTRAINT = '>=1.10.31.0-dev, <2.0.0.0-dev';
+ public const PHPSTAN_VERSION_CONSTRAINT = '>=2.0.0.0-dev, <3.0.0.0-dev';
private function __construct()
{
diff --git a/vendor/phpstan/phpstan/LICENSE b/vendor/phpstan/phpstan/LICENSE
index 7c0f2b7..e5f34e6 100644
--- a/vendor/phpstan/phpstan/LICENSE
+++ b/vendor/phpstan/phpstan/LICENSE
@@ -1,6 +1,7 @@
MIT License
Copyright (c) 2016 Ondřej Mirtes
+Copyright (c) 2025 PHPStan s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/phpstan/phpstan/README.md b/vendor/phpstan/phpstan/README.md
index e3bb940..443d1d1 100644
--- a/vendor/phpstan/phpstan/README.md
+++ b/vendor/phpstan/phpstan/README.md
@@ -24,11 +24,32 @@ can be checked before you run the actual line.
## Sponsors
+Want your logo here? [Learn more »](https://phpstan.org/sponsor)
+
+### Gold Sponsors
+
+
+
+
+
+
+
+
+
+### Silver Sponsors
+
+
+
+
+
+
+### Bronze Sponsors
+
-
+
@@ -36,42 +57,32 @@ can be checked before you run the actual line.
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
+
-[**You can now sponsor my open-source work on PHPStan through GitHub Sponsors.**](https://github.com/sponsors/ondrejmirtes)
-Does GitHub already have your 💳? Do you use PHPStan to find 🐛 before they reach production? [Send a couple of 💸 a month my way too.](https://github.com/sponsors/ondrejmirtes) Thank you!
+[**You can sponsor my open-source work on PHPStan through GitHub Sponsors and also directly.**](https://phpstan.org/sponsor)
One-time donations [through Revolut.me](https://revolut.me/ondrejmirtes) are also accepted. To request an invoice, [contact me](mailto:ondrej@mirtes.cz) through e-mail.
diff --git a/vendor/phpstan/phpstan/UPGRADING.md b/vendor/phpstan/phpstan/UPGRADING.md
new file mode 100644
index 0000000..5229490
--- /dev/null
+++ b/vendor/phpstan/phpstan/UPGRADING.md
@@ -0,0 +1,338 @@
+Upgrading from PHPStan 1.x to 2.0
+=================================
+
+## PHP version requirements
+
+PHPStan now requires PHP 7.4 or newer to run.
+
+## Upgrading guide for end users
+
+The best way to get ready for upgrade to PHPStan 2.0 is to update to the **latest PHPStan 1.12 release**
+and enable [**Bleeding Edge**](https://phpstan.org/blog/what-is-bleeding-edge). This will enable the new rules and behaviours that 2.0 turns on for all users.
+
+Also make sure to install and enable [`phpstan/phpstan-deprecation-rules`](https://github.com/phpstan/phpstan-deprecation-rules).
+
+Once you get to a green build with no deprecations showed on latest PHPStan 1.12.x with Bleeding Edge enabled, you can update all your related PHPStan dependencies to 2.0 in `composer.json`:
+
+```json
+"require-dev": {
+ "phpstan/phpstan": "^2.0",
+ "phpstan/phpstan-deprecation-rules": "^2.0",
+ "phpstan/phpstan-doctrine": "^2.0",
+ "phpstan/phpstan-nette": "^2.0",
+ "phpstan/phpstan-phpunit": "^2.0",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpstan/phpstan-symfony": "^2.0",
+ "phpstan/phpstan-webmozart-assert": "^2.0",
+ ...
+}
+```
+
+Don't forget to update [3rd party PHPStan extensions](https://phpstan.org/user-guide/extension-library) as well.
+
+After changing your `composer.json`, run `composer update 'phpstan/*' -W`.
+
+It's up to you whether you go through the new reported errors or if you just put them all to the [baseline](https://phpstan.org/user-guide/baseline) ;) Everyone who's on PHPStan 1.12 should be able to upgrade to PHPStan 2.0.
+
+### Noteworthy changes to code analysis
+
+* [**Enhancements in handling parameters passed by reference**](https://phpstan.org/blog/enhancements-in-handling-parameters-passed-by-reference)
+* [**Validate inline PHPDoc `@var` tag type**](https://phpstan.org/blog/phpstan-1-10-comes-with-lie-detector#validate-inline-phpdoc-%40var-tag-type)
+* [**List type enforced**](https://phpstan.org/blog/phpstan-1-9-0-with-phpdoc-asserts-list-type#list-type)
+* **Always `true` conditions always reported**: previously reported only with phpstan-strict-rules, this is now always reported.
+
+### Removed option `checkMissingIterableValueType`
+
+It's strongly recommended to add the missing array typehints.
+
+If you want to continue ignoring missing typehints from arrays, add `missingType.iterableValue` error identifier to your `ignoreErrors`:
+
+```neon
+parameters:
+ ignoreErrors:
+ -
+ identifier: missingType.iterableValue
+```
+
+### Removed option `checkGenericClassInNonGenericObjectType`
+
+It's strongly recommended to add the missing generic typehints.
+
+If you want to continue ignoring missing typehints from generics, add `missingType.generics` error identifier to your `ignoreErrors`:
+
+```neon
+parameters:
+ ignoreErrors:
+ -
+ identifier: missingType.generics
+```
+
+### Removed `checkAlwaysTrue*` options
+
+These options have been removed because PHPStan now always behaves as if these were set to `true`:
+
+* `checkAlwaysTrueCheckTypeFunctionCall`
+* `checkAlwaysTrueInstanceof`
+* `checkAlwaysTrueStrictComparison`
+* `checkAlwaysTrueLooseComparison`
+
+### Removed option `excludes_analyse`
+
+It has been replaced with [`excludePaths`](https://phpstan.org/user-guide/ignoring-errors#excluding-whole-files).
+
+### Paths in `excludePaths` and `ignoreErrors` have to be a valid file path or a fnmatch pattern
+
+If you are excluding a file path that might not exist but you still want to have it in `excludePaths`, append `(?)`:
+
+```neon
+parameters:
+ excludePaths:
+ - tests/*/data/*
+ - src/broken
+ - node_modules (?) # optional path, might not exist
+```
+
+If you have the same situation in `ignoreErrors` (ignoring an error in a path that might not exist), use `reportUnmatchedIgnoredErrors: false`.
+
+```neon
+parameters:
+ reportUnmatchedIgnoredErrors: false
+```
+
+Appending `(?)` in `ignoreErrors` is not supported.
+
+### Changes in 1st party PHPStan extensions
+
+* [phpstan-doctrine](https://github.com/phpstan/phpstan-doctrine)
+ * Removed config parameter `searchOtherMethodsForQueryBuilderBeginning` (extension now behaves as when this was set to `true`)
+ * Removed config parameter `queryBuilderFastAlgorithm` (extension now behaves as when this was set to `false`)
+* [phpstan-symfony](https://github.com/phpstan/phpstan-symfony)
+ * Removed legacy options with `_` in the name
+ * `container_xml_path` -> use `containerXmlPath`
+ * `constant_hassers` -> use `constantHassers`
+ * `console_application_loader` -> use `consoleApplicationLoader`
+
+### Minor backward compatibility breaks
+
+* Removed unused config parameter `cache.nodesByFileCountMax`
+* Removed unused config parameter `memoryLimitFile`
+* Removed unused feature toggle `disableRuntimeReflectionProvider`
+* Removed unused config parameter `staticReflectionClassNamePatterns`
+* Remove `fixerTmpDir` config parameter, use `pro.tmpDir` instead
+* Remove `tempResultCachePath` config parameter, use `resultCachePath` instead
+* `additionalConfigFiles` config parameter must be a list
+
+## Upgrading guide for extension developers
+
+> [!NOTE]
+> Please switch to PHPStan 2.0 in a new major version of your extension. It's not feasible to try to support both PHPStan 1.x and PHPStan 2.x with the same extension code.
+>
+> You can definitely get closer to supporting PHPStan 2.0 without increasing major version by solving reported deprecations and other issues by analysing your extension code with PHPStan & phpstan-deprecation-rules & Bleeding Edge, but the final leap and solving backward incompatibilities should be done by requiring `"phpstan/phpstan": "^2.0"` in your `composer.json`, and releasing a new major version.
+
+### PHPStan now uses nikic/php-parser v5
+
+See [UPGRADING](https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md) guide for PHP-Parser.
+
+The most notable change is how `throw` statement is represented. Previously, `throw` statements like `throw $e;` were represented using the `Stmt\Throw_` class, while uses inside other expressions (such as `$x ?? throw $e`) used the `Expr\Throw_` class.
+
+Now, `throw $e;` is represented as a `Stmt\Expression` that contains an `Expr\Throw_`. The
+`Stmt\Throw_` class has been removed.
+
+### PHPStan now uses phpstan/phpdoc-parser v2
+
+See [UPGRADING](https://github.com/phpstan/phpdoc-parser/blob/2.0.x/UPGRADING.md) guide for phpstan/phpdoc-parser.
+
+### Returning plain strings as errors no longer supported, use RuleErrorBuilder
+
+Identifiers are also required in custom rules.
+
+Learn more: [Using RuleErrorBuilder to enrich reported errors in custom rules](https://phpstan.org/blog/using-rule-error-builder)
+
+**Before**:
+
+```php
+return ['My error'];
+```
+
+**After**:
+
+```php
+return [
+ RuleErrorBuilder::message('My error')
+ ->identifier('my.error')
+ ->build(),
+];
+```
+
+### Deprecate various `instanceof *Type` in favour of new methods on `Type` interface
+
+Learn more: [Why Is instanceof *Type Wrong and Getting Deprecated?](https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated)
+
+### Removed deprecated `ParametersAcceptorSelector::selectSingle()`
+
+Use [`ParametersAcceptorSelector::selectFromArgs()`](https://apiref.phpstan.org/2.0.x/PHPStan.Reflection.ParametersAcceptorSelector.html#_selectFromArgs) instead. It should be used in most places where `selectSingle()` was previously used, like dynamic return type extensions.
+
+**Before**:
+
+```php
+$defaultReturnType = ParametersAcceptorSelector::selectSingle($functionReflection->getVariants())->getReturnType();
+```
+
+**After**:
+
+```php
+$defaultReturnType = ParametersAcceptorSelector::selectFromArgs(
+ $scope,
+ $functionCall->getArgs(),
+ $functionReflection->getVariants()
+)->getReturnType();
+```
+
+If you're analysing function or method body itself and you're using one of the following methods, ask for `getParameters()` and `getReturnType()` directly on the reflection object:
+
+* [InClassMethodNode::getMethodReflection()](https://apiref.phpstan.org/2.0.x/PHPStan.Node.InClassMethodNode.html)
+* [InFunctionNode::getFunctionReflection()](https://apiref.phpstan.org/2.0.x/PHPStan.Node.InFunctionNode.html)
+* [FunctionReturnStatementsNode::getFunctionReflection()](https://apiref.phpstan.org/2.0.x/PHPStan.Node.FunctionReturnStatementsNode.html)
+* [MethodReturnStatementsNode::getMethodReflection()](https://apiref.phpstan.org/2.0.x/PHPStan.Node.MethodReturnStatementsNode.html)
+* [Scope::getFunction()](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.Scope.html#_getFunction)
+
+**Before**:
+
+```php
+$function = $node->getFunctionReflection();
+$returnType = ParametersAcceptorSelector::selectSingle($function->getVariants())->getReturnType();
+```
+
+**After**:
+
+```php
+$returnType = $node->getFunctionReflection()->getReturnType();
+```
+
+### Changed `TypeSpecifier::create()` and `SpecifiedTypes` constructor parameters
+
+[`PHPStan\Analyser\TypeSpecifier::create()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.TypeSpecifier.html#_create) now accepts (all parameters are required):
+
+* `Expr $expr`
+* `Type $type`
+* `TypeSpecifierContext $context`
+* `Scope $scope`
+
+If you want to change `$overwrite` or `$rootExpr` (previous parameters also used to be accepted by this method), call `setAlwaysOverwriteTypes()` and `setRootExpr()` on [`SpecifiedTypes`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.SpecifiedTypes.html) (object returned by `TypeSpecifier::create()`). These methods return a new object (SpecifiedTypes is immutable).
+
+[`SpecifiedTypes`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.SpecifiedTypes.html) constructor now accepts:
+
+* `array $sureTypes`
+* `array $sureNotTypes`
+
+If you want to change `$overwrite` or `$rootExpr` (previous parameters also used to be accepted by the constructor), call `setAlwaysOverwriteTypes()` and `setRootExpr()`. These methods return a new object (SpecifiedTypes is immutable).
+
+### `ConstantArrayType` no longer extends `ArrayType`
+
+`Type::getArrays()` now returns `list`.
+
+Using `$type instanceof ArrayType` is [being deprecated anyway](https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated) so the impact of this change should be minimal.
+
+### Changed `TypeSpecifier::specifyTypesInCondition()`
+
+This method no longer accepts `Expr $rootExpr`. If you want to change it, call `setRootExpr()` on [`SpecifiedTypes`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.SpecifiedTypes.html) (object returned by `TypeSpecifier::specifyTypesInCondition()`). `setRootExpr()` method returns a new object (SpecifiedTypes is immutable).
+
+### Node attributes `parent`, `previous`, `next` are no longer available
+
+Learn more: https://phpstan.org/blog/preprocessing-ast-for-custom-rules
+
+### Removed config parameter `scopeClass`
+
+As a replacement you can implement [`PHPStan\Type\ExpressionTypeResolverExtension`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.ExpressionTypeResolverExtension.html) interface instead and register it as a service.
+
+### Removed `PHPStan\Broker\Broker`
+
+Use [`PHPStan\Reflection\ReflectionProvider`](https://apiref.phpstan.org/2.0.x/PHPStan.Reflection.ReflectionProvider.html) instead.
+
+`BrokerAwareExtension` was also removed. Ask for `ReflectionProvider` in the extension constructor instead.
+
+Instead of `PHPStanTestCase::createBroker()`, call `PHPStanTestCase::createReflectionProvider()`.
+
+### List type is enabled for everyone
+
+Removed static methods from `AccessoryArrayListType` class:
+
+* `isListTypeEnabled()`
+* `setListTypeEnabled()`
+* `intersectWith()`
+
+Instead of `AccessoryArrayListType::intersectWith($type)`, do `TypeCombinator::intersect($type, new AccessoryArrayListType())`.
+
+### Minor backward compatibility breaks
+
+* Classes that were previously `@final` were made `final`
+* Parameter `$callableParameters` of [`MutatingScope::enterAnonymousFunction()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.MutatingScope.html#_enterAnonymousFunction) and [`enterArrowFunction()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.MutatingScope.html#_enterArrowFunction) made required
+* Parameter `StatementContext $context` of [`NodeScopeResolver::processStmtNodes()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.NodeScopeResolver.html#_processStmtNodes) made required
+* ClassPropertiesNode - remove `$extensions` parameter from [`getUninitializedProperties()`](https://apiref.phpstan.org/2.0.x/PHPStan.Node.ClassPropertiesNode.html#_getUninitializedProperties)
+* `Type::getSmallerType()`, `Type::getSmallerOrEqualType()`, `Type::getGreaterType()`, `Type::getGreaterOrEqualType()`, `Type::isSmallerThan()`, `Type::isSmallerThanOrEqual()` now require [`PhpVersion`](https://apiref.phpstan.org/2.0.x/PHPStan.Php.PhpVersion.html) as argument.
+* `CompoundType::isGreaterThan()`, `CompoundType::isGreaterThanOrEqual()` now require [`PhpVersion`](https://apiref.phpstan.org/2.0.x/PHPStan.Php.PhpVersion.html) as argument.
+* Removed `ReflectionProvider::supportsAnonymousClasses()` (all reflection providers support anonymous classes)
+* Remove `ArrayType::generalizeKeys()`
+* Remove `ArrayType::count()`, use `Type::getArraySize()` instead
+* Remove `ArrayType::castToArrayKeyType()`, `Type::toArrayKey()` instead
+* Remove `UnionType::pickTypes()`, use `pickFromTypes()` instead
+* Remove `RegexArrayShapeMatcher::matchType()`, use `matchExpr()` instead
+* Remove unused `PHPStanTestCase::$useStaticReflectionProvider`
+* Remove `PHPStanTestCase::getReflectors()`, use `getReflector()` instead
+* Remove `ClassReflection::getFileNameWithPhpDocs()`, use `getFileName()` instead
+* Remove `AnalysisResult::getInternalErrors()`, use `getInternalErrorObjects()` instead
+* Remove `ConstantReflection::getValue()`, use `getValueExpr()` instead. To get `Type` from `Expr`, use `Scope::getType()` or `InitializerExprTypeResolver::getType()`
+* Remove `PropertyTag::getType()`, use `getReadableType()` / `getWritableType()` instead
+* Remove `GenericTypeVariableResolver`, use [`Type::getTemplateType()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getTemplateType) instead
+* Rename `Type::isClassStringType()` to `Type::isClassString()`
+* Remove `Scope::isSpecified()`, use `hasExpressionType()` instead
+* Remove `ConstantArrayType::isEmpty()`, use `isIterableAtLeastOnce()->no()` instead
+* Remove `ConstantArrayType::getNextAutoIndex()`
+* Removed methods from `ConstantArrayType` - `getFirst*Type` and `getLast*Type`
+ * Use `getFirstIterable*Type` and `getLastIterable*Type` instead
+* Remove `ConstantArrayType::generalizeToArray()`
+* Remove `ConstantArrayType::findTypeAndMethodName()`, use `findTypeAndMethodNames()` instead
+* Remove `ConstantArrayType::removeLast()`, use [`Type::popArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_popArray) instead
+* Remove `ConstantArrayType::removeFirst()`, use [`Type::shiftArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_shiftArray) instead
+* Remove `ConstantArrayType::reverse()`, use [`Type::reverseArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_reverseArray) instead
+* Remove `ConstantArrayType::chunk()`, use [`Type::chunkArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_chunkArray) instead
+* Remove `ConstantArrayType::slice()`, use [`Type::sliceArray()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_sliceArray) instead
+* Made `TypeUtils` thinner by removing methods:
+ * Remove `TypeUtils::getArrays()` and `getAnyArrays()`, use [`Type::getArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getArrays) instead
+ * Remove `TypeUtils::getConstantArrays()` and `getOldConstantArrays()`, use [`Type::getConstantArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantArrays) instead
+ * Remove `TypeUtils::getConstantStrings()`, use [`Type::getConstantStrings()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantStrings) instead
+ * Remove `TypeUtils::getConstantTypes()` and `getAnyConstantTypes()`, use [`Type::isConstantValue()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_isConstantValue) or [`Type::generalize()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_generalize)
+ * Remove `TypeUtils::generalizeType()`, use [`Type::generalize()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_generalize) instead
+ * Remove `TypeUtils::getDirectClassNames()`, use [`Type::getObjectClassNames()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getObjectClassNames) instead
+ * Remove `TypeUtils::getConstantScalars()`, use [`Type::isConstantScalarValue()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_isConstantScalarValue) or [`Type::getConstantScalarTypes()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantScalarTypes) instead
+ * Remove `TypeUtils::getEnumCaseObjects()`, use [`Type::getEnumCases()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getEnumCases) instead
+ * Remove `TypeUtils::containsCallable()`, use [`Type::isCallable()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_isCallable) instead
+* Removed `Scope::doNotTreatPhpDocTypesAsCertain()`, use `getNativeType()` instead
+* Parameter `$isList` in `ConstantArrayType` constructor can only be `TrinaryLogic`, no longer `bool`
+* Parameter `$nextAutoIndexes` in `ConstantArrayType` constructor can only be `non-empty-list`, no longer `int`
+* Remove `ConstantType` interface, use [`Type::isConstantValue()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_isConstantValue) instead
+* `acceptsNamedArguments()` in `FunctionReflection`, `ExtendedMethodReflection` and `CallableParametersAcceptor` interfaces returns `TrinaryLogic` instead of `bool`
+* Remove `FunctionReflection::isFinal()`
+* [`Type::getProperty()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getProperty) now returns [`ExtendedPropertyReflection`](https://apiref.phpstan.org/2.0.x/PHPStan.Reflection.ExtendedPropertyReflection.html)
+* Remove `__set_state()` on objects that should not be serialized in cache
+* Parameter `$selfClass` of [`TypehintHelper::decideTypeFromReflection()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.TypehintHelper.html#_decideTypeFromReflection) no longer accepts `string`
+* `LevelsTestCase::dataTopics()` data provider made static
+* `PHPStan\Node\Printer\Printer` no longer autowired as `PhpParser\PrettyPrinter\Standard`, use `PHPStan\Node\Printer\Printer` in the typehint
+* Remove `Type::acceptsWithReason()`, `Type:accepts()` return type changed from `TrinaryLogic` to [`AcceptsResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.AcceptsResult.html)
+* Remove `CompoundType::isAcceptedWithReasonBy()`, `CompoundType::isAcceptedBy()` return type changed from `TrinaryLogic` to [`AcceptsResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.AcceptsResult.html)
+Remove `Type::isSuperTypeOfWithReason()`, `Type:isSuperTypeOf()` return type changed from `TrinaryLogic` to [`IsSuperTypeOfResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.IsSuperTypeOfResult.html)
+* Remove `CompoundType::isSubTypeOfWithReasonBy()`, `CompoundType::isSubTypeOf()` return type changed from `TrinaryLogic` to [`IsSuperTypeOfResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.IsSuperTypeOfResult.html)
+* Remove `TemplateType::isValidVarianceWithReason()`, changed `TemplateType::isValidVariance()` return type to [`IsSuperTypeOfResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.IsSuperTypeOfResult.html)
+* `RuleLevelHelper::accepts()` return type changed from `bool` to [`RuleLevelHelperAcceptsResult`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.AcceptsResult.html)
+* Changes around `ClassConstantReflection`
+ * Class `ClassConstantReflection` removed from BC promise, renamed to `RealClassConstantReflection`
+ * Interface `ConstantReflection` renamed to `ClassConstantReflection`
+ * Added more methods around PHPDoc types and native types to the (new) `ClassConstantReflection`
+ * Interface `GlobalConstantReflection` renamed to `ConstantReflection`
+* Renamed interfaces and classes from `*WithPhpDocs` to `Extended*`
+ * `ParametersAcceptorWithPhpDocs` -> `ExtendedParametersAcceptor`
+ * `ParameterReflectionWithPhpDocs` -> `ExtendedParameterReflection`
+ * `FunctionVariantWithPhpDocs` -> `ExtendedFunctionVariant`
+* `ClassPropertyNode::getNativeType()` return type changed from AST node to `Type|null`
+* Class `PHPStan\Node\ClassMethod` (accessible from `ClassMethodsNode`) is no longer an AST node
+ * Call `PHPStan\Node\ClassMethod::getNode()` to access the original AST node
diff --git a/vendor/phpstan/phpstan/bootstrap.php b/vendor/phpstan/phpstan/bootstrap.php
index 2d950b0..53370b5 100644
--- a/vendor/phpstan/phpstan/bootstrap.php
+++ b/vendor/phpstan/phpstan/bootstrap.php
@@ -27,8 +27,9 @@ final public static function loadClass(string $class): void {
if (self::$composerAutoloader === null) {
self::$composerAutoloader = require 'phar://' . __DIR__ . '/phpstan.phar/vendor/autoload.php';
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php';
- require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/react/async/src/functions_include.php';
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/react/promise/src/functions_include.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/ralouphie/getallheaders/src/getallheaders.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/guzzlehttp/guzzle/src/functions_include.php';
}
self::$composerAutoloader->loadClass($class);
@@ -73,27 +74,6 @@ final public static function loadClass(string $class): void {
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-intl-normalizer/bootstrap.php';
}
- if (
- PHP_VERSION_ID < 70300
- && empty($GLOBALS['__composer_autoload_files']['0d59ee240a4cd96ddbb4ff164fccea4d'])
- && !class_exists(\Symfony\Polyfill\Php73\Php73::class, false)
- ) {
- $GLOBALS['__composer_autoload_files']['0d59ee240a4cd96ddbb4ff164fccea4d'] = true;
- // already loaded by bootstrap inside the hrtime condition
- // require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php73/Php73.php';
- require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php73/bootstrap.php';
- }
-
- if (
- PHP_VERSION_ID < 70400
- && empty($GLOBALS['__composer_autoload_files']['b686b8e46447868025a15ce5d0cb2634'])
- && !class_exists(\Symfony\Polyfill\Php74\Php74::class, false)
- ) {
- $GLOBALS['__composer_autoload_files']['b686b8e46447868025a15ce5d0cb2634'] = true;
- require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php74/Php74.php';
- require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php74/bootstrap.php';
- }
-
if (
!extension_loaded('intl')
&& empty($GLOBALS['__composer_autoload_files']['8825ede83f2f289127722d4e842cf7e8'])
@@ -113,6 +93,36 @@ final public static function loadClass(string $class): void {
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/Php81.php';
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/bootstrap.php';
}
+
+ if (
+ PHP_VERSION_ID < 80300
+ && empty ($GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c'])
+ && !class_exists(\Symfony\Polyfill\Php83\Php83::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/Php83.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/bootstrap.php';
+ }
+
+ if (
+ PHP_VERSION_ID < 80400
+ && empty ($GLOBALS['__composer_autoload_files']['9d2b9fc6db0f153a0a149fefb182415e'])
+ && !class_exists(\Symfony\Polyfill\Php84\Php84::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['9d2b9fc6db0f153a0a149fefb182415e'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php84/Php84.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php84/bootstrap.php';
+ }
+
+ if (
+ PHP_VERSION_ID < 80500
+ && empty ($GLOBALS['__composer_autoload_files']['606a39d89246991a373564698c2d8383'])
+ && !class_exists(\Symfony\Polyfill\Php85\Php85::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['606a39d89246991a373564698c2d8383'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php85/Php85.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php85/bootstrap.php';
+ }
}
$filename = str_replace('\\', DIRECTORY_SEPARATOR, $class);
diff --git a/vendor/phpstan/phpstan/composer.json b/vendor/phpstan/phpstan/composer.json
index 67020db..a267d4c 100644
--- a/vendor/phpstan/phpstan/composer.json
+++ b/vendor/phpstan/phpstan/composer.json
@@ -2,9 +2,20 @@
"name": "phpstan/phpstan",
"description": "PHPStan - PHP Static Analysis Tool",
"license": ["MIT"],
+ "authors": [
+ {
+ "name": "Ondřej Mirtes"
+ },
+ {
+ "name": "Markus Staab"
+ },
+ {
+ "name": "Vincent Langlet"
+ }
+ ],
"keywords": ["dev", "static analysis"],
"require": {
- "php": "^7.2|^8.0"
+ "php": "^7.4|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
diff --git a/vendor/phpstan/phpstan/phpstan.phar b/vendor/phpstan/phpstan/phpstan.phar
index 711977a..e0e15ae 100755
Binary files a/vendor/phpstan/phpstan/phpstan.phar and b/vendor/phpstan/phpstan/phpstan.phar differ
diff --git a/vendor/phpstan/phpstan/phpstan.phar.asc b/vendor/phpstan/phpstan/phpstan.phar.asc
index 9d0a04a..4859a2b 100644
--- a/vendor/phpstan/phpstan/phpstan.phar.asc
+++ b/vendor/phpstan/phpstan/phpstan.phar.asc
@@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
-iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmmjUBMACgkQUcZzBf/C
-5cBoRg/+Nq/YDWBdVwj1S3dz+DuLm7j+cqFELyLW9RA+tFH43xzGY53fDjv4n4F/
-0zWBT9FQ8gINDUPHXbVGL+gh1A1puoNnR47htzOyknhMx/vQcOEVohA4laiQmc1t
-NXPVR09gUsO093a3zz5sVDq/0GtTb8YsEOHlKSAYSP2OKSWkvpYX7o5fv0W4q+xB
-BbBVznKCgon/I5cF3kJcwpX/gH2APKSFyapH4pvqchPPMaGAht1q1XZ1JIsCz36t
-k1HidGEFryOGG4Wt1uVB1dSjUCDe6S6/6JBLVAjwE2npStNBBRRhZMjviIXkjaqx
-3pReYCfHBCrI9+HfJsdJj2SOE77iCMyHv1D9TRaLGIpyScA4MFfpP3YvoJ+RKuVd
-nJz441+Us0++2VnmN7VqvgJGhm+08ZNtGFxQlvBGcLtAYWj0HmnS2XbsivDWXSV1
-RXqhIjGBeCXcgfQ6DwQAu/X9T/TrDjO+AJbMykPq9puM3RCDZG103zITBGgW/UfS
-Mrl5lyOcWtT/Ng9OTOXklcWMfPs6dPw7EFZJXkecBMn/LI7UtNsxMnsXBdNso+Ms
-woOIpjq1pZ7Vy1BM3a1U/KzYSDmMQE6o5qrg1u9pDqlwU/pmAcoNBep1wNYIDtEo
-n/HMRTK+9gWRdZOJCY1FgFT0iWB9bnf6CWtjQ6uC1TiXXWYNBpg=
-=ynn2
+iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmoYVHoACgkQUcZzBf/C
+5cCNbQ//Qfg4uJdInIhv/ug2A9cnSlKWqMkqMrwTF+QhJtq1+3oLL126K26sdalu
+5oLkbW0QG6TfoDZXGffv4/bPt4PUM91KM/tqDxRIzHZuwbHqMTkF0q/MiqLCUFCM
+X9j8W34vmCwwVupyCUQ4fy7EXsNIapvq/DZ/MjklkTT3fzlfm9A6aLBCLsSjHo07
+DEO/OmL9p9aKofobhGD1I2M5hi+rIIr3Jv/pC75tzmweWSChOzJ14nYV4gRyyFUf
+OZ8fzewzdgQ4PsX+PeCas4OD45QpHPkpbmmLLpIuQKiYLtPddY8qXf/h+QulHouJ
+Kx2dTyjRsOgV9zrg6LXb2FDWMEuHnctGnhbYPZRdtRdwyjmrXnEe/NEQVILu0rZt
+TG/5fR9mF+Jzig9x0JeF5X6ofdRc8EIOXMurhD6um/EZ2N7u4hfRPOO67cox5vm+
+iYefdBBcBm5o4Qq0ol3ytXirfMWVMlo9i7G9n4rwcPh+GAgVhsN09fqQl/6WkY35
+TtoscNBAAC4nLhlYJevX0WKnbCn1gkJ8irG+hRIO8Fm+PV8xoxsuJE2V/BlTXjwj
+vwq2nIKLmfiXT7qkY+JfgAEBxq9uYqKzEIDvhTKe5sqydrwCbi8X9mgVA4rku7Hb
+1k2FZqlyqhTjVw9cg6DJQTpvRITv3jHSGgNAgeGfFA2tdVf91Zc=
+=qSrZ
-----END PGP SIGNATURE-----
diff --git a/vendor/symfony/polyfill-php73/LICENSE b/vendor/symfony/polyfill-php73/LICENSE
deleted file mode 100644
index 7536cae..0000000
--- a/vendor/symfony/polyfill-php73/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2018-present Fabien Potencier
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/symfony/polyfill-php73/Php73.php b/vendor/symfony/polyfill-php73/Php73.php
deleted file mode 100644
index 65c35a6..0000000
--- a/vendor/symfony/polyfill-php73/Php73.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Polyfill\Php73;
-
-/**
- * @author Gabriel Caruso
- * @author Ion Bazan
- *
- * @internal
- */
-final class Php73
-{
- public static $startAt = 1533462603;
-
- /**
- * @param bool $asNum
- *
- * @return array|float|int
- */
- public static function hrtime($asNum = false)
- {
- $ns = microtime(false);
- $s = substr($ns, 11) - self::$startAt;
- $ns = 1E9 * (float) $ns;
-
- if ($asNum) {
- $ns += $s * 1E9;
-
- return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
- }
-
- return [$s, (int) $ns];
- }
-}
diff --git a/vendor/symfony/polyfill-php73/README.md b/vendor/symfony/polyfill-php73/README.md
deleted file mode 100644
index 032fafb..0000000
--- a/vendor/symfony/polyfill-php73/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-Symfony Polyfill / Php73
-========================
-
-This component provides functions added to PHP 7.3 core:
-
-- [`array_key_first`](https://php.net/array_key_first)
-- [`array_key_last`](https://php.net/array_key_last)
-- [`hrtime`](https://php.net/function.hrtime)
-- [`is_countable`](https://php.net/is_countable)
-- [`JsonException`](https://php.net/JsonException)
-
-More information can be found in the
-[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
-
-License
-=======
-
-This library is released under the [MIT license](LICENSE).
diff --git a/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php b/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php
deleted file mode 100644
index f06d6c2..0000000
--- a/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-if (\PHP_VERSION_ID < 70300) {
- class JsonException extends Exception
- {
- }
-}
diff --git a/vendor/symfony/polyfill-php73/bootstrap.php b/vendor/symfony/polyfill-php73/bootstrap.php
deleted file mode 100644
index d6b2153..0000000
--- a/vendor/symfony/polyfill-php73/bootstrap.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-use Symfony\Polyfill\Php73 as p;
-
-if (\PHP_VERSION_ID >= 70300) {
- return;
-}
-
-if (!function_exists('is_countable')) {
- function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
-}
-if (!function_exists('hrtime')) {
- require_once __DIR__.'/Php73.php';
- p\Php73::$startAt = (int) microtime(true);
- function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
-}
-if (!function_exists('array_key_first')) {
- function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
-}
-if (!function_exists('array_key_last')) {
- function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
-}
diff --git a/vendor/symfony/polyfill-php73/composer.json b/vendor/symfony/polyfill-php73/composer.json
deleted file mode 100644
index 09d98cb..0000000
--- a/vendor/symfony/polyfill-php73/composer.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "symfony/polyfill-php73",
- "type": "library",
- "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
- "keywords": ["polyfill", "shim", "compatibility", "portable"],
- "homepage": "https://symfony.com",
- "license": "MIT",
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "require": {
- "php": ">=7.2"
- },
- "autoload": {
- "psr-4": { "Symfony\\Polyfill\\Php73\\": "" },
- "files": [ "bootstrap.php" ],
- "classmap": [ "Resources/stubs" ]
- },
- "minimum-stability": "dev",
- "extra": {
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/README.md b/vendor/szepeviktor/phpstan-wordpress/README.md
index e179412..7c28e0b 100644
--- a/vendor/szepeviktor/phpstan-wordpress/README.md
+++ b/vendor/szepeviktor/phpstan-wordpress/README.md
@@ -7,7 +7,7 @@ Please support my work to avoid abandoning this package.
Thank you!
-# WordPress extensions for PHPStan
+# WordPress Extensions for PHPStan
[](https://packagist.org/packages/szepeviktor/phpstan-wordpress/stats)
[](https://packagist.org/packages/szepeviktor/phpstan-wordpress)
@@ -20,30 +20,44 @@ Static analysis for the WordPress ecosystem.
- [PHPStan](https://phpstan.org/)
- [WordPress](https://wordpress.org/)
-### Installation
+## Features
-Add this package to your project.
+- Enables PHPStan to analyze WordPress plugins and themes.
+- Loads the [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs) package.
+- Provides dynamic return type extensions for functions that are not covered in
+ [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs/blob/master/functionMap.php)
+- Defines some WordPress core constants.
+- Validates optional docblocks before `apply_filters()` and `do_action()` calls,
+ treating the type of the first `@param` as definitive.
+
+## Requirements
+
+- PHPStan 2.0 or higher
+- PHP 7.4 or higher (tested up to PHP 8.3)
+
+## Installation
+
+To use this extension, require it in [Composer](https://getcomposer.org/):
```bash
composer require --dev szepeviktor/phpstan-wordpress
```
-Make PHPStan find it automatically using `phpstan/extension-installer`.
+If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!
-```bash
-composer require --dev phpstan/extension-installer
-```
+### Manual Installation
-Or manually include it in your `phpstan.neon`.
+If you don't want to use `phpstan/extension-installer`, include `extension.neon` in your project's PHPStan config:
```neon
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
```
-### Configuration
+## Configuration
-Needs no extra configuration. :smiley: Simply configure PHPStan - for example - this way.
+No additional setup is needed. :smiley:
+Just configure PHPStan - for example - as shown below:
```neon
parameters:
@@ -53,37 +67,32 @@ parameters:
- inc/
```
-Please read [PHPStan Config Reference](https://phpstan.org/config-reference).
+For more details, visit the [PHPStan Config Reference](https://phpstan.org/config-reference).
-:bulb: Use Composer autoloader or a
-[custom autoloader](https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/wp-install/wordpress-autoloader.php)!
+:bulb: Use the Composer autoloader or a [custom autoloader](https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/wp-install/wordpress-autoloader.php)!
-### Usage
+## Usage
-Just start the analysis: `vendor/bin/phpstan analyze`
-then fix an error and `GOTO 10`!
+Run the analysis with:
-You find further information in the `examples` directory
-e.g. [`examples/phpstan.neon.dist`](/examples/phpstan.neon.dist)
+```bash
+vendor/bin/phpstan analyze
+```
-### Usage in WooCommerce webshops
+then fix an error and `GOTO 10`!
-Please see [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs)
+You find further information in the `examples` directory,
+e.g. [`examples/phpstan.neon.dist`](/examples/phpstan.neon.dist)
-### What this extension does
+### Usage in WooCommerce Webshops
-- Makes it possible to run PHPStan on WordPress plugins and themes
-- Loads [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs) package
-- Provides dynamic return type extensions for many core functions
-- Defines some core constants
-- Handles special functions and classes e.g. `is_wp_error()`
-- Validates the optional docblock that precedes a call to `apply_filters()` and treats the type of its first `@param` as certain
+Refer to [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs) for specific guidance.
-### Usage of an `apply_filters()` docblock
+### Usage of an `apply_filters()` Docblock
-WordPress core - and the wider WordPress ecosystem - uses PHPDoc docblocks
-in a non-standard manner to document the parameters passed to `apply_filters()`.
-Example:
+The WordPress ecosystem often uses PHPDoc docblocks in a non-standard way to
+document parameters passed to `apply_filters()`.
+Here’s an example:
```php
/**
@@ -95,32 +104,30 @@ Example:
$title = apply_filters( 'list_pages', $title, $page );
```
-This extension understands these docblocks when they're present in your code
-and uses them to instruct PHPStan to treat the return type of the filter as certain,
-according to the first `@param` tag. In the example above this means PHPStan treats the type of `$title` as `string`.
+This extension reads these docblocks and instructs PHPStan to treat the filter’s
+return type as certain, based on the first `@param` tag. In this example,
+PHPStan interprets `$title` as `string`.
-To make the best use of this feature,
-ensure that the type of the first `@param` tag in each of these such docblocks is accurate and correct.
+For best results, ensure the first `@param` tag in these docblocks is accurate.
-### Make your code testable
+## Make Your Code Testable
-- Write clean OOP code: 1 class per file, no other code in class files outside `class Name { ... }`
-- Structure your code: uniform class names (WPCS or PSR-4), keep classes in a separate directory `inc/`
-- Add proper PHPDoc blocks to classes, properties, methods, functions, and calls to `apply_filters()`
+- Write clean OOP code: 1 class per file, and no additional code outside `class Name { ... }`.
+- Use consistent class naming (WPCS or PSR-4) and store classes in a dedicated `inc/` directory.
+- Add precise PHPDoc blocks to classes, properties, methods, functions, and
+ `apply_filters()` calls.
- Choose your [main plugin file parts](https://github.com/szepeviktor/starter-plugin).
-- Avoid using core constants, use core functions
-- Avoid bad parts of PHP
- - functions: `eval`, `extract`, `compact`, `list`
- - [type juggling](https://www.php.net/manual/en/language.types.type-juggling.php): `$a = '15'; if ($a) ...`
+- Avoid using core constants, use core functions.
+- Avoid bad PHP practices, such as:
+ - functions: `eval`, `extract`, `compact`, `list`
+ - [type juggling](https://www.php.net/manual/en/language.types.type-juggling.php): `$a = '15'; if ($a) ...`
- If you need robust code try avoiding all kinds of type juggling (e.g. `if` needs a boolean),
see [Variable handling functions](https://www.php.net/manual/en/ref.var.php)
-- If you are not bound by PHP 5 consider following
- [Neutron Standard](https://github.com/Automattic/phpcs-neutron-standard)
-- Do not enable `exit_error` in `WP_CLI::launch` or `WP_CLI::runcommand` to keep your code testable
+- Avoid enabling `exit_error` in `WP_CLI::launch` or `WP_CLI::runcommand` for improved testability.
-### Dirty corner (FAQ)
+## Dirty Corner (FAQ)
-WordPress uses conditional function and class definition for override purposes.
+WordPress uses conditional function and class definition to allow overrides.
Use `sed` command to exclude function stubs when they are previously defined.
```bash
diff --git a/vendor/szepeviktor/phpstan-wordpress/bootstrap.php b/vendor/szepeviktor/phpstan-wordpress/bootstrap.php
index 2ca9183..8970f8f 100644
--- a/vendor/szepeviktor/phpstan-wordpress/bootstrap.php
+++ b/vendor/szepeviktor/phpstan-wordpress/bootstrap.php
@@ -2,19 +2,20 @@
declare(strict_types=1);
-// phpcs:disable Squiz.PHP.DiscouragedFunctions,NeutronStandard.Constants.DisallowDefine
+// phpcs:disable Generic.PHP.ForbiddenFunctions.Found
// There are no core functions to read these constants.
-define('ABSPATH', './');
+define('ABSPATH', '/');
+define('WP_CONTENT_DIR', sprintf('%swp-content', ABSPATH));
+define('WP_PLUGIN_DIR', sprintf('%s/plugins', WP_CONTENT_DIR));
+define('WPMU_PLUGIN_DIR', sprintf('%s/mu-plugins', WP_CONTENT_DIR));
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
-define('WP_DEBUG_DISPLAY', true);
-define('WP_PLUGIN_DIR', './');
-define('WPMU_PLUGIN_DIR', './');
-define('EMPTY_TRASH_DAYS', 30 * 86400);
+define('WP_DEBUG_DISPLAY', false);
+define('EMPTY_TRASH_DAYS', 30);
define('SCRIPT_DEBUG', false);
-define('WP_LANG_DIR', './');
-define('WP_CONTENT_DIR', './');
+define('WP_LANG_DIR', sprintf('%s/languages', WP_CONTENT_DIR));
+define('COOKIE_DOMAIN', '');
// Constants for expressing human-readable intervals.
define('MINUTE_IN_SECONDS', 60);
@@ -29,6 +30,10 @@
define('MB_IN_BYTES', 1024 * KB_IN_BYTES);
define('GB_IN_BYTES', 1024 * MB_IN_BYTES);
define('TB_IN_BYTES', 1024 * GB_IN_BYTES);
+define('PB_IN_BYTES', 1024 * TB_IN_BYTES);
+define('EB_IN_BYTES', 1024 * PB_IN_BYTES);
+define('ZB_IN_BYTES', 1024 * EB_IN_BYTES);
+define('YB_IN_BYTES', 1024 * ZB_IN_BYTES);
// wpdb method parameters.
define('OBJECT', 'OBJECT');
@@ -61,8 +66,4 @@
define('EP_ALL', EP_PERMALINK | EP_ATTACHMENT | EP_ROOT | EP_COMMENTS | EP_SEARCH | EP_PAGES | EP_ALL_ARCHIVES);
// Templating-related WordPress constants.
-// phpcs:ignore WordPress.WP.DiscouragedConstants.STYLESHEETPATHDeclarationFound
-define('STYLESHEETPATH', '/app/wp-content/themes/child/');
-// phpcs:ignore WordPress.WP.DiscouragedConstants.TEMPLATEPATHDeclarationFound
-define('TEMPLATEPATH', '/app/wp-content/themes/parent/');
define('WP_DEFAULT_THEME', 'twentytwentythree');
diff --git a/vendor/szepeviktor/phpstan-wordpress/composer.json b/vendor/szepeviktor/phpstan-wordpress/composer.json
index c65768b..e7230f4 100644
--- a/vendor/szepeviktor/phpstan-wordpress/composer.json
+++ b/vendor/szepeviktor/phpstan-wordpress/composer.json
@@ -11,23 +11,25 @@
"phpstan"
],
"require": {
- "php": "^7.2 || ^8.0",
- "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0",
- "phpstan/phpstan": "^1.10.31",
- "symfony/polyfill-php73": "^1.12.0"
+ "php": "^7.4 || ^8.0",
+ "php-stubs/wordpress-stubs": "^6.6.2",
+ "phpstan/phpstan": "^2.0"
},
"require-dev": {
"composer/composer": "^2.1.14",
+ "composer/semver": "^3.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.1",
- "phpstan/phpstan-strict-rules": "^1.2",
- "phpunit/phpunit": "^8.0 || ^9.0",
+ "phpstan/phpstan-strict-rules": "^2.0",
+ "phpunit/phpunit": "^9.0",
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
},
"suggest": {
"swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods"
},
+ "minimum-stability": "dev",
+ "prefer-stable": true,
"autoload": {
"psr-4": {
"SzepeViktor\\PHPStan\\WordPress\\": "src/"
@@ -41,7 +43,8 @@
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
- }
+ },
+ "sort-packages": true
},
"extra": {
"phpstan": {
diff --git a/vendor/szepeviktor/phpstan-wordpress/extension.neon b/vendor/szepeviktor/phpstan-wordpress/extension.neon
index d3f6ea3..79ec298 100644
--- a/vendor/szepeviktor/phpstan-wordpress/extension.neon
+++ b/vendor/szepeviktor/phpstan-wordpress/extension.neon
@@ -2,71 +2,15 @@ services:
-
class: SzepeViktor\PHPStan\WordPress\HookDocBlock
-
- class: SzepeViktor\PHPStan\WordPress\WpThemeGetDynamicMethodReturnTypeExtension
- tags:
- - phpstan.broker.dynamicMethodReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\IsWpErrorFunctionTypeSpecifyingExtension
- tags:
- - phpstan.typeSpecifier.functionTypeSpecifyingExtension
- -
- class: SzepeViktor\PHPStan\WordPress\WpThemeMagicPropertiesClassReflectionExtension
- tags:
- - phpstan.broker.propertiesClassReflectionExtension
- -
- class: SzepeViktor\PHPStan\WordPress\EchoKeyDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetApprovedCommentsDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetPermalinkDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetListTableDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\RedirectCanonicalDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\StringOrArrayDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetTermsDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetPostDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetPostsDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetSitesDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetTaxonomiesDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\GetObjectTaxonomiesDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\ApplyFiltersDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
- class: SzepeViktor\PHPStan\WordPress\GetCommentDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\EscSqlDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
- class: SzepeViktor\PHPStan\WordPress\HasFilterDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\NormalizeWhitespaceDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
@@ -74,27 +18,11 @@ services:
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
- class: SzepeViktor\PHPStan\WordPress\MySQL2DateDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\StripslashesFromStringsOnlyDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
- class: SzepeViktor\PHPStan\WordPress\CurrentTimeDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\ApplyFiltersDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\EchoParameterDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\WpErrorParameterDynamicFunctionReturnTypeExtension
- tags:
- - phpstan.broker.dynamicFunctionReturnTypeExtension
- -
- class: SzepeViktor\PHPStan\WordPress\TermExistsDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\SlashitFunctionsDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
@@ -102,7 +30,7 @@ services:
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
- class: SzepeViktor\PHPStan\WordPress\WpDieDynamicFunctionReturnTypeExtension
+ class: SzepeViktor\PHPStan\WordPress\WpSlashDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
@@ -113,51 +41,41 @@ services:
class: SzepeViktor\PHPStan\WordPress\AssertWpErrorTypeSpecifyingExtension
tags:
- phpstan.typeSpecifier.methodTypeSpecifyingExtension
- -
- class: SzepeViktor\PHPStan\WordPress\AssertNotWpErrorTypeSpecifyingExtension
- tags:
- - phpstan.typeSpecifier.methodTypeSpecifyingExtension
rules:
- SzepeViktor\PHPStan\WordPress\HookCallbackRule
- SzepeViktor\PHPStan\WordPress\HookDocsRule
- - SzepeViktor\PHPStan\WordPress\IsWpErrorRule
+ - SzepeViktor\PHPStan\WordPress\WpConstantFetchRule
parameters:
bootstrapFiles:
- ../../php-stubs/wordpress-stubs/wordpress-stubs.php
- bootstrap.php
dynamicConstantNames:
+ # Debug constants
- WP_DEBUG
- WP_DEBUG_LOG
- WP_DEBUG_DISPLAY
- - EMPTY_TRASH_DAYS
- - WP_CLI
+ # Directory constants
+ - ABSPATH
+ - WP_PLUGIN_DIR
+ - WP_LANG_DIR
+ - WP_CONTENT_DIR
+ - WPMU_PLUGIN_DIR
+ # Templating constants
+ - WP_DEFAULT_THEME
+ # Filesystem constants
+ - FS_CONNECT_TIMEOUT
+ - FS_TIMEOUT
+ - FS_CHMOD_DIR
+ - FS_CHMOD_FILE
+ # Other constants
- COOKIE_DOMAIN
- - SAVEQUERIES
+ - EMPTY_TRASH_DAYS
- SCRIPT_DEBUG
earlyTerminatingFunctionCalls:
- wp_send_json
- - wp_send_json_success
- - wp_send_json_error
- wp_nonce_ays
- - comment_footer_die
- - dead_db
- - do_favicon
- - install_theme_information
- - media_send_to_editor
- - redirect_post
- - wp_ajax_heartbeat
- - wp_ajax_nopriv_heartbeat
earlyTerminatingMethodCalls:
- Custom_Background:
- - wp_set_background_image
IXR_Server:
- output
WP_Ajax_Response:
- send
- WP_CLI:
- - error
- - halt
- WP_Recovery_Mode:
- - redirect_protected
- WP_Sitemaps_Stylesheet:
- - render_stylesheet
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/ApplyFiltersDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/ApplyFiltersDynamicFunctionReturnTypeExtension.php
index ce618b5..bb093ef 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/ApplyFiltersDynamicFunctionReturnTypeExtension.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/ApplyFiltersDynamicFunctionReturnTypeExtension.php
@@ -16,8 +16,7 @@
class ApplyFiltersDynamicFunctionReturnTypeExtension implements \PHPStan\Type\DynamicFunctionReturnTypeExtension
{
- /** @var \SzepeViktor\PHPStan\WordPress\HookDocBlock */
- protected $hookDocBlock;
+ protected HookDocBlock $hookDocBlock;
public function __construct(HookDocBlock $hookDocBlock)
{
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/AssertNotWpErrorTypeSpecifyingExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/AssertNotWpErrorTypeSpecifyingExtension.php
deleted file mode 100644
index f186a58..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/AssertNotWpErrorTypeSpecifyingExtension.php
+++ /dev/null
@@ -1,51 +0,0 @@
-getName()) === 'assertnotwperror'
- && isset($node->args[0])
- && $context->null();
- }
-
- // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
- public function specifyTypes(MethodReflection $methodReflection, MethodCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
- {
- $expr = $node->getArgs()[0]->value;
- $typeBefore = $scope->getType($expr);
- $type = TypeCombinator::remove($typeBefore, new ObjectType(\WP_Error::class));
-
- return $this->typeSpecifier->create($expr, $type, TypeSpecifierContext::createTruthy());
- }
-
- public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
- {
- $this->typeSpecifier = $typeSpecifier;
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/AssertWpErrorTypeSpecifyingExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/AssertWpErrorTypeSpecifyingExtension.php
index d6665c9..0383ea9 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/AssertWpErrorTypeSpecifyingExtension.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/AssertWpErrorTypeSpecifyingExtension.php
@@ -1,25 +1,30 @@
getName()) === 'assertwperror'
+ return in_array($methodReflection->getName(), [self::ASSERT, self::ASSERT_NOT], true)
&& isset($node->args[0])
&& $context->null();
}
@@ -36,12 +41,16 @@ public function isMethodSupported(MethodReflection $methodReflection, MethodCall
// phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
public function specifyTypes(MethodReflection $methodReflection, MethodCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
{
- $args = $node->getArgs();
+ $expression = new Instanceof_($node->getArgs()[0]->value, new Name('WP_Error'));
+
+ if ($methodReflection->getName() === self::ASSERT_NOT) {
+ $expression = new BooleanNot($expression);
+ }
- return $this->typeSpecifier->create(
- $args[0]->value,
- new ObjectType(\WP_Error::class),
- TypeSpecifierContext::createTruthy()
+ return $this->typeSpecifier->specifyTypesInCondition(
+ $scope,
+ $expression,
+ TypeSpecifierContext::createTruthy(),
);
}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/CurrentTimeDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/CurrentTimeDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index e4bdeb2..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/CurrentTimeDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,56 +0,0 @@
-getName() === 'current_time';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/current_time/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $argumentType = $scope->getType($functionCall->getArgs()[0]->value);
-
- // When called with a $type that isn't a constant string, return default return type
- if (count($argumentType->getConstantStrings()) === 0) {
- return null;
- }
-
- // Called with a constant string $type
- $returnType = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'timestamp':
- case 'U':
- $returnType[] = new IntegerType();
- break;
- case 'mysql':
- default:
- $returnType[] = new StringType();
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/EchoKeyDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/EchoKeyDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index c83d6f9..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/EchoKeyDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,197 +0,0 @@
- 0,
- 'the_title_attribute' => 0,
- 'wp_dropdown_categories' => 0,
- 'wp_dropdown_languages' => 0,
- 'wp_dropdown_pages' => 0,
- 'wp_dropdown_users' => 0,
- 'wp_get_archives' => 0,
- 'wp_link_pages' => 0,
- 'wp_list_authors' => 0,
- 'wp_list_bookmarks' => 0,
- 'wp_list_categories' => 0,
- 'wp_list_comments' => 0,
- 'wp_list_pages' => 0,
- 'wp_list_users' => 0,
- 'wp_login_form' => 0,
- 'wp_page_menu' => 0,
- ];
-
- /**
- * Functions that do not accept a query string.
- */
- private const STRICTLY_ARRAY = [
- 'get_search_form',
- 'wp_login_form',
- ];
-
- /**
- * Functions that can return void even if `$echo` is falsey.
- */
- private const ALWAYS_VOID = [
- 'the_title_attribute',
- 'wp_dropdown_languages',
- 'wp_get_archives',
- 'wp_list_comments',
- ];
-
- /** @var \PHPStan\Reflection\FunctionReflection */
- private $reflection;
-
- /** @var \PHPStan\Analyser\Scope */
- private $scope;
-
- /** @var array<\PhpParser\Node\Arg> */
- private $args;
-
- /** @var string */
- private $name;
-
- /** @var ?int */
- private $paramPos;
-
- /** @var \PHPStan\Type\Type */
- private $defaultType;
-
- public function isFunctionSupported(FunctionReflection $functionReflection): bool
- {
- return array_key_exists($functionReflection->getName(), self::FUNCTIONS);
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_search_form/
- * @see https://developer.wordpress.org/reference/functions/the_title_attribute/
- * @see https://developer.wordpress.org/reference/functions/wp_dropdown_categories/
- * @see https://developer.wordpress.org/reference/functions/wp_dropdown_languages/
- * @see https://developer.wordpress.org/reference/functions/wp_dropdown_pages/
- * @see https://developer.wordpress.org/reference/functions/wp_dropdown_users/
- * @see https://developer.wordpress.org/reference/functions/wp_get_archives/
- * @see https://developer.wordpress.org/reference/functions/wp_link_pages/
- * @see https://developer.wordpress.org/reference/functions/wp_list_authors/
- * @see https://developer.wordpress.org/reference/functions/wp_list_bookmarks/
- * @see https://developer.wordpress.org/reference/functions/wp_list_categories/
- * @see https://developer.wordpress.org/reference/functions/wp_list_comments/
- * @see https://developer.wordpress.org/reference/functions/wp_list_pages/
- * @see https://developer.wordpress.org/reference/functions/wp_list_users/
- * @see https://developer.wordpress.org/reference/functions/wp_login_form/
- * @see https://developer.wordpress.org/reference/functions/wp_page_menu/
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $this->reflection = $functionReflection;
- $this->scope = $scope;
- $this->args = $functionCall->getArgs();
- $this->name = $functionReflection->getName();
- $this->paramPos = self::FUNCTIONS[$this->name] ?? null;
- $this->defaultType = $this->getDefaultReturnType();
-
- if (! isset($this->args[$this->paramPos])) {
- return $this->getEchoTrueReturnType();
- }
-
- $echoType = $this->getEchoType();
- if ($echoType->isTrue()->yes() || $echoType->isFalse()->yes()) {
- return $echoType->isTrue()->yes()
- ? $this->getEchoTrueReturnType()
- : $this->getEchoFalseReturnType();
- }
-
- return $this->defaultType;
- }
-
- private function getEchoType(): Type
- {
- $argType = $this->scope->getType($this->args[$this->paramPos]->value);
-
- if ($argType->isArray()->yes()) {
- return $argType->getOffsetValueType(new ConstantStringType('echo'))->toBoolean();
- }
-
- if (
- ! in_array($this->name, self::STRICTLY_ARRAY, true) &&
- count($argType->getConstantStrings()) !== 0
- ) {
- return TypeCombinator::union(
- ...array_map(
- static function (ConstantStringType $constantStringType): ConstantBooleanType {
- parse_str($constantStringType->getValue(), $parsed);
- return ! isset($parsed['echo'])
- ? new ConstantBooleanType(true)
- : new ConstantBooleanType((bool)$parsed['echo']);
- },
- $argType->getConstantStrings()
- )
- );
- }
-
- return new MixedType();
- }
-
- private function getEchoFalseReturnType(): Type
- {
- if (! in_array($this->name, self::ALWAYS_VOID, true)) {
- return TypeCombinator::remove($this->defaultType, new VoidType());
- }
-
- return $this->defaultType;
- }
-
- private function getEchoTrueReturnType(): Type
- {
- $type = [
- 'wp_list_categories' => TypeCombinator::union(
- new VoidType(),
- new ConstantBooleanType(false)
- ),
- ];
-
- return $type[$this->name] ?? new VoidType();
- }
-
- private function getDefaultReturnType(): Type
- {
- $defaultType = ParametersAcceptorSelector::selectFromArgs(
- $this->scope,
- $this->args,
- $this->reflection->getVariants()
- )->getReturnType();
-
- // Fix omitted void type in WP doc block.
- $defaultType = TypeCombinator::union($defaultType, new VoidType());
-
- if ($this->name === 'wp_list_users') {
- // null instead of void in WP doc block.
- $defaultType = TypeCombinator::remove($defaultType, new NullType());
- }
-
- return $defaultType;
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/EchoParameterDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/EchoParameterDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index b419b55..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/EchoParameterDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,149 +0,0 @@
- 2,
- 'comment_class' => 3,
- 'disabled' => 2,
- 'edit_term_link' => 4,
- 'get_calendar' => 1,
- 'menu_page_url' => 1,
- 'next_posts' => 1,
- 'post_type_archive_title' => 1,
- 'previous_posts' => 0,
- 'selected' => 2,
- 'single_cat_title' => 1,
- 'single_month_title' => 1,
- 'single_post_title' => 1,
- 'single_tag_title' => 1,
- 'single_term_title' => 1,
- 'the_date' => 3,
- 'the_modified_date' => 3,
- 'the_title' => 2,
- 'wp_loginout' => 1,
- 'wp_nonce_field' => 3,
- 'wp_original_referer_field' => 0,
- 'wp_readonly' => 2,
- 'wp_referer_field' => 0,
- 'wp_register' => 2,
- 'wp_title' => 1,
- ];
-
- public function isFunctionSupported(FunctionReflection $functionReflection): bool
- {
- return array_key_exists($functionReflection->getName(), self::SUPPORTED_FUNCTIONS);
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/checked/
- * @see https://developer.wordpress.org/reference/functions/comment_class/
- * @see https://developer.wordpress.org/reference/functions/disabled/
- * @see https://developer.wordpress.org/reference/functions/edit_term_link/
- * @see https://developer.wordpress.org/reference/functions/get_calendar/
- * @see https://developer.wordpress.org/reference/functions/menu_page_url/
- * @see https://developer.wordpress.org/reference/functions/next_posts/
- * @see https://developer.wordpress.org/reference/functions/post_type_archive_title/
- * @see https://developer.wordpress.org/reference/functions/previous_posts/
- * @see https://developer.wordpress.org/reference/functions/selected/
- * @see https://developer.wordpress.org/reference/functions/single_cat_title/
- * @see https://developer.wordpress.org/reference/functions/single_month_title/
- * @see https://developer.wordpress.org/reference/functions/single_post_title/
- * @see https://developer.wordpress.org/reference/functions/single_tag_title/
- * @see https://developer.wordpress.org/reference/functions/single_term_title/
- * @see https://developer.wordpress.org/reference/functions/the_date/
- * @see https://developer.wordpress.org/reference/functions/the_modified_date/
- * @see https://developer.wordpress.org/reference/functions/the_title/
- * @see https://developer.wordpress.org/reference/functions/wp_loginout/
- * @see https://developer.wordpress.org/reference/functions/wp_nonce_field/
- * @see https://developer.wordpress.org/reference/functions/wp_original_referer_field/
- * @see https://developer.wordpress.org/reference/functions/wp_readonly/
- * @see https://developer.wordpress.org/reference/functions/wp_referer_field/
- * @see https://developer.wordpress.org/reference/functions/wp_register/
- * @see https://developer.wordpress.org/reference/functions/wp_title/
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $name = $functionReflection->getName();
- $functionParameter = self::SUPPORTED_FUNCTIONS[$name] ?? null;
- $args = $functionCall->getArgs();
-
- if ($functionParameter === null) {
- throw new \PHPStan\ShouldNotHappenException(
- sprintf(
- 'Could not detect return types for function %s()',
- $name
- )
- );
- }
-
- $echoArgumentType = new ConstantBooleanType(true);
-
- if (isset($args[$functionParameter])) {
- $echoArgumentType = $scope->getType($args[$functionParameter]->value);
- }
-
- if ($echoArgumentType->isTrue()->yes()) {
- return self::getEchoTrueReturnType($name);
- }
- if ($echoArgumentType->isFalse()->yes()) {
- return self::getEchoFalseReturnType($name);
- }
-
- return TypeCombinator::union(
- self::getEchoFalseReturnType($name),
- self::getEchoTrueReturnType($name)
- );
- }
-
- protected static function getEchoTrueReturnType(string $name): Type
- {
- if ($name === 'single_month_title') {
- return TypeCombinator::union(
- new VoidType(),
- new ConstantBooleanType(false)
- );
- }
-
- return new VoidType();
- }
-
- protected static function getEchoFalseReturnType(string $name): Type
- {
- if ($name === 'single_month_title') {
- return TypeCombinator::union(
- new StringType(),
- new ConstantBooleanType(false)
- );
- }
-
- if ($name === 'the_title') {
- return TypeCombinator::union(
- new StringType(),
- new VoidType()
- );
- }
-
- return new StringType();
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/StringOrArrayDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/EscSqlDynamicFunctionReturnTypeExtension.php
similarity index 96%
rename from vendor/szepeviktor/phpstan-wordpress/src/StringOrArrayDynamicFunctionReturnTypeExtension.php
rename to vendor/szepeviktor/phpstan-wordpress/src/EscSqlDynamicFunctionReturnTypeExtension.php
index 77eaf54..c63f596 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/StringOrArrayDynamicFunctionReturnTypeExtension.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/EscSqlDynamicFunctionReturnTypeExtension.php
@@ -20,7 +20,7 @@
use PHPStan\Type\TypeTraverser;
use PHPStan\Type\UnionType;
-class StringOrArrayDynamicFunctionReturnTypeExtension implements \PHPStan\Type\DynamicFunctionReturnTypeExtension
+class EscSqlDynamicFunctionReturnTypeExtension implements \PHPStan\Type\DynamicFunctionReturnTypeExtension
{
public function isFunctionSupported(FunctionReflection $functionReflection): bool
{
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetApprovedCommentsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetApprovedCommentsDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 622deac..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetApprovedCommentsDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,92 +0,0 @@
-getName() === 'get_approved_comments';
- }
-
- /**
- * - Return `WP_Comment[]` by default.
- * - Return `int[]` if `$fields = 'ids'`.
- * - Return `int` if `$count = true`.
- *
- * @see https://developer.wordpress.org/reference/functions/get_approved_comments/#parameters
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $args = $functionCall->getArgs();
-
- if (\count($args) < 2) {
- return self::defaultType();
- }
-
- $argumentType = $scope->getType($args[1]->value);
- if ($argumentType->isConstantArray()->no()) {
- return self::getIndeterminedType();
- }
-
- foreach ($argumentType->getConstantArrays() as $array) {
- if ($array->hasOffsetValueType(new ConstantStringType('count'))->yes()) {
- $fieldsValueTypes = $array->getOffsetValueType(new ConstantStringType('count'));
- if ($fieldsValueTypes->isTrue()->yes()) {
- return new IntegerType();
- }
- }
- if (! $array->hasOffsetValueType(new ConstantStringType('fields'))->yes()) {
- continue;
- }
-
- $fieldsValueTypes = $array->getOffsetValueType(new ConstantStringType('fields'))->getConstantStrings();
- if (\count($fieldsValueTypes) === 0) {
- return self::getIndeterminedType();
- }
- if ($fieldsValueTypes[0]->getValue() === 'ids') {
- return new ArrayType(new IntegerType(), new IntegerType());
- }
- }
-
- return self::defaultType();
- }
-
- protected static function defaultType(): Type
- {
- return new ArrayType(new IntegerType(), new ObjectType(WP_Comment::class));
- }
-
- /**
- * Type defined on the PHPDocs.
- *
- * @return \PHPStan\Type\Type
- */
- protected static function getIndeterminedType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new ObjectType(WP_Comment::class)),
- new ArrayType(new IntegerType(), new IntegerType()),
- new IntegerType()
- );
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetCommentDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetCommentDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 5aa7682..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetCommentDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,84 +0,0 @@
-getName() === 'get_comment';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_comment/
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $args = $functionCall->getArgs();
- $returnType = [new NullType()];
-
- if (
- count($args) > 0 &&
- (new ObjectType(WP_Comment::class))->isSuperTypeOf($scope->getType($args[0]->value))->yes()
- ) {
- $returnType = [];
- }
-
- if (count($args) < 2) {
- $returnType[] = new ObjectType(WP_Comment::class);
- }
-
- if (count($args) >= 2) {
- $outputType = $scope->getType($args[1]->value);
-
- // When called with an $output that isn't a constant string, return default return type
- if (count($outputType->getConstantStrings()) === 0) {
- if ($returnType === []) {
- return TypeCombinator::removeNull(
- ParametersAcceptorSelector::selectFromArgs(
- $scope,
- $args,
- $functionReflection->getVariants()
- )->getReturnType()
- );
- }
- return null;
- }
-
- foreach ($outputType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'ARRAY_A':
- $returnType[] = new ArrayType(new StringType(), new MixedType());
- break;
- case 'ARRAY_N':
- $returnType[] = new ArrayType(new IntegerType(), new MixedType());
- break;
- default:
- $returnType[] = new ObjectType(WP_Comment::class);
- }
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetListTableDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetListTableDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 70ee5f3..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetListTableDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,76 +0,0 @@
-getName() === '_get_list_table';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/_get_list_table/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $args = $functionCall->getArgs();
-
- // Called without $class argument
- if (count($args) < 1) {
- return null;
- }
-
- $argumentType = $scope->getType($args[0]->value);
-
- // When called with a $class that isn't a constant string, return default return type
- if (count($argumentType->getConstantStrings()) === 0) {
- return null;
- }
-
- $types = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- $types[] = in_array($constantString->getValue(), self::CORE_CLASSES, true)
- ? new ObjectType($constantString->getValue())
- : new ConstantBooleanType(false);
- }
-
- return TypeCombinator::union(...$types);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetObjectTaxonomiesDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetObjectTaxonomiesDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 0470a1f..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetObjectTaxonomiesDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,65 +0,0 @@
-getName() === 'get_object_taxonomies';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_object_taxonomies/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $args = $functionCall->getArgs();
-
- // Called without second $output argument
- if (count($args) <= 1) {
- return new ArrayType(new IntegerType(), new StringType());
- }
-
- $argumentType = $scope->getType($args[1]->value);
-
- // When called with an $output that isn't a constant string, return default return type
- if (count($argumentType->getConstantStrings()) === 0) {
- return null;
- }
-
- // Called with a constant string $output
- $returnType = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'objects':
- $returnType[] = new ArrayType(new StringType(), new ObjectType(WP_Taxonomy::class));
- break;
- case 'names':
- default:
- $returnType[] = new ArrayType(new IntegerType(), new StringType());
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetPermalinkDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetPermalinkDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index aa0a2de..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetPermalinkDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,57 +0,0 @@
-getName(),
- [
- 'get_permalink',
- 'get_post_permalink',
- 'get_the_permalink',
- ],
- true
- );
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_permalink/
- * @see https://developer.wordpress.org/reference/functions/get_post_permalink/
- * @see https://developer.wordpress.org/reference/functions/get_the_permalink/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $args = $functionCall->getArgs();
-
- if (count($args) !== 0) {
- $type = $scope->getType($args[0]->value);
-
- // Called with a WP_Post instance
- if ((new ObjectType(WP_Post::class))->isSuperTypeOf($type)->yes()) {
- return new StringType();
- }
- }
-
- // When called without arguments or with a $type that isn't a WP_Post instance, return default return type
- return null;
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetPostDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetPostDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 7d4c5f1..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetPostDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,87 +0,0 @@
-getName(),
- [
- 'get_post',
- 'get_page_by_path',
- ],
- true
- );
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_post/
- * @see https://developer.wordpress.org/reference/functions/get_page_by_path/
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
- $returnType = [new NullType()];
-
- // When called with an instance of WP_Post
- if (
- $functionReflection->getName() === 'get_post' &&
- count($args) > 0 &&
- (new ObjectType(WP_Post::class))->isSuperTypeOf($scope->getType($args[0]->value))->yes()
- ) {
- $returnType = [];
- }
-
- if (count($args) < 2) {
- $returnType[] = new ObjectType(WP_Post::class);
- }
-
- if (count($args) >= 2) {
- $outputType = $scope->getType($args[1]->value);
-
- // When called with an $output that isn't a constant string
- if (count($outputType->getConstantStrings()) === 0) {
- $returnType[] = new ArrayType(new StringType(), new MixedType());
- $returnType[] = new ArrayType(new IntegerType(), new MixedType());
- $returnType[] = new ObjectType(WP_Post::class);
- return TypeCombinator::union(...$returnType);
- }
-
- foreach ($outputType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'ARRAY_A':
- $returnType[] = new ArrayType(new StringType(), new MixedType());
- break;
- case 'ARRAY_N':
- $returnType[] = new ArrayType(new IntegerType(), new MixedType());
- break;
- default:
- $returnType[] = new ObjectType(WP_Post::class);
- }
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetPostsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetPostsDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 6d9dfd9..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetPostsDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,105 +0,0 @@
-getName() === 'get_posts';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
-
- // Called without arguments
- if (count($args) === 0) {
- return self::getObjectType();
- }
-
- $argumentType = $scope->getType($args[0]->value);
- $returnTypes = [];
-
- if ($argumentType->isConstantArray()->no()) {
- return self::getIndeterminedType();
- }
-
- if ($argumentType->isConstantArray()->maybe()) {
- $returnTypes[] = self::getIndeterminedType();
- }
-
- foreach ($argumentType->getConstantArrays() as $array) {
- if ($array->hasOffsetValueType(new ConstantStringType('fields'))->no()) {
- $returnTypes[] = self::getObjectType();
- continue;
- }
-
- if ($array->hasOffsetValueType(new ConstantStringType('fields'))->maybe()) {
- $returnTypes[] = self::getIndeterminedType();
- continue;
- }
-
- $fieldsValueTypes = $array->getOffsetValueType(new ConstantStringType('fields'))->getConstantStrings();
-
- if (count($fieldsValueTypes) === 0) {
- $returnTypes[] = self::getIndeterminedType();
- continue;
- }
-
- foreach ($fieldsValueTypes as $fieldsValueType) {
- switch ($fieldsValueType->getValue()) {
- case 'id=>parent':
- case 'ids':
- $returnTypes[] = self::getIntType();
- break;
- default:
- $returnTypes[] = self::getObjectType();
- }
- }
- }
- return TypeCombinator::union(...$returnTypes);
- }
-
- private static function getIntType(): Type
- {
- return new ArrayType(new IntegerType(), new IntegerType());
- }
-
- private static function getObjectType(): Type
- {
- return new ArrayType(new IntegerType(), new ObjectType(WP_Post::class));
- }
-
- private static function getIndeterminedType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new ObjectType(WP_Post::class)),
- new ArrayType(new IntegerType(), new IntegerType())
- );
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetSitesDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetSitesDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 204c788..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetSitesDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,169 +0,0 @@
- $fields */
- private $fields;
-
- /** @var array $count */
- private $count;
-
- public function isFunctionSupported(FunctionReflection $functionReflection): bool
- {
- return $functionReflection->getName() === 'get_sites';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_sites/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
-
- // Called without arguments
- if (count($args) === 0) {
- return self::getDefaultType();
- }
-
- $argumentType = $scope->getType($args[0]->value);
-
- $this->fields = [];
- $this->count = [];
-
- // Called with a non constant argument
- if (
- count($argumentType->getConstantArrays()) === 0 &&
- count($argumentType->getConstantStrings()) === 0
- ) {
- return self::getIndeterminedType();
- }
-
- // Called with a constant array argument
- if (count($argumentType->getConstantArrays()) !== 0) {
- foreach ($argumentType->getConstantArrays() as $constantArray) {
- $this->getValuesFromArray($constantArray);
- }
- }
-
- // Called with a constant string argument
- if (count($argumentType->getConstantStrings()) !== 0) {
- foreach ($argumentType->getConstantStrings() as $constantString) {
- $this->getValuesFromString($constantString);
- }
- }
-
- return TypeCombinator::union(...$this->getReturnTypeFromArgs());
- }
-
- /**
- * @return list<\PHPStan\Type\IntegerType|\PHPStan\Type\ArrayType>
- */
- private function getReturnTypeFromArgs(): array
- {
- $this->fields = array_unique($this->fields);
- $this->count = array_unique($this->count);
-
- if (in_array(true, $this->count, true) && count($this->count) === 1) {
- return [new IntegerType()];
- }
-
- $returnType = [];
-
- if (in_array(true, $this->count, true)) {
- $returnType[] = new IntegerType();
- }
-
- if (in_array('ids', $this->fields, true)) {
- $returnType[] = new ArrayType(new IntegerType(), new IntegerType());
- }
-
- if (
- (in_array('ids', $this->fields, true) && count($this->fields) > 1) ||
- (! in_array('ids', $this->fields, true) && count($this->fields) > 0)
- ) {
- $returnType[] = self::getDefaultType();
- }
-
- return $returnType;
- }
-
- private function getValuesFromArray(ConstantArrayType $constantArray): void
- {
- foreach ($constantArray->getKeyTypes() as $index => $keyType) {
- if (count($keyType->getConstantStrings()) === 0) {
- continue;
- }
- foreach ($keyType->getConstantStrings() as $constantKey) {
- if (! in_array($constantKey->getValue(), ['fields', 'count'], true)) {
- continue;
- }
- $fieldsType = $constantArray->getValueTypes()[$index];
- if (count($fieldsType->getConstantScalarValues()) === 0) {
- continue;
- }
-
- foreach ($fieldsType->getConstantScalarTypes() as $constantField) {
- if ($constantKey->getValue() === 'fields') {
- $this->fields[] = $constantField->getValue();
- }
- if ($constantKey->getValue() !== 'count') {
- continue;
- }
-
- $this->count[] = (bool)$constantField->getValue();
- }
- }
- }
-
- // If fields and count are not set, add their default value.
- if ($this->fields === []) {
- $this->fields[] = '';
- }
- if ($this->count === []) { // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
- $this->count[] = false;
- }
- }
-
- private function getValuesFromString(ConstantStringType $constantString): void
- {
- parse_str($constantString->getValue(), $variables);
- $this->fields[] = $variables['fields'] ?? '';
- $this->count[] = isset($variables['count']) ? (bool)$variables['count'] : false;
- }
-
- private static function getIndeterminedType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new ObjectType(WP_Site::class)),
- new ArrayType(new IntegerType(), new IntegerType()),
- new IntegerType()
- );
- }
-
- private static function getDefaultType(): ArrayType
- {
- return new ArrayType(new IntegerType(), new ObjectType(WP_Site::class));
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetTaxonomiesDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetTaxonomiesDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index e810619..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetTaxonomiesDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,70 +0,0 @@
-getName() === 'get_taxonomies';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_taxonomies/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $objectsReturnType = new ArrayType(new StringType(), new ObjectType(WP_Taxonomy::class));
- $namesReturnType = new ArrayType(new StringType(), new StringType());
-
- $args = $functionCall->getArgs();
-
- // Called without second $output arguments
- if (count($args) <= 1) {
- return $namesReturnType;
- }
-
- $argumentType = $scope->getType($args[1]->value);
-
- // When called with a non-string $output, return default return type
- if (count($argumentType->getConstantStrings()) === 0) {
- return TypeCombinator::union(
- $objectsReturnType,
- $namesReturnType
- );
- }
-
- // Called with a string $output
- $returnType = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'objects':
- $returnType[] = $objectsReturnType;
- break;
- case 'names':
- default:
- $returnType[] = $namesReturnType;
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/GetTermsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/GetTermsDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 6896eae..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/GetTermsDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,169 +0,0 @@
- 0,
- 'get_terms' => 0,
- 'wp_get_object_terms' => 2,
- 'wp_get_post_categories' => 1,
- 'wp_get_post_tags' => 1,
- 'wp_get_post_terms' => 2,
- ];
-
- public function isFunctionSupported(FunctionReflection $functionReflection): bool
- {
- return array_key_exists($functionReflection->getName(), self::SUPPORTED_FUNCTIONS);
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/get_tags/
- * @see https://developer.wordpress.org/reference/functions/get_terms/
- * @see https://developer.wordpress.org/reference/functions/wp_get_object_terms/
- * @see https://developer.wordpress.org/reference/functions/wp_get_post_categories/
- * @see https://developer.wordpress.org/reference/functions/wp_get_post_tags/
- * @see https://developer.wordpress.org/reference/functions/wp_get_post_terms/
- *
- * phpcs:ignore NeutronStandard.Functions.LongFunction.LongFunction
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $name = $functionReflection->getName();
- $argsParameterPosition = self::SUPPORTED_FUNCTIONS[$name] ?? null;
-
- if ($argsParameterPosition === null) {
- throw new \PHPStan\ShouldNotHappenException(
- sprintf('Could not detect parameter position for function %s()', $name)
- );
- }
-
- // Called without arguments
- if (! isset($functionCall->getArgs()[$argsParameterPosition])) {
- return self::termsType();
- }
-
- $argument = $scope->getType($functionCall->getArgs()[$argsParameterPosition]->value);
- $returnTypes = [];
-
- if ($argument->isConstantArray()->no()) {
- return self::defaultType();
- }
- if ($argument->isConstantArray()->maybe()) {
- $returnTypes[] = self::defaultType();
- }
-
- foreach ($argument->getConstantArrays() as $args) {
- if ($args->hasOffsetValueType(new ConstantStringType('fields'))->no()) {
- $returnTypes[] = self::termsType();
- continue;
- }
- if ($args->hasOffsetValueType(new ConstantStringType('fields'))->maybe()) {
- $returnTypes[] = self::defaultType();
- continue;
- }
-
- $fieldsValueTypes = $args->getOffsetValueType(new ConstantStringType('fields'))->getConstantStrings();
- if (count($fieldsValueTypes) === 0) {
- $returnTypes[] = self::defaultType();
- continue;
- }
- foreach ($fieldsValueTypes as $fieldsValueType) {
- $returnTypes[] = self::deduceTypeFromFields($fieldsValueType->getValue());
- }
- }
- return TypeCombinator::union(...$returnTypes);
- }
-
- protected static function deduceTypeFromFields(string $fields): Type
- {
- switch ($fields) {
- case 'count':
- return self::countType();
- case 'names':
- case 'slugs':
- case 'id=>name':
- case 'id=>slug':
- return self::slugsType();
- case 'ids':
- case 'tt_ids':
- return self::idsType();
- case 'id=>parent':
- return self::parentsType();
- case 'all':
- case 'all_with_object_id':
- default:
- return self::termsType();
- }
- }
-
- protected static function countType(): Type
- {
- return TypeCombinator::union(
- new StringType(),
- new ObjectType(\WP_Error::class)
- );
- }
-
- protected static function slugsType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new StringType()),
- new ObjectType(\WP_Error::class)
- );
- }
-
- protected static function idsType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new IntegerType()),
- new ObjectType(\WP_Error::class)
- );
- }
-
- protected static function parentsType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new AccessoryNumericStringType()),
- new ObjectType(\WP_Error::class)
- );
- }
-
- protected static function termsType(): Type
- {
- return TypeCombinator::union(
- new ArrayType(new IntegerType(), new ObjectType(WP_Term::class)),
- new ObjectType(\WP_Error::class)
- );
- }
-
- protected static function defaultType(): Type
- {
- return TypeCombinator::union(
- self::termsType(),
- self::idsType(),
- self::slugsType(),
- self::countType()
- );
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/HasFilterDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/HasFilterDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 8c78882..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/HasFilterDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,60 +0,0 @@
-getName(),
- [
- 'has_filter',
- 'has_action',
- ],
- true
- );
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/has_action/
- * @see https://developer.wordpress.org/reference/functions/has_filter/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
- $callbackArgumentType = new ConstantBooleanType(false);
-
- if (isset($args[1])) {
- $callbackArgumentType = $scope->getType($args[1]->value);
- }
-
- if ($callbackArgumentType->isFalse()->yes()) {
- return new BooleanType();
- }
-
- $returnType = [new ConstantBooleanType(false), new IntegerType()];
- if ($callbackArgumentType->isFalse()->maybe()) {
- $returnType[] = new BooleanType();
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/HookCallbackRule.php b/vendor/szepeviktor/phpstan-wordpress/src/HookCallbackRule.php
index 3f168f6..270894a 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/HookCallbackRule.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/HookCallbackRule.php
@@ -14,6 +14,7 @@
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ParametersAcceptor;
use PHPStan\Reflection\ParametersAcceptorSelector;
+use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Rules\RuleErrorBuilder;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\MixedType;
@@ -26,6 +27,8 @@
*/
class HookCallbackRule implements \PHPStan\Rules\Rule
{
+ use NormalizedArguments;
+
private const SUPPORTED_FUNCTIONS = [
'add_filter',
'add_action',
@@ -38,10 +41,16 @@ class HookCallbackRule implements \PHPStan\Rules\Rule
private const ACCEPTED_ARGS_DEFAULT = 1;
/** @var list<\PHPStan\Rules\IdentifierRuleError> */
- private $errors;
+ private array $errors;
+
+ protected Scope $currentScope;
+
+ private ReflectionProvider $reflectionProvider;
- /** @var \PHPStan\Analyser\Scope */
- protected $currentScope;
+ public function __construct(ReflectionProvider $reflectionProvider)
+ {
+ $this->reflectionProvider = $reflectionProvider;
+ }
public function getNodeType(): string
{
@@ -53,18 +62,24 @@ public function processNode(Node $node, Scope $scope): array
$this->currentScope = $scope;
$this->errors = [];
- if (! ($node->name instanceof \PhpParser\Node\Name)) {
+ if (! ($node->name instanceof Node\Name)) {
return [];
}
- if (! in_array($node->name->toString(), self::SUPPORTED_FUNCTIONS, true)) {
+ if (! $this->reflectionProvider->hasFunction($node->name, $scope)) {
+ return [];
+ }
+
+ $functionReflection = $this->reflectionProvider->getFunction($node->name, $scope);
+
+ if (! in_array($functionReflection->getName(), self::SUPPORTED_FUNCTIONS, true)) {
return [];
}
- $args = $node->getArgs();
+ $args = $this->getNormalizedFunctionArgs($functionReflection, $node, $scope);
// If we don't have enough arguments, let PHPStan handle the error:
- if (count($args) < self::CALLBACK_INDEX + 1) {
+ if ($args === null || count($args) < self::CALLBACK_INDEX + 1) {
return [];
}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/HookDocBlock.php b/vendor/szepeviktor/phpstan-wordpress/src/HookDocBlock.php
index eacd765..e36acb5 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/HookDocBlock.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/HookDocBlock.php
@@ -15,8 +15,7 @@
class HookDocBlock
{
- /** @var \PHPStan\Type\FileTypeMapper */
- protected $fileTypeMapper;
+ protected FileTypeMapper $fileTypeMapper;
public function __construct(FileTypeMapper $fileTypeMapper)
{
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/HookDocsRule.php b/vendor/szepeviktor/phpstan-wordpress/src/HookDocsRule.php
index 97bb27d..3c2f621 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/HookDocsRule.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/HookDocsRule.php
@@ -18,7 +18,6 @@
use PHPStan\PhpDoc\Tag\ParamTag;
use PHPStan\Rules\RuleErrorBuilder;
use PHPStan\Rules\RuleLevelHelper;
-use PHPStan\Type\FileTypeMapper;
use PHPStan\Type\VerbosityLevel;
/**
@@ -31,26 +30,22 @@ class HookDocsRule implements \PHPStan\Rules\Rule
'do_action',
];
- /** @var \SzepeViktor\PHPStan\WordPress\HookDocBlock */
- protected $hookDocBlock;
+ protected HookDocBlock $hookDocBlock;
- /** @var \PHPStan\Rules\RuleLevelHelper */
- protected $ruleLevelHelper;
+ protected RuleLevelHelper $ruleLevelHelper;
- /** @var \PhpParser\Node\Expr\FuncCall */
- protected $currentNode;
+ protected FuncCall $currentNode;
- /** @var \PHPStan\Analyser\Scope */
- protected $currentScope;
+ protected Scope $currentScope;
/** @var list<\PHPStan\Rules\IdentifierRuleError> */
- private $errors;
+ private array $errors;
public function __construct(
- FileTypeMapper $fileTypeMapper,
+ HookDocBlock $hookDocBlock,
RuleLevelHelper $ruleLevelHelper
) {
- $this->hookDocBlock = new HookDocBlock($fileTypeMapper);
+ $this->hookDocBlock = $hookDocBlock;
$this->ruleLevelHelper = $ruleLevelHelper;
}
@@ -199,7 +194,7 @@ protected function validateSingleParamTag(string $paramName, ParamTag $paramTag,
$this->currentScope->isDeclareStrictTypes()
);
- if ($accepted) {
+ if ($accepted->result) {
return;
}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/HookDocsVisitor.php b/vendor/szepeviktor/phpstan-wordpress/src/HookDocsVisitor.php
index 7465361..213823a 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/HookDocsVisitor.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/HookDocsVisitor.php
@@ -8,15 +8,14 @@
namespace SzepeViktor\PHPStan\WordPress;
+use PhpParser\Comment\Doc;
use PhpParser\Node;
final class HookDocsVisitor extends \PhpParser\NodeVisitorAbstract
{
- /** @var int|null */
- protected $latestStartLine = null;
+ protected ?int $latestStartLine;
- /** @var \PhpParser\Comment\Doc|null */
- protected $latestDocComment = null;
+ protected ?Doc $latestDocComment;
// phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
public function beforeTraverse(array $nodes): ?array
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorFunctionTypeSpecifyingExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorFunctionTypeSpecifyingExtension.php
deleted file mode 100644
index d5cf2bd..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorFunctionTypeSpecifyingExtension.php
+++ /dev/null
@@ -1,47 +0,0 @@
-getName()) === 'is_wp_error'
- && isset($node->args[0])
- && ! $context->null();
- }
-
- // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
- public function specifyTypes(FunctionReflection $functionReflection, FuncCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
- {
- if ($context->null()) {
- throw new \PHPStan\ShouldNotHappenException();
- }
-
- $args = $node->getArgs();
-
- return $this->typeSpecifier->create($args[0]->value, new ObjectType(\WP_Error::class), $context);
- }
-
- public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
- {
- $this->typeSpecifier = $typeSpecifier;
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorRule.php b/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorRule.php
deleted file mode 100644
index 4019b8e..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/IsWpErrorRule.php
+++ /dev/null
@@ -1,86 +0,0 @@
-
- */
-class IsWpErrorRule implements \PHPStan\Rules\Rule
-{
- /** @var \PHPStan\Rules\RuleLevelHelper */
- protected $ruleLevelHelper;
-
- public function __construct(
- RuleLevelHelper $ruleLevelHelper
- ) {
- $this->ruleLevelHelper = $ruleLevelHelper;
- }
-
- public function getNodeType(): string
- {
- return FuncCall::class;
- }
-
- public function processNode(Node $node, Scope $scope): array
- {
- if (! ($node->name instanceof Name)) {
- return [];
- }
-
- if ($node->name->toString() !== 'is_wp_error') {
- return [];
- }
-
- $args = $node->getArgs();
-
- if (count($args) === 0) {
- return [];
- }
-
- $argumentType = $scope->getType($args[0]->value);
-
- $accepted = $this->ruleLevelHelper->accepts(
- $argumentType,
- new ObjectType(\WP_Error::class),
- $scope->isDeclareStrictTypes()
- );
-
- if (! $accepted) {
- return [
- RuleErrorBuilder::message(
- sprintf(
- 'is_wp_error(%s) will always evaluate to false.',
- $argumentType->describe(VerbosityLevel::typeOnly())
- )
- )->identifier('function.impossibleType')->build(),
- ];
- }
-
- if ((new ObjectType(\WP_Error::class))->isSuperTypeOf($argumentType)->yes()) {
- return [
- RuleErrorBuilder::message(
- 'is_wp_error(WP_Error) will always evaluate to true.'
- )->identifier('function.alreadyNarrowedType')->build(),
- ];
- }
-
- return [];
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/MySQL2DateDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/MySQL2DateDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index eb51e87..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/MySQL2DateDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,57 +0,0 @@
-getName() === 'mysql2date';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/mysql2date/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
- {
- $argumentType = $scope->getType($functionCall->getArgs()[0]->value);
-
- // When called with a $format that isn't a constant string, return default return type
- if (count($argumentType->getConstantStrings()) === 0) {
- return null;
- }
-
- // Called with a constant string $format
- $returnType = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- switch ($constantString->getValue()) {
- case 'G':
- case 'U':
- $returnType[] = new UnionType([new ConstantBooleanType(false), new IntegerType()]);
- break;
- default:
- $returnType[] = new UnionType([new ConstantBooleanType(false), new StringType()]);
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/NormalizeWhitespaceDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/NormalizeWhitespaceDynamicFunctionReturnTypeExtension.php
new file mode 100644
index 0000000..edd9c9a
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/NormalizeWhitespaceDynamicFunctionReturnTypeExtension.php
@@ -0,0 +1,113 @@
+getName() === 'normalize_whitespace';
+ }
+
+ /**
+ * @see https://developer.wordpress.org/reference/functions/normalize_whitespace/
+ *
+ * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
+ */
+ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
+ {
+ if (count($functionCall->getArgs()) < 1) {
+ return null;
+ }
+
+ $argType = $scope->getType($functionCall->getArgs()[0]->value);
+ if (! $scope->isDeclareStrictTypes()) {
+ $argType = $argType->toString();
+ }
+
+ if (! $argType->isString()->yes()) {
+ return null;
+ }
+
+ $argTypes = $argType instanceof UnionType ? $argType->getTypes() : [$argType];
+
+ $types = [];
+ foreach ($argTypes as $type) {
+ if ($type->isConstantValue()->yes()) {
+ $types[] = $this->getTypeFromConstantString($type->getConstantStrings()[0]);
+ continue;
+ }
+
+ if ($type->isNonFalsyString()->yes()) {
+ $types[] = $this->getTypeFromNonFalsyString($type);
+ continue;
+ }
+
+ if ($type->isNonEmptyString()->yes()) {
+ $types[] = $this->getTypeFromNonEmptyString($type);
+ continue;
+ }
+
+ $types[] = $type;
+ }
+
+ return TypeCombinator::union(...$types);
+ }
+
+ private function getTypeFromConstantString(ConstantStringType $type): Type
+ {
+ $typeValue = $type->getValue();
+ $type = new ConstantStringType(trim($typeValue));
+
+ if ($type->isNonEmptyString()->no() || $type->isNonFalsyString()->no()) {
+ return $type;
+ }
+
+ return $type->generalize(GeneralizePrecision::moreSpecific());
+ }
+
+ private function getTypeFromNonFalsyString(Type $type): Type
+ {
+ $types = array_merge(
+ [new StringType(), new AccessoryNonEmptyStringType()],
+ array_filter(
+ TypeUtils::getAccessoryTypes($type),
+ static function (AccessoryType $accessoryType): bool {
+ return ! $accessoryType->isNonFalsyString()->yes();
+ }
+ )
+ );
+
+ return TypeCombinator::intersect(...$types);
+ }
+
+ private function getTypeFromNonEmptyString(Type $type): Type
+ {
+ $types = array_merge(
+ [new StringType()],
+ array_filter(
+ TypeUtils::getAccessoryTypes($type),
+ static function (AccessoryType $accessoryType): bool {
+ return ! $accessoryType->isNonEmptyString()->yes();
+ }
+ )
+ );
+
+ return TypeCombinator::intersect(...$types);
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/NormalizedArguments.php b/vendor/szepeviktor/phpstan-wordpress/src/NormalizedArguments.php
new file mode 100644
index 0000000..3ce0a25
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/NormalizedArguments.php
@@ -0,0 +1,41 @@
+ $args
+ */
+ private function getNormalizedFunctionArgs(
+ FunctionReflection $functionReflection,
+ FuncCall $functionCall,
+ Scope $scope
+ ): ?array {
+ $parametersAcceptor = ParametersAcceptorSelector::selectFromArgs(
+ $scope,
+ $functionCall->getArgs(),
+ $functionReflection->getVariants(),
+ $functionReflection->getNamedArgumentsVariants(),
+ );
+
+ $normalizedFunctionCall = ArgumentsNormalizer::reorderFuncArguments(
+ $parametersAcceptor,
+ $functionCall
+ );
+
+ if ($normalizedFunctionCall === null) {
+ return null;
+ }
+
+ return $normalizedFunctionCall->getArgs();
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/RedirectCanonicalDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/RedirectCanonicalDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 7cf44b4..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/RedirectCanonicalDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,35 +0,0 @@
-getName() === 'redirect_canonical';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/redirect_canonical/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- return TypeCombinator::union(new StringType(), new NullType());
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/ShortcodeAttsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/ShortcodeAttsDynamicFunctionReturnTypeExtension.php
index 634574f..a4506ab 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/ShortcodeAttsDynamicFunctionReturnTypeExtension.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/ShortcodeAttsDynamicFunctionReturnTypeExtension.php
@@ -11,7 +11,10 @@
use PhpParser\Node\Expr\FuncCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
+use PHPStan\Type\Accessory\NonEmptyArrayType;
+use PHPStan\Type\ArrayType;
use PHPStan\Type\Constant\ConstantArrayType;
+use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
@@ -31,20 +34,49 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
{
$args = $functionCall->getArgs();
- if ($args === []) {
+
+ if (count($args) < 2) {
return null;
}
- $type = $scope->getType($args[0]->value);
+ $pairsType = $scope->getType($args[0]->value);
+ $attsType = $scope->getType($args[1]->value);
+
+ if ($attsType->isIterableAtLeastOnce()->no()) {
+ return $pairsType;
+ }
+
+ if (! $this->hasConstantArrays($pairsType)) {
+ return $this->resolveTypeForNonConstantPairs($pairsType);
+ }
- if (count($type->getConstantArrays()) === 0) {
- return $type;
+ if (! $this->hasConstantArrays($attsType)) {
+ return $this->resolveTypeForNonConstantAtts($pairsType);
}
- $returnType = [];
- foreach ($type->getConstantArrays() as $constantArray) {
- // shortcode_atts values are coming from the defined defaults or from the actual string shortcode attributes
- $returnType[] = new ConstantArrayType(
+ return $this->resolveTypeForConstantAtts($pairsType, $attsType);
+ }
+
+ protected function resolveTypeForNonConstantPairs(Type $pairsType): Type
+ {
+ $keyType = $pairsType->getIterableKeyType();
+ $valueType = TypeCombinator::union(
+ $pairsType->getIterableValueType(),
+ new StringType()
+ );
+ $arrayType = new ArrayType($keyType, $valueType);
+
+ return $pairsType->isIterableAtLeastOnce()->yes()
+ ? TypeCombinator::intersect($arrayType, new NonEmptyArrayType())
+ : $arrayType;
+ }
+
+ protected function resolveTypeForNonConstantAtts(Type $pairsType): Type
+ {
+ $types = [];
+
+ foreach ($pairsType->getConstantArrays() as $constantArray) {
+ $types[] = new ConstantArrayType(
$constantArray->getKeyTypes(),
array_map(
static function (Type $valueType): Type {
@@ -55,6 +87,52 @@ static function (Type $valueType): Type {
);
}
- return TypeCombinator::union(...$returnType);
+ return TypeCombinator::union(...$types);
+ }
+
+ protected function resolveTypeForConstantAtts(Type $pairsType, Type $attsType): Type
+ {
+ $types = [];
+
+ foreach ($pairsType->getConstantArrays() as $constantPairsArray) {
+ foreach ($attsType->getConstantArrays() as $constantAttsArray) {
+ $types[] = $this->mergeArrays($constantPairsArray, $constantAttsArray);
+ }
+ }
+
+ return TypeCombinator::union(...$types);
+ }
+
+ protected function mergeArrays(ConstantArrayType $pairsArray, ConstantArrayType $attsArray): Type
+ {
+ if (count($attsArray->getKeyTypes()) === 0) {
+ return $pairsArray;
+ }
+
+ $builder = ConstantArrayTypeBuilder::createFromConstantArray($pairsArray);
+
+ foreach ($pairsArray->getKeyTypes() as $keyType) {
+ $hasOffsetValueType = $attsArray->hasOffsetValueType($keyType);
+
+ if ($hasOffsetValueType->no()) {
+ continue;
+ }
+
+ $valueType = $hasOffsetValueType->yes()
+ ? $attsArray->getOffsetValueType($keyType)
+ : TypeCombinator::union(
+ $pairsArray->getOffsetValueType($keyType),
+ $attsArray->getOffsetValueType($keyType)
+ );
+
+ $builder->setOffsetValueType($keyType, $valueType);
+ }
+
+ return $builder->getArray();
+ }
+
+ protected function hasConstantArrays(Type $type): bool
+ {
+ return count($type->getConstantArrays()) > 0;
}
}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/SlashitFunctionsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/SlashitFunctionsDynamicFunctionReturnTypeExtension.php
new file mode 100644
index 0000000..3c51687
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/SlashitFunctionsDynamicFunctionReturnTypeExtension.php
@@ -0,0 +1,97 @@
+getName(),
+ [
+ 'backslashit',
+ 'trailingslashit',
+ 'untrailingslashit',
+ ],
+ true
+ );
+ }
+
+ /**
+ * @see https://developer.wordpress.org/reference/functions/backslashit/
+ * @see https://developer.wordpress.org/reference/functions/trailingslashit/
+ * @see https://developer.wordpress.org/reference/functions/untrailingslashit/
+ */
+ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
+ {
+ if (count($functionCall->getArgs()) === 0) {
+ return null;
+ }
+
+ $argType = $scope->isDeclareStrictTypes()
+ ? $scope->getType($functionCall->getArgs()[0]->value)
+ : $scope->getType($functionCall->getArgs()[0]->value)->toString();
+
+ if (! $argType->isString()->yes()) {
+ return null;
+ }
+
+ $functionName = $functionReflection->getName();
+
+ if (strpos($functionName, 'trailingslashit') !== false) {
+ $type = $scope->getType(new FuncCall(new FullyQualified('rtrim'), [$functionCall->getArgs()[0], new Arg(new String_('/\\'))]));
+
+ if ($functionName === 'untrailingslashit') {
+ return $type;
+ }
+
+ return $scope->getType(new Concat(new TypeExpr($type), new String_('/')));
+ }
+
+ if (! ($functionName === 'backslashit')) {
+ return null;
+ }
+
+ return TypeTraverser::map(
+ $argType,
+ static function (Type $type, callable $traverse): Type {
+ if ($type instanceof UnionType || $type instanceof IntersectionType) {
+ return $traverse($type);
+ }
+
+ if ($type instanceof ConstantStringType) {
+ if ($type->getValue() === '') {
+ return $type;
+ }
+ return $traverse($type->generalize(GeneralizePrecision::moreSpecific()));
+ }
+
+ if ($type->isNumericString()->or($type->isNonEmptyString())->yes()) {
+ return new AccessoryNonFalsyStringType();
+ }
+
+ return $type;
+ }
+ );
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/StripslashesFromStringsOnlyDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/StripslashesFromStringsOnlyDynamicFunctionReturnTypeExtension.php
new file mode 100644
index 0000000..8be0360
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/StripslashesFromStringsOnlyDynamicFunctionReturnTypeExtension.php
@@ -0,0 +1,60 @@
+getName() === 'stripslashes_from_strings_only';
+ }
+
+ /**
+ * @see https://developer.wordpress.org/reference/functions/stripslashes_from_strings_only/
+ */
+ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
+ {
+ if (count($functionCall->getArgs()) === 0) {
+ return null;
+ }
+
+ $argType = $scope->getType($functionCall->getArgs()[0]->value);
+
+ return TypeTraverser::map(
+ $argType,
+ static function (Type $type, callable $traverse) use ($scope): Type {
+ if ($type instanceof UnionType) {
+ return $traverse($type);
+ }
+
+ if (! $type->isString()->yes()) {
+ return $type;
+ }
+
+ if ($type instanceof ConstantStringType) {
+ return new ConstantStringType(stripslashes($type->getValue()));
+ }
+
+ return $scope->getType(
+ new FuncCall(
+ new FullyQualified('stripslashes'),
+ [new Arg(new TypeExpr($type))]
+ )
+ );
+ }
+ );
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/TermExistsDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/TermExistsDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index f1ebd25..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/TermExistsDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,95 +0,0 @@
-getName(),
- [
- 'is_term',
- 'tag_exists',
- 'term_exists',
- ],
- true
- );
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/is_term/
- * @see https://developer.wordpress.org/reference/functions/tag_exists/
- * @see https://developer.wordpress.org/reference/functions/term_exists/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
-
- if (count($args) === 0) {
- return new MixedType();
- }
-
- $termType = $scope->getType($args[0]->value);
- if ($termType->isNull()->yes()) {
- return $termType;
- }
-
- $returnType = [new NullType()];
-
- if (($termType instanceof ConstantIntegerType)) {
- if ($termType->getValue() === 0) {
- return new ConstantIntegerType(0);
- }
- } elseif ($termType->isInteger()->no() === false) {
- $returnType[] = new ConstantIntegerType(0);
- }
-
- $withTaxonomy = new ConstantArrayType(
- [
- new ConstantStringType('term_id'),
- new ConstantStringType('term_taxonomy_id'),
- ],
- [
- new StringType(),
- new StringType(),
- ]
- );
- $withoutTaxonomy = new StringType();
-
- $taxonomyType = isset($args[1]) ? $scope->getType($args[1]->value) : new ConstantStringType('');
-
- if (count($taxonomyType->getConstantStrings()) === 0) {
- $returnType[] = $withTaxonomy;
- $returnType[] = $withoutTaxonomy;
- return TypeCombinator::union(...$returnType);
- }
-
- foreach ($taxonomyType->getConstantStrings() as $constantString) {
- $returnType[] = $constantString->getValue() === ''
- ? $withoutTaxonomy
- : $withTaxonomy;
- }
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpConstantFetchRule.php b/vendor/szepeviktor/phpstan-wordpress/src/WpConstantFetchRule.php
new file mode 100644
index 0000000..c62d63f
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/WpConstantFetchRule.php
@@ -0,0 +1,91 @@
+
+ */
+final class WpConstantFetchRule implements \PHPStan\Rules\Rule
+{
+ protected const REPLACEMENTS = [
+ 'BACKGROUND_COLOR' => "get_theme_support('custom-background')",
+ 'BACKGROUND_IMAGE' => "get_theme_support('custom-background')",
+ 'DISALLOW_FILE_MODS' => 'wp_is_file_mod_allowed()',
+ 'DOING_AJAX' => 'wp_doing_ajax()',
+ 'DOING_CRON' => 'wp_doing_cron()',
+ 'FORCE_SSL_ADMIN' => 'force_ssl_admin()',
+ 'FORCE_SSL_LOGIN' => 'force_ssl_admin()',
+ 'FS_METHOD' => 'get_filesystem_method()',
+ 'HEADER_IMAGE' => "get_theme_support('custom-header')",
+ 'HEADER_IMAGE_WIDTH' => "get_theme_support('custom-header')",
+ 'HEADER_IMAGE_HEIGHT' => "get_theme_support('custom-header')",
+ 'HEADER_TEXTCOLOR' => "get_theme_support('custom-header')",
+ 'MULTISITE' => 'is_multisite()',
+ 'NO_HEADER_TEXT' => "get_theme_support('custom-header')",
+ 'STYLESHEETPATH' => 'get_stylesheet_directory()',
+ 'SUBDOMAIN_INSTALL' => 'is_subdomain_install()',
+ 'TEMPLATEPATH' => 'get_template_directory()',
+ 'UPLOADS' => 'wp_get_upload_dir() or wp_upload_dir(null, false)',
+ 'VHOST' => 'is_subdomain_install()',
+ 'WP_ADMIN' => 'is_admin()',
+ 'WP_BLOG_ADMIN' => 'is_blog_admin()',
+ 'WP_CONTENT_URL' => 'content_url()',
+ 'WP_DEVELOPMENT_MODE' => 'wp_get_development_mode()',
+ 'WP_HOME' => 'home_url() or get_home_url()',
+ 'WP_INSTALLING' => 'wp_installing()',
+ 'WP_NETWORK_ADMIN' => 'is_network_admin()',
+ 'WP_PLUGIN_URL' => "plugins_url() or plugin_dir_url('')",
+ 'WP_POST_REVISIONS' => 'wp_revisions_to_keep()',
+ 'WP_SITEURL' => 'site_url() or get_site_url()',
+ 'WP_USER_ADMIN' => 'is_user_admin()',
+ 'WP_USE_THEMES' => 'wp_using_themes()',
+ 'WPMU_PLUGIN_URL' => 'plugins_url()',
+ ];
+
+ public function getNodeType(): string
+ {
+ return Node\Expr\ConstFetch::class;
+ }
+
+ public function processNode(Node $node, Scope $scope): array
+ {
+ if (! $this->isDiscouragedConstant($node->name)) {
+ return [];
+ }
+
+ return [
+ RuleErrorBuilder::message(
+ sprintf(
+ 'Found usage of constant %s. Use %s instead.',
+ (string)$node->name,
+ $this->getReplacement($node->name)
+ )
+ )
+ ->identifier('phpstanWP.wpConstant.fetch')
+ ->build(),
+ ];
+ }
+
+ private function isDiscouragedConstant(Node\Name $constantName): bool
+ {
+ return array_key_exists((string)$constantName, self::REPLACEMENTS);
+ }
+
+ private function getReplacement(Node\Name $constantName): string
+ {
+ return self::REPLACEMENTS[(string)$constantName];
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpDieDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpDieDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index ca8d567..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/WpDieDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,57 +0,0 @@
-getName() === 'wp_die';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/wp_die/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $args = $functionCall->getArgs();
-
- // Called without $args parameter
- if (count($args) < 3) {
- return new NonAcceptingNeverType();
- }
-
- $argType = $scope->getType($args[2]->value);
-
- // Return void for non constant arrays.
- if (! $argType->isConstantArray()->yes()) {
- return new VoidType();
- }
-
- // Return never if the key 'exit' is not set.
- if (! $argType->hasOffsetValueType(new ConstantStringType('exit'))->yes()) {
- return new NonAcceptingNeverType();
- }
-
- // Note WP's wp_die handlers do lazy comparison
- return $argType->getOffsetValueType(new ConstantStringType('exit'))->toBoolean()->isTrue()->yes()
- ? new NonAcceptingNeverType()
- : new VoidType();
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpErrorParameterDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpErrorParameterDynamicFunctionReturnTypeExtension.php
deleted file mode 100644
index 399f8b0..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/WpErrorParameterDynamicFunctionReturnTypeExtension.php
+++ /dev/null
@@ -1,169 +0,0 @@
- [
- 'arg' => 1,
- 'false' => '0|positive-int',
- 'true' => 'positive-int|WP_Error',
- 'maybe' => '0|positive-int|WP_Error',
- ],
- 'wp_insert_category' => [
- 'arg' => 1,
- 'false' => '0|positive-int',
- 'true' => 'positive-int|WP_Error',
- 'maybe' => '0|positive-int|WP_Error',
- ],
- 'wp_set_comment_status' => [
- 'arg' => 2,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_update_comment' => [
- 'arg' => 1,
- 'false' => '0|1|false',
- 'true' => '0|1|WP_Error',
- 'maybe' => '0|1|false|WP_Error',
- ],
- 'wp_schedule_single_event' => [
- 'arg' => 3,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_schedule_event' => [
- 'arg' => 4,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_reschedule_event' => [
- 'arg' => 4,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_unschedule_event' => [
- 'arg' => 3,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_clear_scheduled_hook' => [
- 'arg' => 2,
- 'false' => '0|positive-int|false',
- 'true' => '0|positive-int|WP_Error',
- 'maybe' => '0|positive-int|false|WP_Error',
- ],
- 'wp_unschedule_hook' => [
- 'arg' => 1,
- 'false' => '0|positive-int|false',
- 'true' => '0|positive-int|WP_Error',
- 'maybe' => '0|positive-int|false|WP_Error',
- ],
- '_set_cron_array' => [
- 'arg' => 1,
- 'false' => 'bool',
- 'true' => 'true|WP_Error',
- 'maybe' => 'bool|WP_Error',
- ],
- 'wp_insert_post' => [
- 'arg' => 1,
- 'false' => '0|positive-int',
- 'true' => 'positive-int|WP_Error',
- 'maybe' => '0|positive-int|WP_Error',
- ],
- 'wp_update_post' => [
- 'arg' => 1,
- 'false' => '0|positive-int',
- 'true' => 'positive-int|WP_Error',
- 'maybe' => '0|positive-int|WP_Error',
- ],
- 'wp_insert_attachment' => [
- 'arg' => 3,
- 'false' => '0|positive-int',
- 'true' => 'positive-int|WP_Error',
- 'maybe' => '0|positive-int|WP_Error',
- ],
- ];
-
- /** @var \PHPStan\PhpDoc\TypeStringResolver */
- protected $typeStringResolver;
-
- public function __construct(TypeStringResolver $typeStringResolver)
- {
- $this->typeStringResolver = $typeStringResolver;
- }
-
- public function isFunctionSupported(FunctionReflection $functionReflection): bool
- {
- return array_key_exists($functionReflection->getName(), self::SUPPORTED_FUNCTIONS);
- }
-
- /**
- * @see https://developer.wordpress.org/reference/functions/wp_insert_link/
- * @see https://developer.wordpress.org/reference/functions/wp_insert_category/
- * @see https://developer.wordpress.org/reference/functions/wp_set_comment_status/
- * @see https://developer.wordpress.org/reference/functions/wp_update_comment/
- * @see https://developer.wordpress.org/reference/functions/wp_schedule_single_event/
- * @see https://developer.wordpress.org/reference/functions/wp_schedule_event/
- * @see https://developer.wordpress.org/reference/functions/wp_reschedule_event/
- * @see https://developer.wordpress.org/reference/functions/wp_unschedule_event/
- * @see https://developer.wordpress.org/reference/functions/wp_clear_scheduled_hook/
- * @see https://developer.wordpress.org/reference/functions/wp_unschedule_hook/
- * @see https://developer.wordpress.org/reference/functions/_set_cron_array/
- * @see https://developer.wordpress.org/reference/functions/wp_insert_post/
- * @see https://developer.wordpress.org/reference/functions/wp_update_post/
- * @see https://developer.wordpress.org/reference/functions/wp_insert_attachment/
- */
- public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
- {
- $name = $functionReflection->getName();
- $functionTypes = self::SUPPORTED_FUNCTIONS[$name] ?? null;
- $args = $functionCall->getArgs();
-
- if ($functionTypes === null) {
- throw new \PHPStan\ShouldNotHappenException(
- sprintf(
- 'Could not detect return types for function %s()',
- $name
- )
- );
- }
-
- $wpErrorArgumentType = new ConstantBooleanType(false);
- $wpErrorArgument = $args[$functionTypes['arg']] ?? null;
-
- if ($wpErrorArgument !== null) {
- $wpErrorArgumentType = $scope->getType($wpErrorArgument->value);
- }
-
- // When called with a $wp_error parameter that isn't a constant boolean, return default type
- $type = $functionTypes['maybe'];
-
- if ($wpErrorArgumentType->isTrue()->yes()) {
- $type = $functionTypes['true'];
- } elseif ($wpErrorArgumentType->isFalse()->yes()) {
- $type = $functionTypes['false'];
- }
-
- return $this->typeStringResolver->resolve($type);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpParseUrlFunctionDynamicReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpParseUrlFunctionDynamicReturnTypeExtension.php
index b998b9a..deac1e3 100644
--- a/vendor/szepeviktor/phpstan-wordpress/src/WpParseUrlFunctionDynamicReturnTypeExtension.php
+++ b/vendor/szepeviktor/phpstan-wordpress/src/WpParseUrlFunctionDynamicReturnTypeExtension.php
@@ -40,13 +40,12 @@
final class WpParseUrlFunctionDynamicReturnTypeExtension implements \PHPStan\Type\DynamicFunctionReturnTypeExtension
{
/** @var array|null */
- private $componentTypesPairedConstants = null;
+ private ?array $componentTypesPairedConstants = null;
/** @var array|null */
- private $componentTypesPairedStrings = null;
+ private ?array $componentTypesPairedStrings = null;
- /** @var \PHPStan\Type\Type|null */
- private $allComponentsTogetherType = null;
+ private ?Type $allComponentsTogetherType = null;
public function isFunctionSupported(FunctionReflection $functionReflection): bool
{
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpSlashDynamicFunctionReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpSlashDynamicFunctionReturnTypeExtension.php
new file mode 100644
index 0000000..ed97176
--- /dev/null
+++ b/vendor/szepeviktor/phpstan-wordpress/src/WpSlashDynamicFunctionReturnTypeExtension.php
@@ -0,0 +1,99 @@
+getName(),
+ [
+ 'addslashes_gpc',
+ 'wp_slash',
+ ],
+ true
+ );
+ }
+
+ /**
+ * @see https://developer.wordpress.org/reference/functions/addslashes_gpc/
+ * @see https://developer.wordpress.org/reference/functions/wp_slash/
+ */
+ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
+ {
+ if (count($functionCall->getArgs()) === 0) {
+ return null;
+ }
+
+ $argType = $scope->getType($functionCall->getArgs()[0]->value);
+
+ $accepted = new UnionType(
+ [
+ new StringType(),
+ new ArrayType(new MixedType(), new MixedType()),
+ ]
+ );
+
+ if (! $accepted->isSuperTypeOf($argType)->yes()) {
+ return null;
+ }
+
+ return $this->addSlashes($argType);
+ }
+
+ private function addSlashes(Type $type): Type
+ {
+ return TypeTraverser::map(
+ $type,
+ function (Type $type, callable $traverse): Type {
+ if ($type instanceof UnionType || $type instanceof IntersectionType) {
+ return $traverse($type);
+ }
+
+ if ($type instanceof ConstantStringType) {
+ return new ConstantStringType(addslashes($type->getValue()));
+ }
+
+ if (! $type->isArray()->yes()) {
+ return $type;
+ }
+
+ if (! ($type instanceof ConstantArrayType)) {
+ return new ArrayType(
+ $type->getIterableKeyType(),
+ $this->addSlashes($type->getIterableValueType())
+ );
+ }
+
+ $builder = ConstantArrayTypeBuilder::createEmpty();
+
+ foreach ($type->getKeyTypes() as $index => $keyType) {
+ $builder->setOffsetValueType(
+ $keyType,
+ $this->addSlashes($type->getValueTypes()[$index]),
+ $type->isOptionalKey($index)
+ );
+ }
+
+ return $builder->getArray();
+ }
+ );
+ }
+}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpThemeGetDynamicMethodReturnTypeExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpThemeGetDynamicMethodReturnTypeExtension.php
deleted file mode 100644
index 6fc6976..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/WpThemeGetDynamicMethodReturnTypeExtension.php
+++ /dev/null
@@ -1,85 +0,0 @@
-
- */
- protected static $headers = [
- 'Name',
- 'ThemeURI',
- 'Description',
- 'Author',
- 'AuthorURI',
- 'Version',
- 'Template',
- 'Status',
- 'Tags',
- 'TextDomain',
- 'DomainPath',
- 'RequiresWP',
- 'RequiresPHP',
- ];
-
- public function getClass(): string
- {
- return WP_Theme::class;
- }
-
- public function isMethodSupported(MethodReflection $methodReflection): bool
- {
- return $methodReflection->getName() === 'get';
- }
-
- /**
- * @see https://developer.wordpress.org/reference/classes/wp_theme/get/
- *
- * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
- */
- public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
- {
- $argumentType = $scope->getType($methodCall->getArgs()[0]->value);
-
- if (count($argumentType->getConstantStrings()) === 0) {
- return TypeCombinator::union(
- new StringType(),
- new ArrayType(new IntegerType(), new StringType()),
- new ConstantBooleanType(false)
- );
- }
-
- $returnType = [];
- foreach ($argumentType->getConstantStrings() as $constantString) {
- if ($constantString->getValue() === 'Tags') {
- $returnType[] = new ArrayType(new IntegerType(), new StringType());
- } elseif (in_array($constantString->getValue(), self::$headers, true)) {
- $returnType[] = new StringType();
- } else {
- $returnType[] = new ConstantBooleanType(false);
- }
- }
-
- return TypeCombinator::union(...$returnType);
- }
-}
diff --git a/vendor/szepeviktor/phpstan-wordpress/src/WpThemeMagicPropertiesClassReflectionExtension.php b/vendor/szepeviktor/phpstan-wordpress/src/WpThemeMagicPropertiesClassReflectionExtension.php
deleted file mode 100644
index 09c3e8b..0000000
--- a/vendor/szepeviktor/phpstan-wordpress/src/WpThemeMagicPropertiesClassReflectionExtension.php
+++ /dev/null
@@ -1,37 +0,0 @@
- */
- private $properties = [
- 'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet',
- 'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri',
- ];
-
- public function hasProperty(ClassReflection $classReflection, string $propertyName): bool
- {
- if ($classReflection->getName() !== 'WP_Theme') {
- return false;
- }
- return in_array($propertyName, $this->properties, true);
- }
-
- // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
- public function getProperty(ClassReflection $classReflection, string $propertyName): PropertyReflection
- {
- // @phpstan-ignore-next-line This is not covered by BC.
- return new DummyPropertyReflection();
- }
-}