Skip to content
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

Fix PHPStan Level 4-5 #89

Merged
merged 1 commit into from May 13, 2019
Merged

Conversation

szepeviktor
Copy link
Contributor

@szepeviktor szepeviktor commented May 12, 2019

@paragonie-scott I am out of fuel :)

One of the remaining ones:

src/Compat.php:2556 Trying to invoke '\Sodium\increment' but it's not a callable.

increment() is a static method of ParagonIE_Sodium_Compat


I suggest you to increase level one-by-one: vendor/bin/phpstan analyze -l 5 up to 7

PHPStan can be installed by: composer require --dev --prefer-dist --no-suggest phpstan/phpstan

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 12, 2019

I think it makes no sense to add it to TravisCI before reaching error-free Level max in PHPStan.

What do you think?

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 12, 2019

Basically you will run into

  1. sodium_compat errors
  2. phpstan errors
  3. problems from PHP version as sodium_compat runs on lower versions too
  4. users passing rubbish to functions

@paragonie-scott
Copy link
Member

src/Compat.php:2556 Trying to invoke '\Sodium\increment' but it's not a callable.

This is only callable if the old ext/libsodium (contrast with the newer ext/sodium) is installed.

Sodium_compat is a polyfill library. It calls things that might not exist, then wraps those calls in logic that checks that they exist. Phpstan needs to ignore these failures.

@paragonie-scott paragonie-scott merged commit 3582a1e into paragonie:master May 13, 2019
@paragonie-scott
Copy link
Member

I'll fix the Psalm nits.

@szepeviktor
Copy link
Contributor Author

Phpstan needs to ignore these failures.

You can define a shim class Sodium { function static increment{} } in bootstrap.php!

@szepeviktor
Copy link
Contributor Author

Oops, there is no bootstrap.php yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants