We currently parse payloads through json_decode as:
- \stdClass for most of them
- PhabricatorStory for Phabricator ones
Plan is instead to:
- create an abstract BasePayload class (probably empty?)
- create classes for GitHub (see T595), DockerHub, Jenkins, etc. payloads
- PhabricatorStory should inherit too
- map objects deserialized with json_decode to these new classes
This will have several benefits:
- we know everywhere an object is payload
- we can add an explicit return type at Nasqueron\Notifications\Console\Commands\NotificationsPayload::formatPayload() (currently an @return PhabricatorStory|stdClass)
good-first-issue — This task has been especially identified as suitable to discover our code base.
We use JSON mapper to map JSON payloads to classes.