-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
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
PHP linting problem when using PHP 7. #115
Comments
We already do that here: https://github.com/paragonie/random_compat/blob/master/lib/random.php#L56 Would you be happier if we wrapped every implementation with redundant |
👎 for #115 your should fix your project linter to exclude stub includes. what could be done here is to move those stubs that get loaded on condition to subdirs, then it would be simpler to exclude them in various lint tool configuration files. |
👎 |
While the performance hit of an extra |
Some people want to write their code for a variety of systems, running a variety of PHP versions. This is exactly what this library is made for, to provide a backwards compatible way to generate random numbers.
However, if you do any kind of automatic linting to check for errors, then all the various random_bytes_* files will throw an error if you're using PHP 7 to do that linting. The specific error it will throw looks like this:
Fatal error: Cannot redeclare random_bytes() in .../random_compat/lib/random_bytes_com_dotnet.php on line 81.
..and similar.
Suggest that all these functions be wrapped in function_exists checks, or something equivalent, to prevent PHP 7's Lint process (php -l) from marking these as errors, even though they would not actually be used on a PHP 7 installation.
The text was updated successfully, but these errors were encountered: