diff --git a/app/composer.lock b/app/composer.lock index 2f7c1a007..4ea6865fc 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -3448,16 +3448,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.1", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7" + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7", - "reference": "cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7d08f569e582ade182a375c366cbd896eccadd3a", + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a", "shasum": "" }, "require": { @@ -3502,7 +3502,7 @@ "type": "github" } ], - "time": "2025-01-05T16:43:48+00:00" + "time": "2025-01-21T14:54:06+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -3653,12 +3653,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec" + "reference": "fb6b00411f2c212631318ab412b2208632e507ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec", - "reference": "e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fb6b00411f2c212631318ab412b2208632e507ba", + "reference": "fb6b00411f2c212631318ab412b2208632e507ba", "shasum": "" }, "conflict": { @@ -3753,7 +3753,7 @@ "cockpit-hq/cockpit": "<2.7|==2.7", "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<3.1.9", - "codeigniter4/framework": "<4.4.7", + "codeigniter4/framework": "<4.5.8", "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7", @@ -3768,7 +3768,7 @@ "contao/managed-edition": "<=1.5", "corveda/phpsandbox": "<1.3.5", "cosenary/instagram": "<=2.3", - "craftcms/cms": "<4.13.2|>=5,<5.5.2", + "craftcms/cms": "<4.13.8|>=5,<5.5.5", "croogo/croogo": "<4", "cuyz/valinor": "<0.12", "czim/file-handling": "<1.5|>=2,<2.3", @@ -4135,7 +4135,7 @@ "phpmyfaq/phpmyfaq": "<3.2.5|==3.2.5|>=3.2.10,<=4.0.1", "phpoffice/common": "<0.2.9", "phpoffice/phpexcel": "<1.8.1", - "phpoffice/phpspreadsheet": "<=1.29.6|>=2,<=2.1.5|>=2.2,<=2.3.4|>=3,<3.7", + "phpoffice/phpspreadsheet": "<1.29.8|>=2,<2.1.7|>=2.2,<2.3.6|>=3,<3.8", "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", "phpservermon/phpservermon": "<3.6", "phpsysinfo/phpsysinfo": "<3.4.3", @@ -4423,7 +4423,7 @@ "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yab/quarx": "<2.4.5", - "yeswiki/yeswiki": "<=4.4.4", + "yeswiki/yeswiki": "<=4.4.5", "yetiforce/yetiforce-crm": "<6.5", "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", @@ -4514,7 +4514,7 @@ "type": "tidelift" } ], - "time": "2025-01-15T23:05:13+00:00" + "time": "2025-01-21T22:04:49+00:00" }, { "name": "shipmonk/composer-dependency-analyser", @@ -4754,16 +4754,16 @@ }, { "name": "spaze/phpstan-disallowed-calls", - "version": "v4.1.1", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/spaze/phpstan-disallowed-calls.git", - "reference": "3ea4de4944c58f3acfb1de6e991c9907076f7eec" + "reference": "676796f9a9bb31861e11e7a9a20d9a671fe43743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/3ea4de4944c58f3acfb1de6e991c9907076f7eec", - "reference": "3ea4de4944c58f3acfb1de6e991c9907076f7eec", + "url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/676796f9a9bb31861e11e7a9a20d9a671fe43743", + "reference": "676796f9a9bb31861e11e7a9a20d9a671fe43743", "shasum": "" }, "require": { @@ -4809,7 +4809,7 @@ ], "support": { "issues": "https://github.com/spaze/phpstan-disallowed-calls/issues", - "source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v4.1.1" + "source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v4.2.0" }, "funding": [ { @@ -4817,7 +4817,7 @@ "type": "github" } ], - "time": "2025-01-09T21:09:31+00:00" + "time": "2025-01-22T16:21:14+00:00" }, { "name": "spaze/phpstan-disallowed-calls-nette", diff --git a/app/src/Test/TestCaseRunner.php b/app/src/Test/TestCaseRunner.php index ad335ea09..0b8f180d5 100644 --- a/app/src/Test/TestCaseRunner.php +++ b/app/src/Test/TestCaseRunner.php @@ -19,7 +19,7 @@ class TestCaseRunner /** - * @param class-string $test + * @param class-string $test * @return void */ public static function run(string $test): void @@ -53,7 +53,11 @@ public static function run(string $test): void } catch (ReflectionException) { // pass, __construct() does not exist } - (new $test(...$params))->run(); + $testCase = new $test(...$params); + if (!$testCase instanceof TestCase) { + throw new LogicException(sprintf("%s() can only be used to run tests that extend %s", __METHOD__, TestCase::class)); + } + $testCase->run(); } diff --git a/app/vendor/composer/installed.json b/app/vendor/composer/installed.json index d8214a028..eae7c730b 100644 --- a/app/vendor/composer/installed.json +++ b/app/vendor/composer/installed.json @@ -2089,17 +2089,17 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.1", - "version_normalized": "2.1.1.0", + "version": "2.1.2", + "version_normalized": "2.1.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7" + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7", - "reference": "cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7d08f569e582ade182a375c366cbd896eccadd3a", + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a", "shasum": "" }, "require": { @@ -2108,7 +2108,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2025-01-05T16:43:48+00:00", + "time": "2025-01-21T14:54:06+00:00", "bin": [ "phpstan", "phpstan.phar" @@ -2468,12 +2468,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec" + "reference": "fb6b00411f2c212631318ab412b2208632e507ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec", - "reference": "e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fb6b00411f2c212631318ab412b2208632e507ba", + "reference": "fb6b00411f2c212631318ab412b2208632e507ba", "shasum": "" }, "conflict": { @@ -2568,7 +2568,7 @@ "cockpit-hq/cockpit": "<2.7|==2.7", "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<3.1.9", - "codeigniter4/framework": "<4.4.7", + "codeigniter4/framework": "<4.5.8", "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7", @@ -2583,7 +2583,7 @@ "contao/managed-edition": "<=1.5", "corveda/phpsandbox": "<1.3.5", "cosenary/instagram": "<=2.3", - "craftcms/cms": "<4.13.2|>=5,<5.5.2", + "craftcms/cms": "<4.13.8|>=5,<5.5.5", "croogo/croogo": "<4", "cuyz/valinor": "<0.12", "czim/file-handling": "<1.5|>=2,<2.3", @@ -2950,7 +2950,7 @@ "phpmyfaq/phpmyfaq": "<3.2.5|==3.2.5|>=3.2.10,<=4.0.1", "phpoffice/common": "<0.2.9", "phpoffice/phpexcel": "<1.8.1", - "phpoffice/phpspreadsheet": "<=1.29.6|>=2,<=2.1.5|>=2.2,<=2.3.4|>=3,<3.7", + "phpoffice/phpspreadsheet": "<1.29.8|>=2,<2.1.7|>=2.2,<2.3.6|>=3,<3.8", "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", "phpservermon/phpservermon": "<3.6", "phpsysinfo/phpsysinfo": "<3.4.3", @@ -3238,7 +3238,7 @@ "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yab/quarx": "<2.4.5", - "yeswiki/yeswiki": "<=4.4.4", + "yeswiki/yeswiki": "<=4.4.5", "yetiforce/yetiforce-crm": "<6.5", "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", @@ -3293,7 +3293,7 @@ "zfr/zfr-oauth2-server-module": "<0.1.2", "zoujingli/thinkadmin": "<=6.1.53" }, - "time": "2025-01-15T23:05:13+00:00", + "time": "2025-01-21T22:04:49+00:00", "default-branch": true, "type": "metapackage", "notification-url": "https://packagist.org/downloads/", @@ -3921,17 +3921,17 @@ }, { "name": "spaze/phpstan-disallowed-calls", - "version": "v4.1.1", - "version_normalized": "4.1.1.0", + "version": "v4.2.0", + "version_normalized": "4.2.0.0", "source": { "type": "git", "url": "https://github.com/spaze/phpstan-disallowed-calls.git", - "reference": "3ea4de4944c58f3acfb1de6e991c9907076f7eec" + "reference": "676796f9a9bb31861e11e7a9a20d9a671fe43743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/3ea4de4944c58f3acfb1de6e991c9907076f7eec", - "reference": "3ea4de4944c58f3acfb1de6e991c9907076f7eec", + "url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/676796f9a9bb31861e11e7a9a20d9a671fe43743", + "reference": "676796f9a9bb31861e11e7a9a20d9a671fe43743", "shasum": "" }, "require": { @@ -3947,7 +3947,7 @@ "phpunit/phpunit": "^8.5.14 || ^10.1 || ^11.0", "spaze/coding-standard": "^1.7" }, - "time": "2025-01-09T21:09:31+00:00", + "time": "2025-01-22T16:21:14+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -3979,7 +3979,7 @@ ], "support": { "issues": "https://github.com/spaze/phpstan-disallowed-calls/issues", - "source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v4.1.1" + "source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v4.2.0" }, "funding": [ { diff --git a/app/vendor/composer/installed.php b/app/vendor/composer/installed.php index 71cc441df..ca191d1fe 100644 --- a/app/vendor/composer/installed.php +++ b/app/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'spaze/michalspacek.cz', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '8421cabb14aec6c1434c743e4c6b1887c58b931c', + 'reference' => '07f904390f47be8c4f342b68cc1598f22cd86640', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -326,9 +326,9 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '2.1.1', - 'version' => '2.1.1.0', - 'reference' => 'cd6e973e04b4c2b94c86e8612b5a65f0da0e08e7', + 'pretty_version' => '2.1.2', + 'version' => '2.1.2.0', + 'reference' => '7d08f569e582ade182a375c366cbd896eccadd3a', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), @@ -403,7 +403,7 @@ 'roave/security-advisories' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => 'e7a38fcc13e4ddfe9a28d5c7bf50aa9a9da758ec', + 'reference' => 'fb6b00411f2c212631318ab412b2208632e507ba', 'type' => 'metapackage', 'install_path' => null, 'aliases' => array( @@ -468,7 +468,7 @@ 'spaze/michalspacek.cz' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '8421cabb14aec6c1434c743e4c6b1887c58b931c', + 'reference' => '07f904390f47be8c4f342b68cc1598f22cd86640', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -511,9 +511,9 @@ 'dev_requirement' => false, ), 'spaze/phpstan-disallowed-calls' => array( - 'pretty_version' => 'v4.1.1', - 'version' => '4.1.1.0', - 'reference' => '3ea4de4944c58f3acfb1de6e991c9907076f7eec', + 'pretty_version' => 'v4.2.0', + 'version' => '4.2.0.0', + 'reference' => '676796f9a9bb31861e11e7a9a20d9a671fe43743', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../spaze/phpstan-disallowed-calls', 'aliases' => array(), diff --git a/app/vendor/phpstan/phpstan/phpstan.phar b/app/vendor/phpstan/phpstan/phpstan.phar index 293c4441c..6346c6df6 100755 Binary files a/app/vendor/phpstan/phpstan/phpstan.phar and b/app/vendor/phpstan/phpstan/phpstan.phar differ diff --git a/app/vendor/phpstan/phpstan/phpstan.phar.asc b/app/vendor/phpstan/phpstan/phpstan.phar.asc index c645cd748..36440d1ab 100644 --- a/app/vendor/phpstan/phpstan/phpstan.phar.asc +++ b/app/vendor/phpstan/phpstan/phpstan.phar.asc @@ -1,16 +1,16 @@ -----BEGIN PGP SIGNATURE----- -iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmd6tp8ACgkQUcZzBf/C -5cCYSg//eO+kZhjgn2+iXQssspB2QIY36NGKKuxHFi5eQWNhRKFKM6jIIdqmcU2g -aawEQbg6OQMGK1e07LqUOTKPw0fjz2f9YcfxwkC+Q6rDix/8ir5LhO8XfDXdWtvW -424B+6B1OOXeuGPp7HqQqS7EVE6WJXgpvJ/a7xIDAe+FIvCE52qXhjywpaXMGftA -HpnAUIENH9o4888JDeLSn/OfDUip10DN0A5aNZRDZzyooikkWdODStVnPg6WHSxc -Z5at+8voemu7X+LgQ9U9jo04tNlH7SW0I6+j+DUsLl6CTh+cpx/OT1hv/QPDVb0E -Q2l5RQb6CIFMcs74wM5qN+I3atcGmKrfiUdqR8C1sTGgFiI8zVWPOvFkOyWtXsaM -sOXL0jnlhUPkclu4ue1lL8mrmbBabeHa+3PMcq/2eMj8VdzeSxg0xPRttai/byey -Ax3I181cXr4Ijrve07rVHsar8AxW4r1LxAYOWTO8krwBg2A33Usgxkx7tMpbUcvY -Y50z+islNF4K3YTicWE6gQm1RXEfrdc79tla0+6IAmMdGC2SvW6nbBOM0P7tji4l -FuAEI7Yn8KFFkuU2zAaBvRSFAFR3acQs9TQMPr0F9ZXVfgBM7Tm73SEQvWNd5SWl -rUi2CcHF6Fcxud80PY3PdN6UXSkW5ZES2sl6Pk3ZgT1cWD//gS4= -=GIIK +iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmePtOUACgkQUcZzBf/C +5cDpiA/9H/3XQ+B1N3SpyYCG8lPRKikrT/fr8arZDUl7dBRSaV0z3YlPikU01l+g +31LrAEMzGRmU/pxoaozNsCoC/9ALGTlMIMYRC9K16eKRChCJiVQSF9IGTXdf4qLm +fs5+G4s2yJeHQ2/GnK95oi0R8kJPIku5SjYaZ3zElPXcvk+5w8m111VfUMxCm363 +EBbTyFkcdpQvx8x0T3rbAyHLOcOxkmShsvIT47JyiKXQSbEWrCjY5KTa9wNljEMF +61sN77sMfxFTQ4UfQaiCcXeMeOABRhq1Dd5vxAEg5Zl5JKL4YzVOSMXXRJ6ANtle +ofQGkFsEnpuGB+jloLAjwsM/IoRDJR6ZZ+utjkrcD5AWkTzSa1llP9UhI9YeB1Jl +ZZfsrvWU1xAUwHY6Aed/D5QvdOZZAT+QlYCDzpM//fjqPHgdlRoEshJtsU6x/sGa +lmtxyhGrU6g0ZMqvb7TrOMFq6KloPwFXFjoLQpgA41krdosw56PDQtU7Z/uswrvN +eD3of4I5Wh7jji+sKUdIAw0D9ZKPFMQd+KWgffmWXc76pwcfmIKlJeadxdCRS7Uk +8Lp+UO7YTEsczndq+jjNPMSZO66doLguIRhNRFeUGzndYGpug3UHuLIW6FRxs8EY +DTj9/kg4PWc8NvYgODuuIQFW4aadcLH1OZeEJbp7uk55a+jtOgo= +=nqQR -----END PGP SIGNATURE----- diff --git a/app/vendor/spaze/phpstan-disallowed-calls/docs/custom-rules.md b/app/vendor/spaze/phpstan-disallowed-calls/docs/custom-rules.md index 6735d6e78..6ea8e5905 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/docs/custom-rules.md +++ b/app/vendor/spaze/phpstan-disallowed-calls/docs/custom-rules.md @@ -163,7 +163,9 @@ You can treat some language constructs as functions and disallow it in `disallow - `empty()` - `eval()` - `exit()` +- `isset()` - `print()` +- `unset()` To disallow naive object creation (`new ClassName()` or `new $classname`), disallow `NameSpace\ClassName::__construct` in `disallowedMethodCalls`. Works even when there's no constructor defined in that class. diff --git a/app/vendor/spaze/phpstan-disallowed-calls/extension.neon b/app/vendor/spaze/phpstan-disallowed-calls/extension.neon index 880a9d24e..66c2d0c02 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/extension.neon +++ b/app/vendor/spaze/phpstan-disallowed-calls/extension.neon @@ -297,6 +297,14 @@ services: factory: Spaze\PHPStan\Rules\Disallowed\Calls\EmptyCalls(forbiddenCalls: %disallowedFunctionCalls%) tags: - phpstan.rules.rule + - + factory: Spaze\PHPStan\Rules\Disallowed\Calls\IssetCalls(forbiddenCalls: %disallowedFunctionCalls%) + tags: + - phpstan.rules.rule + - + factory: Spaze\PHPStan\Rules\Disallowed\Calls\UnsetCalls(forbiddenCalls: %disallowedFunctionCalls%) + tags: + - phpstan.rules.rule - factory: Spaze\PHPStan\Rules\Disallowed\Calls\ExitDieCalls(forbiddenCalls: %disallowedFunctionCalls%) tags: diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/IssetCalls.php b/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/IssetCalls.php new file mode 100644 index 000000000..ce78684fe --- /dev/null +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/IssetCalls.php @@ -0,0 +1,60 @@ + + */ +class IssetCalls implements Rule +{ + + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; + + /** @var list */ + private array $disallowedCalls; + + + /** + * @param DisallowedCallsRuleErrors $disallowedCallsRuleErrors + * @param DisallowedCallFactory $disallowedCallFactory + * @param array $forbiddenCalls + * @phpstan-param ForbiddenCallsConfig $forbiddenCalls + * @noinspection PhpUndefinedClassInspection ForbiddenCallsConfig is a type alias defined in PHPStan config + * @throws ShouldNotHappenException + */ + public function __construct(DisallowedCallsRuleErrors $disallowedCallsRuleErrors, DisallowedCallFactory $disallowedCallFactory, array $forbiddenCalls) + { + $this->disallowedCallsRuleErrors = $disallowedCallsRuleErrors; + $this->disallowedCalls = $disallowedCallFactory->createFromConfig($forbiddenCalls); + } + + + public function getNodeType(): string + { + return Isset_::class; + } + + + /** + * @throws ShouldNotHappenException + */ + public function processNode(Node $node, Scope $scope): array + { + return $this->disallowedCallsRuleErrors->get(null, $scope, 'isset', 'isset', null, $this->disallowedCalls, ErrorIdentifiers::DISALLOWED_ISSET); + } + +} diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/UnsetCalls.php b/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/UnsetCalls.php new file mode 100644 index 000000000..d8655caf2 --- /dev/null +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/Calls/UnsetCalls.php @@ -0,0 +1,60 @@ + + */ +class UnsetCalls implements Rule +{ + + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; + + /** @var list */ + private array $disallowedCalls; + + + /** + * @param DisallowedCallsRuleErrors $disallowedCallsRuleErrors + * @param DisallowedCallFactory $disallowedCallFactory + * @param array $forbiddenCalls + * @phpstan-param ForbiddenCallsConfig $forbiddenCalls + * @noinspection PhpUndefinedClassInspection ForbiddenCallsConfig is a type alias defined in PHPStan config + * @throws ShouldNotHappenException + */ + public function __construct(DisallowedCallsRuleErrors $disallowedCallsRuleErrors, DisallowedCallFactory $disallowedCallFactory, array $forbiddenCalls) + { + $this->disallowedCallsRuleErrors = $disallowedCallsRuleErrors; + $this->disallowedCalls = $disallowedCallFactory->createFromConfig($forbiddenCalls); + } + + + public function getNodeType(): string + { + return Unset_::class; + } + + + /** + * @throws ShouldNotHappenException + */ + public function processNode(Node $node, Scope $scope): array + { + return $this->disallowedCallsRuleErrors->get(null, $scope, 'unset', 'unset', null, $this->disallowedCalls, ErrorIdentifiers::DISALLOWED_UNSET); + } + +} diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/RuleErrors/ErrorIdentifiers.php b/app/vendor/spaze/phpstan-disallowed-calls/src/RuleErrors/ErrorIdentifiers.php index 52a15e690..5147a5dcc 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/src/RuleErrors/ErrorIdentifiers.php +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/RuleErrors/ErrorIdentifiers.php @@ -30,6 +30,7 @@ class ErrorIdentifiers public const DISALLOWED_IF = 'disallowed.if'; public const DISALLOWED_INCLUDE = 'disallowed.include'; public const DISALLOWED_INCLUDE_ONCE = 'disallowed.includeOnce'; + public const DISALLOWED_ISSET = 'disallowed.isset'; public const DISALLOWED_MATCH = 'disallowed.match'; public const DISALLOWED_METHOD = 'disallowed.method'; public const DISALLOWED_NAMESPACE = 'disallowed.namespace'; @@ -40,6 +41,7 @@ class ErrorIdentifiers public const DISALLOWED_RETURN = 'disallowed.return'; public const DISALLOWED_SWITCH = 'disallowed.switch'; public const DISALLOWED_TRAIT = 'disallowed.trait'; + public const DISALLOWED_UNSET = 'disallowed.unset'; public const DISALLOWED_VARIABLE = 'disallowed.variable'; public const DISALLOWED_WHILE = 'disallowed.while'; diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/AttributeUsages.php b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/AttributeUsages.php index f1b3109ec..7773c1fc5 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/AttributeUsages.php +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/AttributeUsages.php @@ -89,10 +89,10 @@ public function processNode(Node $node, Scope $scope): array $errors = []; foreach ($this->attributes as $attribute) { - $errors = array_merge( - $errors, - $this->disallowedAttributeRuleErrors->get($attribute, $scope, $this->disallowedAttributes) - ); + $ruleErrors = $this->disallowedAttributeRuleErrors->get($attribute, $scope, $this->disallowedAttributes); + if ($ruleErrors) { + $errors = array_merge($errors, $ruleErrors); + } } return $errors; } diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/ClassConstantUsages.php b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/ClassConstantUsages.php index abe32b011..853169815 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/ClassConstantUsages.php +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/ClassConstantUsages.php @@ -85,10 +85,10 @@ public function processNode(Node $node, Scope $scope): array $type = $scope->getType($node->name); $errors = []; foreach ($type->getConstantStrings() as $constantString) { - $errors = array_merge( - $errors, - $this->getConstantRuleErrors($scope, $constantString->getValue(), $this->typeResolver->getType($node->class, $scope)) - ); + $ruleErrors = $this->getConstantRuleErrors($scope, $constantString->getValue(), $this->typeResolver->getType($node->class, $scope)); + if ($ruleErrors) { + $errors = array_merge($errors, $ruleErrors); + } } return $errors; } diff --git a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/NamespaceUsages.php b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/NamespaceUsages.php index 90267e0c1..396aabebb 100644 --- a/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/NamespaceUsages.php +++ b/app/vendor/spaze/phpstan-disallowed-calls/src/Usages/NamespaceUsages.php @@ -125,16 +125,16 @@ public function processNode(Node $node, Scope $scope): array $errors = []; foreach ($namespaces as $namespace) { - $errors = array_merge( - $errors, - $this->disallowedNamespaceRuleErrors->getDisallowedMessage( - $this->normalizer->normalizeNamespace($namespace), - $description ?? 'Namespace', - $scope, - $this->disallowedNamespace, - $identifier ?? $identifier = ErrorIdentifiers::DISALLOWED_NAMESPACE - ) + $ruleErrors = $this->disallowedNamespaceRuleErrors->getDisallowedMessage( + $this->normalizer->normalizeNamespace($namespace), + $description ?? 'Namespace', + $scope, + $this->disallowedNamespace, + $identifier ?? $identifier = ErrorIdentifiers::DISALLOWED_NAMESPACE ); + if ($ruleErrors) { + $errors = array_merge($errors, $ruleErrors); + } } return $errors;