geocoder-php / geocoder-php/Geocoder

No interface for formatters?

Open
#843 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement
Dominant language
PHP
Stars
4k
Forks
525
Avg merge
8m
Merged PRs (30d)
1

Description

I'm building a wrapper for this library and a service class for my app and when I wanted to make the formatter exchangeable I realized that I can't typehint the setter against an interface.

https://github.com/geocoder-php/Geocoder/blob/master/src/Common/Formatter/StringFormatter.php

If you agree I'll create a PR and add a Formatter interface that implements the format() method.

Would \Geocoder\Formatter\FormatterInterface.php work for you?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/Common/Formatter/StringFormatter.php and inspect its format() method and the setter that needs a typehint. Confirm the proposed FormatterInterface.php location and the format() contract, then consider the existing formatter usage. Done means the formatter interface is defined consistently and the exchangeable setter can typehint it.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.