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

Correcting errors reported by Phan PHP static analyzer #9

Merged
merged 1 commit into from Jun 15, 2020
Merged

Correcting errors reported by Phan PHP static analyzer #9

merged 1 commit into from Jun 15, 2020

Conversation

jespinal
Copy link
Contributor

@jespinal jespinal commented Jun 13, 2020

In the company I work for we are using this PHP SDK library in order to integrate our system with InterNetX platform.

While working with the different services provided in this SDK, I've noticed that there are some issues reported by Phan (PHP static analyzer) at the time of using some of them. After examining the issues, I was able to verify most of them, and noticed that the severity goes from low to high/important.

With this PR the following changes are introduced:

  1. Instances of domainRobotConfig properties were renamed to domainrobotConfig as was intended by one of the previous PRs merged into master.
  2. References to undeclared variables were fixed (e.g. in src/Service/CertificateService.php, src/Service/TrustedApplicationService.php)
  3. Instances where no return value was being returned in contexts where a DomainrobotPromise was expected were added
  4. Overall annotations blocks were corrected according to the accepted PHP standard (PHPDoc, Phan annotations, etc.)
  5. Instances where InvalidArgumentException()s were intended to be thrown, but invocation resulted in errors due to being called as methods instead of instantiations were fixed.
  6. A nonexistent method invocation (->getId()) fixed in a case where a TrustedApplication object was provided as argument. In this case, the correct method to be called would be ->getUuId()

HOW TO TEST

If you have automated testing mechanisms for this SDK, they should work just fine. The cases where some conditions would lead to fatal errors (like invocation of nonexistent methods, or throwing exceptions as if they were method callings) should also work.

Running Phan against the src/Service should not yield any critical error.

Feel free to contact me in case of any question or doubt.

- References to undeclared variables were fixed (e.g. in src/Service/CertificateService.php, src/Service/TrustedApplicationService.php)
- Instances where no return value was being returned in contexts where a `DomainrobotPromise` was expected were added
- Instances where `InvalidArgumentException()`s were intended to be thrown, but invocation resulted in errors due to being called as methods instead of instantiations were fixed
- A nonexistent method invocation (`->getId()`) fixed in a case where a `TrustedApplication` object was provided as argument. In this case, the correct method to be called would be `->getUuId()`
- Instances of `domainRobotConfig` properties were renamed to `domainrobotConfig` as was intended in one of the previous PRs merged into master
- Overall annotations blocks were corrected according to the accepted PHP standard (PHPDoc, Phan annotations, etc.)
@Ephenodrom Ephenodrom merged commit a26fa2b into InterNetX:master Jun 15, 2020
@Ephenodrom
Copy link
Collaborator

Ephenodrom commented Jun 15, 2020

@jespinal
Hello and thanks for the big pull request! The PR looks fine so far and will merge the changes. We will release a new version of the sdk soon, that will include these changes.

@jespinal
Copy link
Contributor Author

Great, thanks to you too for taking the time to review this PR.

@jespinal jespinal deleted the 2020-jun-13-correcting-errors-reported-by-phan branch June 15, 2020 13:45
ChripIX added a commit that referenced this pull request Sep 17, 2020
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