We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a link to PHPStan plugin for for the package, but Psalm support is unclear from the README. What is the status?
The text was updated successfully, but these errors were encountered:
I wrote a plugin that will add all non-safe functions to the forbidden function list. Feel free to use it:
class Plugin implements PluginEntryPointInterface { public function __invoke(RegistrationInterface $registration, ?\SimpleXMLElement $config = null): void { /** @psalm-suppress InternalClass,InternalMethod */ $config = ProjectAnalyzer::getInstance()->getCodebase()->config; $forbiddenFunctions = &$config->forbidden_functions; $deprecatedSafeFunctions = [ 'safe\\sprintf' => true, 'safe\\ksort' => true, 'safe\\usort' => true, 'safe\\array_flip' => true, 'safe\\substr' => true, 'safe\\sort' => true, 'safe\\asort' => true, 'safe\\password_hash' => true, 'safe\\sleep' => true, ]; foreach (\get_defined_functions()['user'] as $functionName) { if (!\str_starts_with($functionName, 'safe\\')) { continue; } if (isset($deprecatedSafeFunctions[$functionName])) { unset($deprecatedSafeFunctions[$functionName]); continue; } $forbiddenFunctions[\substr($functionName, 5)] = true; } if ($deprecatedSafeFunctions !== []) { throw new \Exception('$deprecatedSafeFunctions has unused keys: ' . \var_export($deprecatedSafeFunctions, true)); } } }
Sorry, something went wrong.
No branches or pull requests
There is a link to PHPStan plugin for for the package, but Psalm support is unclear from the README. What is the status?
The text was updated successfully, but these errors were encountered: