Skip to content

Commit

Permalink
Update packages, skip nette/database for now (#257)
Browse files Browse the repository at this point in the history
 - phpstan/phpdoc-parser updated from 1.24.4 to 1.24.5 patch
   See changes: phpstan/phpdoc-parser@1.24.4...1.24.5
   Release notes: https://github.com/phpstan/phpdoc-parser/releases/tag/1.24.5

 - phpstan/phpstan updated from 1.10.44 to 1.10.50 patch
   See changes: phpstan/phpstan@1.10.44...1.10.50
   Release notes: https://github.com/phpstan/phpstan/releases/tag/1.10.50

 - psalm/phar updated from 5.16.0 to 5.18.0 minor
   See changes: psalm/phar@5.16.0...5.18.0
   Release notes: https://github.com/psalm/phar/releases/tag/5.18.0

 - roave/security-advisories updated from dev-latest@2b23329 to dev-latest@be9456d
   See changes: Roave/SecurityAdvisories@2b23329...be9456d

 - spaze/phpstan-disallowed-calls-nette updated from v2.0.1 to v2.0.2 patch
   See changes: spaze/phpstan-disallowed-calls-nette@v2.0.1...v2.0.2
   Release notes: https://github.com/spaze/phpstan-disallowed-calls-nette/releases/tag/v2.0.2

 - spaze/phpstan-disallowed-calls updated from v2.16.1 to v3.0.0 major
   See changes: spaze/phpstan-disallowed-calls@v2.16.1...v3.0.0
   Release notes: https://github.com/spaze/phpstan-disallowed-calls/releases/tag/v3.0.0

 - squizlabs/php_codesniffer updated from 3.7.2 to 3.8.0 minor
   See changes: PHPCSStandards/PHP_CodeSniffer@squizlabs:3.7.2...PHPCSStandards:3.8.0
   Release notes: https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.8.0

 - symfony/cache updated from v6.3.8 to v7.0.0 major
   See changes: symfony/cache@v6.3.8...v7.0.0
   Release notes: https://github.com/symfony/cache/releases/tag/v7.0.0

 - symfony/config updated from v6.3.8 to v6.4.0 minor
   See changes: symfony/config@v6.3.8...v6.4.0
   Release notes: https://github.com/symfony/config/releases/tag/v6.4.0

 - symfony/filesystem updated from v6.3.1 to v7.0.0 major
   See changes: symfony/filesystem@v6.3.1...v7.0.0
   Release notes: https://github.com/symfony/filesystem/releases/tag/v7.0.0

 - symfony/translation updated from v6.3.7 to v6.4.0 minor
   See changes: symfony/translation@v6.3.7...v6.4.0
   Release notes: https://github.com/symfony/translation/releases/tag/v6.4.0

 - symfony/var-exporter updated from v6.3.6 to v7.0.1 major
   See changes: symfony/var-exporter@v6.3.6...v7.0.1
   Release notes: https://github.com/symfony/var-exporter/releases/tag/v7.0.1
  • Loading branch information
spaze authored Dec 26, 2023
2 parents 9731919 + 56db068 commit 3c6e639
Show file tree
Hide file tree
Showing 862 changed files with 13,546 additions and 3,006 deletions.
4 changes: 2 additions & 2 deletions site/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"spaze/phpinfo": "^1.0",
"spaze/sri-macros": "^2.0",
"spaze/svg-icons-latte": "^1.0",
"symfony/cache": "^6.1.5",
"symfony/cache": "^7.0",
"texy/texy": "^3.1.7",
"tracy/tracy": "^2.9.4"
},
Expand All @@ -65,7 +65,7 @@
"psalm/phar": "^5.14",
"roave/security-advisories": "dev-latest",
"spaze/coding-standard": "^1.7",
"spaze/phpstan-disallowed-calls": "^2.11.4",
"spaze/phpstan-disallowed-calls": "^3.0",
"spaze/phpstan-disallowed-calls-nette": "^2.0.1"
},
"config": {
Expand Down
285 changes: 161 additions & 124 deletions site/composer.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions site/vendor/bin/phpcbf
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ if (PHP_VERSION_ID < 80000) {
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf');
exit(0);
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf');
}
}

include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf';
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf';
5 changes: 2 additions & 3 deletions site/vendor/bin/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ if (PHP_VERSION_ID < 80000) {
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs');
exit(0);
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs');
}
}

