Skip to content

feat: reject non-instantiable geometry types explicitly - #41

Merged
Alexandre-T merged 1 commit into
mainfrom
36-reject-non-instantiable-geometry-types
Oct 2, 2026
Merged

Alexandre-T merged 1 commit into
mainfrom
36-reject-non-instantiable-geometry-types

Conversation

@Alexandre-T

Copy link
Copy Markdown
Contributor

Pull Request

Closes #36

Summary

WKT and EWKT now report recognized non-instantiable geometry types through NonInstantiableGeometryTypeException, implementing DecoderExceptionInterface. The shared lexer continues to use GeometryTypeEnum::isInstantiable() before checking implementation availability or constructing spatial objects. The exception retains the recognized enum and explains why it cannot be instantiated.

Acceptance criteria

  • All acceptance criteria are implemented.
  • Tests derive every non-instantiable type from the enum and exercise both strategies, root and nested geometry, dimensional markers, case-insensitive names, EWKT with/without SRID, and rejection before body validation.
  • Unknown and recognized but unimplemented names retain separate exception contracts. Existing valid geometry coverage passes unchanged.

Validation

  • Relevant tests pass.
  • Repository quality checks pass.
  • Regression tests were added when fixing a bug.

Commands run

composer test -- --filter 'NonInstantiableGeometryTypeTest|SpatialTypeImplementationTest'
composer test                         # 324 tests, 1659 assertions
composer quality                      # exit 0
 git diff --check                     # clean

PHPMD/PDepend emit existing dependency deprecation notices under PHP 8.4; all quality tools pass.

Standards

  • No normative spatial behavior is affected.

Normative references

Classification remains delegated to GeometryTypeEnum::isInstantiable() as explicitly required by #36. No geometry hierarchy, grammar, dimensionality or normative interpretation changes.

Architecture

  • No architectural boundary is affected.

Architecture decision

Both strategies reuse the existing common lexer.

Compatibility

  • Public API changes were explicitly approved.

Issue #36 explicitly requires the dedicated public exception. It extends PHP's InvalidArgumentException and implements the decoder exception interface. Callers catching only the decoder's final InvalidArgumentException for abstract types must now catch the dedicated exception or DecoderExceptionInterface. Valid decoding and the unknown/unimplemented error contracts remain unchanged.

Documentation

  • Documentation was updated where required.

README describes the exception, enum accessor, classification timing, and catch migration.

Developer handoff

Important implementation decisions

Keep classification in the shared lexer and use the enum as the single source of truth. The dedicated exception follows the existing enum-carrying exception convention.

Compatibility considerations

See above: the exact exception for recognized non-instantiable types intentionally changes per #36.

Remaining risks or questions

Independent review and successful CI are required before Alexandre's merge decision. This PR does not mark the Story Done.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (e58bdf9) to head (9dc1bd7).

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #41   +/-   ##
=========================================
  Coverage     99.13%   99.14%           
- Complexity      220      222    +2     
=========================================
  Files            26       27    +1     
  Lines           465      469    +4     
=========================================
+ Hits            461      465    +4     
  Misses            4        4           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Alexandre-T
Alexandre-T merged commit e17796d into main Oct 2, 2026
3 checks passed
@Alexandre-T
Alexandre-T deleted the 36-reject-non-instantiable-geometry-types branch October 2, 2026 21:03
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.

Story - Reject non-instantiable geometry types in WKT and EWKT

2 participants