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

Feature: Introducing Static Code Analysis, PHPStan and refactor #75

Merged
merged 3 commits into from
Dec 17, 2022

Conversation

roberto-butti
Copy link
Collaborator

Pull request type

Jira Link: INT-

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Other (please describe):

Due to the changes needed to reach level 0 of static code analysis, I'm creating this PR to introduce phpstan and add some refactoring.

The refactor was:

  • moving functions that call getStories() from BaseClient to Client;
  • moving "enrich" related functions from BaseClient to Client
  • moving "relations" related functions from BaseClient to Client
  • moving "resolvingLinks" related functions from BaseClient to Client
  • declare attributes for classes
  • cleaning responseHandler() for avoid duplicate code in the classes

I have some proposals (not yet included in this PR): creating Traits to group methods and attributes related to specific functionality, for example:

  • Traits Relatable with: $_relationsList, getResolvedRelations() , insertRelations(),
  • Traits Enrichable with: enrichContent(), enrichStories()
  • Traits Linkable with: getResolvedLinks(), insertLinks()

Because the refactoring for reaching level 2 of phpstan involves the resolve relations function, I added more tests for that (for checking if, during the elaboration, it is to keep the order of the relations (because it is very important).

This test is related to the issue (it is not an issue, is more a clarification): storyblok#76
@roberto-butti roberto-butti merged commit c94e540 into storyblok:master Dec 17, 2022
@roberto-butti roberto-butti deleted the feature/74-phpstan branch December 17, 2022 10:09
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.

1 participant