include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs';
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs';
307 changes: 172 additions & 135 deletions site/vendor/composer/installed.json

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions site/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'spaze/michalspacek.cz',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'f931031a7fb74118984ce99feeaed26f41d633ce',
'reference' => '9731919c14be02397a27151a774669f34f073a41',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -311,18 +311,18 @@
'dev_requirement' => true,
),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '1.24.4',
'version' => '1.24.4.0',
'reference' => '6bd0c26f3786cd9b7c359675cb789e35a8e07496',
'pretty_version' => '1.24.5',
'version' => '1.24.5.0',
'reference' => 'fedf211ff14ec8381c9bf5714e33a7a552dd1acc',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'phpstan/phpstan' => array(
'pretty_version' => '1.10.44',
'version' => '1.10.44.0',
'reference' => 'bf84367c53a23f759513985c54ffe0d0c249825b',
'pretty_version' => '1.10.50',
'version' => '1.10.50.0',
'reference' => '06a98513ac72c03e8366b5a0cb00750b487032e4',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpstan',
'aliases' => array(),
Expand All @@ -347,9 +347,9 @@
'dev_requirement' => true,
),
'psalm/phar' => array(
'pretty_version' => '5.16.0',
'version' => '5.16.0.0',
'reference' => 'be4f93e50edf473d60a6e6f9c1d78546a3a32b90',
'pretty_version' => '5.18.0',
'version' => '5.18.0.0',
'reference' => 'a78b5c2e8860c3b4242c63bc0864621278705f9a',
'type' => 'library',
'install_path' => __DIR__ . '/../psalm/phar',
'aliases' => array(),
Expand Down Expand Up @@ -397,7 +397,7 @@
'roave/security-advisories' => array(
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => '2b23329e299c9a6cd98a82f5137ab4909c8e506d',
'reference' => 'be9456d1430df8be755ff7da33b22b80f0ed2f5f',
'type' => 'metapackage',
'install_path' => NULL,
'aliases' => array(
Expand Down Expand Up @@ -453,7 +453,7 @@
'spaze/michalspacek.cz' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'f931031a7fb74118984ce99feeaed26f41d633ce',
'reference' => '9731919c14be02397a27151a774669f34f073a41',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -487,18 +487,18 @@
'dev_requirement' => false,
),
'spaze/phpstan-disallowed-calls' => array(
'pretty_version' => 'v2.16.1',
'version' => '2.16.1.0',
'reference' => '1500f90ff6a705009731cc14e50d4faf2d202bf3',
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'reference' => '69935c9f519cae95e394fbde23ce5f962b2eba2f',
'type' => 'phpstan-extension',
'install_path' => __DIR__ . '/../spaze/phpstan-disallowed-calls',
'aliases' => array(),
'dev_requirement' => true,
),
'spaze/phpstan-disallowed-calls-nette' => array(
'pretty_version' => 'v2.0.1',
'version' => '2.0.1.0',
'reference' => '7ed93785bb170f15b8c001306c6b3ed6ccb96ec2',
'pretty_version' => 'v2.0.2',
'version' => '2.0.2.0',
'reference' => '0ebe51c50452224a6772796b6579be4ed93ddb33',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/phpstan-disallowed-calls-nette',
'aliases' => array(),
Expand All @@ -523,18 +523,18 @@
'dev_requirement' => false,
),
'squizlabs/php_codesniffer' => array(
'pretty_version' => '3.7.2',
'version' => '3.7.2.0',
'reference' => 'ed8e00df0a83aa96acf703f8c2979ff33341f879',
'pretty_version' => '3.8.0',
'version' => '3.8.0.0',
'reference' => '5805f7a4e4958dbb5e944ef1e6edae0a303765e7',
'type' => 'library',
'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/cache' => array(
'pretty_version' => 'v6.3.8',
'version' => '6.3.8.0',
'reference' => 'ba33517043c22c94c7ab04b056476f6f86816cf8',
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => '5e2376f726d61541b9617512e374808d12c1dc22',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache',
'aliases' => array(),
Expand All @@ -556,9 +556,9 @@
),
),
'symfony/config' => array(
'pretty_version' => 'v6.3.8',
'version' => '6.3.8.0',
'reference' => 'b7a63887960359e5b59b15826fa9f9be10acbe88',
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'reference' => '5d33e0fb707d603330e0edfd4691803a1253572e',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/config',
'aliases' => array(),
Expand All @@ -574,9 +574,9 @@
'dev_requirement' => false,
),
'symfony/filesystem' => array(
'pretty_version' => 'v6.3.1',
'version' => '6.3.1.0',
'reference' => 'edd36776956f2a6fcf577edb5b05eb0e3bdc52ae',
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => '7da8ea2362a283771478c5f7729cfcb43a76b8b7',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
Expand Down Expand Up @@ -622,9 +622,9 @@
'dev_requirement' => false,
),
'symfony/translation' => array(
'pretty_version' => 'v6.3.7',
'version' => '6.3.7.0',
'reference' => '30212e7c87dcb79c83f6362b00bde0e0b1213499',
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'reference' => 'b1035dbc2a344b21f8fa8ac451c7ecec4ea45f37',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation',
'aliases' => array(),
Expand All @@ -646,9 +646,9 @@
),
),
'symfony/var-exporter' => array(
'pretty_version' => 'v6.3.6',
'version' => '6.3.6.0',
'reference' => '374d289c13cb989027274c86206ddc63b16a2441',
'pretty_version' => 'v7.0.1',
'version' => '7.0.1.0',
'reference' => 'a3d7c877414fcd59ab7075ecdc3b8f9c00f7bcc3',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-exporter',
'aliases' => array(),
Expand Down
4 changes: 4 additions & 0 deletions site/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ private function printNodeFormatPreserving(Node $node, TokenIterator $originalTo
throw new LogicException();
}

if ($subEndPos < $subStartPos) {
return $this->print($node);
}

if ($subNode === null) {
return $this->print($node);
}
Expand Down
Binary file modified site/vendor/phpstan/phpstan/phpstan.phar
Binary file not shown.
26 changes: 13 additions & 13 deletions site/vendor/phpstan/phpstan/phpstan.phar.asc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmVc2xYACgkQUcZzBf/C
5cALsA//anH6sd4y34I63DpmUIAkwhOcJ/a3EJAeMZcPfuK+9GQSb5uvTwcCVdd3
eoBar36Nw/H9I0I+Ksl2CaxUkWhb5LwK1AyBelzIqXA/LgsGyAV0uNYxVaYA72XD
6qXz5K2imvUpcTHtb3YhwpALhdv0DPW41WaWbBmZsxYqQoLS1O8E/eA9ZRqwjO2M
buSHEu626a8q55N0j4Gnogzokm8cdkls3uOXI/pid4VCc0nllrAwXDI6MvXW+NvI
wuqluWNXZsWtkyQzJqVoVbGhgXV91vbFLkwdh1T+ONVvtn6Xt2dBOfa+VdHEhTyZ
cafB11phVXUNyh/B476SjVdYrSdgYWeeJpUVgiHUfbKZT3XJdNRj1bi/lSk4Po9V
BkdMdBf6O1ffCjERfndHYhPiKWv8AEu2t1/a6qXou4DHIdop6VkCNvq/pCzspydg
AXq/2Wd/d2giQXAYEH7ZGESqOTNEPeFy9OEnpY1PCPcTQZEmLepO+UuXqb1B0DHT
sphBYMmrDbzOrWYT+OegzDt/V9w/4+SR7YiEXvNDIfrUjRcx6YeTk/CgfbrC9YLo
QgfB1h+23AseU1M/64De4LMJPHdWg1yDsG7fRJY5UaER1bUGfO12ODjqTICmFoUS
LtV7L7wNXRce5eDecIjk9v9owaywY+zQcdIlGw8B6U4yaij2lHc=
=BpNt
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmV5joUACgkQUcZzBf/C
5cBntQ/+OM+FOq0P8rk+90fVkJBEopvHlzt+HLxLxOpp4TA9H5rYrYvcoRNzeV+H
d8GNHtEUwe3Li87OfGL67MVd9BPN1NNmVpqodgiHHwDBlE2/yPhcsczs4DA+plFT
ZZfDtA7FOfSHa1Y4iRQndW2jI9gZKPIaDah885KqUwj5CxB/ydc1rVMIjn+BkVEA
g29VrevyzPJrkuwih2rcZ/E0AkbSvkgkvaf74s1Iy0b9ff+IU0FvRxTHfVXy6ykd
WIc5nIDEqyZIMR2K6lqCHkzdVwOlBCY0P6khEOzZeBUhAustmOncFRMQNX9Hilcq
9QzF2eF1cXZU7RybVqmqfomM7vKLWgfghAKbNAwlkSKEC79RqKn37Dbr2ow1eNCx
Mqp42kSRyhl2357z81t+A6MFi1a0c1Z1eMsSwFf9pVUN2N68zorHsMzs6gl+V2+8
2JHoZAj92HElCOY3FpmBFwWUhLHv4dMueO1foDA6w71EslIVNxbJhFrDx9T1PHrz
gEkkdEgxQl8HTg5mGrTutfp0/i37nX1YnZZZ4h6+3m1T4FU6WkjZ7RUICw2RsXeW
1DRVJ5ta2aDTolbyPCkQ5V8ZyHOqnIux7vVlOExaYHjzPurUdtZSMXsqsb5dY3NC
+BRlElHVVlxDfn05wQf/WZJM6ZWeuoLN/lwbw1oKCEp3iTA2NMw=
=I7Xy
-----END PGP SIGNATURE-----
Binary file modified site/vendor/psalm/phar/psalm.phar
Binary file not shown.
16 changes: 8 additions & 8 deletions site/vendor/psalm/phar/psalm.phar.asc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEELeUOtgwBP/+oMQQNEs4PHSYkKaUFAmVeeqwACgkQEs4PHSYk
KaVa8ggAtd/zviid6g1bFGEvMjHxEQ0xYcLWMqiZM/c5B/q4ylasWARvGJNjFZSW
arebmXGe4xOEGVakf8erKs7NpB/6x8YIvDIrczpBDYouldV9xBfli6F8hKaVg/f9
jPUdLPIJ4dSbnJGyHKIg8Kpy8GPN1KbBlys6K/n2QhfCxtn17xLEpzi0zaKsbbyB
1L3wz5IAdsc63RGljJ0IqqEdte6JyUyhacNpiVoX2bpH9i4OI7VQJzw034SATTZT
gDhMGgCnJ18wt/a8v6XL5Rk4piWHohqqstSDHQgdnCrwSdl80IBumms6kkxBb5e1
tUvVfLkN3dAQ2hkBKq6BYvdrFf+lPA==
=TovA
iQEzBAABCgAdFiEELeUOtgwBP/+oMQQNEs4PHSYkKaUFAmV9cDYACgkQEs4PHSYk
KaVDhgf9HZ+sWEZ6snEccO5ViPGF0j4RZNfd1iPH85L4yjBZkbzZSk9mhUYtNXlZ
NYLvl7VMRdb1a/KeG95sj5UzpEHSuYx5GpIRUk5h3lbkc492KXbtgpksrsaEjs3N
Sh6+sOavq3K+DolwSmQSOU0Ai7T4roKfgslpVNbF03mKsM/6a3AnwjDmDHczbpHD
5PSxBk/w91kwuV1esA1X3Uzf3s7jAExKXyQAjhdv6hNQOt1SRC+HpCToLTKLr+Vy
cmL/epTIKHDBQqTx68MivUegejlVnwp8BAdxUxgTHWzenT3NS+EWQEdXHwTfVk+C
zfVbgshgp6om16zklX7s5akgk5bgDw==
=+Ib0
-----END PGP SIGNATURE-----
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
],
"require": {
"php": "^7.1 || ^8.0",
"spaze/phpstan-disallowed-calls": "^1.4.0 || ^2.0.0"
"spaze/phpstan-disallowed-calls": "^1.4.0 || ^2.0.0 || ^3.0.0"
}
}
8 changes: 6 additions & 2 deletions site/vendor/spaze/phpstan-disallowed-calls/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@
"autoload": {
"psr-4": {"Spaze\\PHPStan\\Rules\\Disallowed\\": "src"}
},
"autoload-dev": {
"classmap": ["tests/src"]
},
"scripts": {
"lint": "vendor/bin/parallel-lint --colors src/ tests/",
"lint-7.x": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php --exclude tests/src/disallowed/functionCallsNamedParams.php --exclude tests/src/disallowed-allow/functionCallsNamedParams.php --exclude tests/src/disallowed/attributeUsages.php --exclude tests/src/disallowed-allow/attributeUsages.php",
"lint-8.0": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php",
"lint-7.x": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php --exclude tests/src/AttributesEverywhere.php --exclude tests/src/disallowed/functionCallsNamedParams.php --exclude tests/src/disallowed-allow/functionCallsNamedParams.php --exclude tests/src/disallowed/attributeUsages.php --exclude tests/src/disallowed-allow/attributeUsages.php",
"lint-8.0": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php --exclude tests/src/AttributesEverywhere.php",
"lint-8.1": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/AttributesEverywhere.php",
"lint-neon": "vendor/bin/neon-lint .",
"phpcs": "vendor/bin/phpcs src/ tests/",
"cs-fix": "vendor/bin/phpcbf src/ tests/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ parameters:
function: 'htmlspecialchars()'
message: 'set the $flags parameter to `ENT_QUOTES` to also convert single quotes to entities to prevent some HTML injection bugs'
allowParamFlagsAnywhere:
2: ::ENT_QUOTES
2: ::constant(ENT_QUOTES)
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ parameters:
position: 1
name: repositoryClass
```

You can also use `value` or `typeString` directives, just like with functions or methods.
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ parameters:
position: 2
value: ::JSON_HEX_APOS
```

Just like with regular parameters, you can also use `typeString` instead of `value`.
The extra bonus this brings is unions: if you want to (dis)allow a parameter when either the flag `1` or `2` is set, use `typeString: 1 | 2`. Note that the `|` operator here is not the PHP's _bitwise or_ operator.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Allow with specified parameters only

You can also narrow down the allowed items when called with some parameters (applies only to disallowed method, static & function calls, for obvious reasons). _Please note that for now, only scalar values are supported in the configuration, not arrays._
You can also narrow down the allowed items when called with some parameters (applies only to disallowed method, static & function calls, for obvious reasons).
Only scalar values and no arrays are supported with the `value` configuration directive, but with the `typeString` directive,
arrays and unions are also supported, and generally anything you can express with a PHPDoc type string, if it makes sense.
When `typeString` is specified, `value` directive is ignored for the given parameter.

For example, you want to disallow calling `print_r()` but want to allow `print_r(..., true)`.
This can be done with optional `allowParamsInAllowed` or `allowParamsAnywhere` configuration keys:
Expand Down Expand Up @@ -96,6 +99,22 @@ parameters:
```
will disallow `foo('bar', 'baz')` but not `foo('bar', 'BAZ')`.

If you don't care about the value but would like to disallow a call based just on the parameter presence, you can use `allowExceptParamsAnyValue` (or `disallowParamsAnyValue`):
```neon
parameters:
disallowedFunctionCalls:
-
function: 'waldo()'
disallowParamsAnyValue:
-
position: 1
name: 'message'
-
position: 2
name: 'alert'
```
This configuration will disallow calls like `waldo('foo', 'bar')` or `waldo('*', '*')`, but `waldo('foo')` or `waldo()` will be still allowed.

It's also possible to disallow functions and methods previously allowed by path (using `allowIn`) or by function/method name (`allowInMethods`) when they're called with specified parameters, and allow when called with any other parameter. This is done using the `allowExceptParamsInAllowed` config option.

Take this example configuration:
Expand All @@ -113,7 +132,7 @@ parameters:
value: 'quux'
```

Calling `waldo()` is disallowed, and allowed back again only when the file is in the `views/` subdirectory **and** `waldo()` is called in the file with a 2nd parameter being the string `quux`.
Calling `waldo()` is disallowed, and allowed back again only when the file is in the `views/` subdirectory **and** `waldo()` is called in the file with a 2nd parameter **not** being the string `quux`.

As already demonstrated above, named parameters are also supported:

Expand Down Expand Up @@ -168,3 +187,28 @@ parameters:
```

But because the "positional _or_ named" limitation described above applies here as well, I generally don't recommend using these shortcuts and instead recommend specifying both `position` and `name` keys.

### PHPDoc type strings

Instead of the `value` directive, you can use the `typeString` directive which allows you to specify arrays, unions, and anything that can be expressed with PHPDoc:

```neon
parameters:
disallowedFunctionCalls:
# ...
allowParamsInAllowed:
-
position: 1
name: 'message'
typeString: "'foo'"
```

The above example is the same as writing `value: foo` but because you want to specify a literal type string, you need to enclose the string in single quotes to indicate it's a string, not a class name. With integers, `typeString: 1` is the same as `value: 1`.

Type string allows you to specify:
- Arrays, e.g. `typeString: array{}` meaning empty array, or vice versa with `typeString: non-empty-array`, or even `typeString: array{foo:'bar'}` meaning an array with a `foo` key and `bar` string value
- Unions, e.g. `typeString: 1|2`, `typeString: "'foo'|'bar'"`, where the former example means the value must be an integer `1` or an integer `2`, and the latter means the value must be a string `foo` or `bar`
- Classes, e.g. `typeString: DateTime` which means an object of that class, or a child class od that class
- Any type as [understood by PHPStan](https://phpstan.org/writing-php-code/phpdoc-types), but not everything may make sense in your case

If both `typeString` and `value` directives are specified, the `value` directive is ignored.
Loading

0 comments on commit 3c6e639

Please sign in to comment.