Repository navigation
Release/v0.2.0 - #5
Merged
Merged
Conversation
…tion clarity and PHPStan compatibility**
- **Changes**:
- Updated `Stream::chunk()` return type PHPDoc to reflect `list<list<TValue>>` for improved alignment with expected stream result structure.
- Adjusted `chunk()` implementation:
- Added explicit casting of `ChunkSource` with detailed type annotations.
- Annotated `Stream::zip()` with PHPStan suppression (`@phpstan-ignore argument.type`) to address minor type mismatches with strict static analysis.
- Enhanced `RangeInit` and `FillInit` generator methods:
- Suppressed PHPStan complaints about native type assumptions for `$key` and `$value` using `@phpstan-ignore varTag.nativeType`.
- **Rationale**:
- Improves code readability and long-term maintainability by ensuring accurate PHPDoc annotations and compatibility with PHPStan static analysis.
- Aligns with FireHub's emphasis on robust type safety and developer tooling integration.
- **New Additions**:
- Introduced `Uri` component classes under `Foundation\Uri\Component` namespace:
- `Scheme`, `Authority`, `Host`, `Port`, `Path`, `Query`, `Fragment`, `UserInfo`.
- Each class encapsulates the corresponding URI component, enforcing immutability and strict validation rules.
- Created custom exception classes under `Foundation\Uri\Exception` to handle invalid value scenarios:
- `InvalidSchemeException`, `InvalidAuthorityException`, `InvalidHostException`, `InvalidPortException`, `InvalidPathException`, `InvalidQueryException`, `InvalidFragmentException`, `InvalidUserInfoException`.
- **Details**:
- Each URI component ensures type consistency, validation, and normalization.
- E.g., `Scheme` enforces valid schemes like `https`, `ftp`; `Host` supports registered names and IP literals.
- Validation utilizes regex patterns and PHP filter functions for strict compliance.
- Validation exceptions are thrown for invalid patterns, maintaining robust error handling.
- PHPDoc and version annotations included for clarity, compatibility, and guidance.
- **Rationale**:
- Establishes a modular, extensible foundation for URI handling in the FireHub ecosystem.
- Provides strict validation and normalization for consistent, error-free URI representation and processing.
- Aligns with FireHub's principles of type safety, immutability, and developer-friendly APIs.
- **Changes to `Host`**:
- Updated the `normalized()` method:
- Added checks for empty and IPv6 literal hosts.
- Incorporated regex-based validation and percent-encoding normalization for host values.
- Ensured case-insensitive comparison by normalizing to lowercase.
- Enhanced `isValid()` method:
- Introduced additional regex patterns to validate IPv6 and other naming schemes.
- Simplified conditional flows for clarity and efficiency.
- **Fixes**:
- Corrected PHPDoc `@uses` annotations in `Scheme` to reference the proper namespace.
- Addressed namespace typos in method references for consistency.
- **Rationale**:
- Improves URI normalization by handling edge cases and enforcing strict compliance with standards.
- Strengthens validation mechanisms and ensures proper percent-encoding and decoding for host names.
- Enhances code maintainability and readability for future extensions.
- **Changes**:
- Updated `UserInfo`:
- Relaxed `@template TValue` constraint from `non-empty-string` to `string` for broader compatibility.
- Improved `Host`:
- Refactored `normalized()` method:
- Added case normalization for hosts based on context (e.g., IPv6 literal handling, percent-encoding).
- Applied consistent lowercase transformation logic while preserving relevant uppercase encodings.
- Enhanced regex-based normalization to target accurate hexadecimal percent-escaping patterns.
- **Rationale**:
- Improves flexibility of `UserInfo` for handling various string inputs.
- Strengthens `Host` normalization with better consideration for edge cases, ensuring compliance with URI standards.
- Enhances maintainability and correctness through code clarity and logical flow.
- **Changes**:
- Added `isEmpty()` checks to several URI component classes:
- `Path`, `UserInfo`, `Authority`, `Fragment`, `Host`.
- Each check ensures components can reliably determine if their value is empty.
- Introduced `isRoot()` method to `Path` to check if the path represents the root (i.e., `/`).
- Updated regex patterns:
- Removed unnecessary `D` modifier in `Query` and `Fragment` validation to improve clarity.
- **Rationale**:
- Enhances usability with utility methods for common operations (`isEmpty()`, `isRoot()`).
- Strengthens component consistency with added checks for emptiness.
- Simplifies and streamlines regex definitions while maintaining validation integrity.
…` enum**
- **New Additions**:
- Added `Uri` class:
- Represents complete, immutable URI references.
- Combines components (`Scheme`, `Authority`, `Path`, `Query`, `Fragment`) into a unified value object.
- Enforces strict RFC 3986 compliance with validation and normalization.
- Supports utility methods like `isAbsolute()`, `isRelative()`, and `value()` for functional operations.
- Introduced `InvalidUriException`:
- Custom exception for invalid URI component combinations.
- Integrated as part of the URI validation process.
- Added `KnownScheme` enum:
- Enumerates standard URI schemes (e.g., `http`, `ftp`, `mailto`).
- Facilitates standardization and type safety for schemes.
- **Rationale**:
- Establishes a robust foundation for URI handling in the FireHub Project.
- Aligns with the modular and type-safe architectural principles of the ecosystem.
- Enables seamless integration and processing of normalized, validated URI references.
- **Changes**: - Replaced inheritance of `ValueObject` with `BaseUri` in `Foundation\Uri`. - Adjusted namespace import to reflect `Uri` as `BaseUri`. - **Rationale**: - Aligns `Uri` class with the core `BaseUri` structure for consistency and better integration. - Simplifies future enhancements by unifying foundational URI behavior under `BaseUri`.
- **New Features**:
- Introduced `Percent` class in `Foundation\Uri\Encoding` for percent-encoding and decoding based on RFC 3986:
- Added methods: `encodePath()`, `encodeQuery()`, `encodeFragment()`, `encodeUserInfo()`, and `decode()`.
- Ensures safe handling of all URI components with disallowed bytes percent-encoded.
- **Updates**:
- Extended `Query`, `Path`, `UserInfo`, and `Fragment` components:
- Added `fromDecoded()` and `decoded()` methods to simplify encoding from raw strings and decoding back to raw values.
- Utilized `Percent` class for encoding/decoding logic.
- **Rationale**:
- Improves URI component handling with robust percent-encoding and decoding.
- Enhances usability by abstracting encoding logic into a dedicated utility class, making component APIs cleaner and more consistent.
- **New Features**:
- Added `Authority::parse` method:
- Parses user info, host, and optional port from a URI authority string.
- Validates URI authorities according to RFC 3986, including IPv6 literals and port ranges.
- Introduced `Uri::parse` method:
- Parses absolute and relative URI references.
- Validates components (scheme, authority, path, query, fragment) with detailed checks for compliance.
- Preserves original representations of URI components, such as percent-encoded sequences.
- **Updates**:
- Included `parsePort` as a utility for strict port validation in `Authority`.
- Enhanced error handling with appropriate exceptions for invalid URIs.
- **Rationale**:
- Establishes core URI parsing capabilities, enabling seamless handling of structured and validated URI references.
- Ensures strict adherence to RFC 3986 while improving ease of integration for URI components.
…coding methods - **Changes**: - Replaced `Percent::encodeQuery()` with `Percent::encodeUserInfo()` in `UserInfo::fromDecoded()` for accurate encoding of user info. - Updated `Fragment::fromDecoded()` to use `Percent::encodeFragment()` instead of `Percent::encodeQuery()`. - **Rationale**: - Ensures the correct encoding methods are used for each URI component, adhering to RFC 3986 specifications. - Improves clarity and consistency in the encoding logic for user info and fragment components.
…ation
- **New Features**:
- Introduced `normalized()` methods for URI components (`Query`, `Path`, `UserInfo`, `Fragment`, `Host`):
- Normalizes percent-encoded sequences for compatibility with RFC 3986.
- Preserves original logical structure (e.g., query parameter order, path segments).
- Added `Uri::normalize()` method for complete URI normalization:
- Applies component-level normalization (`Scheme`, `Authority`, `Path`, `Query`, `Fragment`, `Host`).
- Integrates dot-segment removal for paths.
- Removes default ports for supported schemes.
- **Enhancements**:
- Refactored `Host` normalization to utilize `Percent::normalize()` for consistent percent-encoding handling.
- Added `Path::removeDotSegments()` to handle relative and absolute path normalization per RFC 3986 Section 5.2.4.
- **Rationale**:
- Standardizes normalization logic across all URI components.
- Ensures adherence to URI standards, improving reliability and interoperability of parsed and normalized URI references.
- Enhances code clarity and maintainability by consolidating normalization logic into reusable methods.
- **New Features**: - Introduced `withHost()`, `withPort()`, and `withUserInfo()` in `Authority` to enable immutability-preserving updates to host, port, and user info. - Added `withScheme()`, `withAuthority()`, `withPath()`, `withQuery()`, and `withFragment()` in `Uri` to allow similar updates for URI components. - **Details**: - Each method creates a new immutable instance with the specified updated component while preserving other values. - Includes strict type annotations to ensure consistency across components. - PHPDoc comments and exceptions provided for clarity and enhanced error handling. - **Rationale**: - Improves flexibility of `Uri` and `Authority` classes by supporting the construction of updated variants without mutating existing instances. - Aligns with the project's focus on immutability, type safety, and compliance with URI standards.
- **New Features**: - Introduced `withoutPort()` and `withoutUserInfo()` in `Authority` to enable removal of port and user info while preserving immutability. - Added `withoutScheme()`, `withoutAuthority()`, `withoutQuery()`, and `withoutFragment()` in `Uri` for creating new URI instances without these components. - **Details**: - Each method creates a new immutable instance by omitting the specified component and preserving other values. - Includes comprehensive PHPDoc comments and exception handling for clarity and proper usage. - **Rationale**: - Enhances flexibility of `Uri` and `Authority` classes by supporting the removal of specific components immutably. - Aligns with the project's principles of immutability, type safety, and adherence to URI standards.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔖 Release Pull Request
Version
v0.120Related Branches
Description
Create URI
Release Overview
Pre-release Verification
Testing & Validation
System Validation
Release Readiness
Versioning
Semantic Versioning compliance:
Tagging:
v0.2.0will be createdDeployment
Target environment:
Deployment notes:
Checklist
CHANGELOG.mdupdatedREADME.mdupdated (if needed)Risks / Impact
Potential Risks
Breaking changes:
Deployment risks:
Rollback considerations:
Notes
Release Notes
Deployment Instructions
Known Issues