-
Notifications
You must be signed in to change notification settings - Fork 4
Update #15
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
Update #15
Changes from all commits
29978d7
7ef80d4
00d3fcb
fa35f67
ab71390
20fc451
aceca21
c5e02a2
f4bd3af
8e4bc6d
e8a910b
7abc92d
648abd1
3aad116
2b70fb9
f0501c3
8d7ad9c
251faa4
afe6b54
ca08bc8
9283f1a
c3c66e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,4 +20,5 @@ yarn-error.log | |
| vendor | ||
| vendor/ | ||
| composer.lock | ||
| todo.txt | ||
| todo.txt | ||
| /build/** | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| <?php | ||
|
|
||
| namespace PHPSTORM_META { | ||
|
|
||
| // Helper functions for PHP Datatypes | ||
| override(\int8(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Signed\Int8::class, | ||
| ])); | ||
|
|
||
| override(\int16(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Signed\Int16::class, | ||
| ])); | ||
|
|
||
| override(\int32(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Signed\Int32::class, | ||
| ])); | ||
|
|
||
| override(\int64(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Signed\Int64::class, | ||
| ])); | ||
|
|
||
| override(\uint8(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Unsigned\UInt8::class, | ||
| ])); | ||
|
|
||
| override(\uint16(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Unsigned\UInt16::class, | ||
| ])); | ||
|
|
||
| override(\uint32(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Unsigned\UInt32::class, | ||
| ])); | ||
|
|
||
| override(\uint64(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Integers\Unsigned\UInt64::class, | ||
| ])); | ||
|
|
||
| override(\float32(0.0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\FloatingPoints\Float32::class, | ||
| ])); | ||
|
|
||
| override(\float64(0.0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\FloatingPoints\Float64::class, | ||
| ])); | ||
|
|
||
| override(\char(''), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Char::class, | ||
| ])); | ||
|
|
||
| override(\byte(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Scalar\Byte::class, | ||
| ])); | ||
|
Comment on lines
+6
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that the The override mappings for scalar type helpers follow the correct pattern. However, the Run the following script to verify the 🏁 Script executed: #!/bin/bash
# Description: Check for uint64 helper function definition
# Search for uint64 function definition
rg -nP '^\s*function\s+uint64\s*\(' src/helpers.phpLength of output: 0 🏁 Script executed: #!/bin/bash
# Description: Broader search for uint64 function definition across entire codebase
# Search for uint64 function definition anywhere in the codebase
rg -nP 'function\s+uint64\s*\(' --type=php
# Also check if it's defined as part of namespace or differently
rg -nP '\buint64\s*\(' --type=php -A 2 -B 2 | head -50Length of output: 233 🏁 Script executed: #!/bin/bash
# Description: Verify that other scalar helpers exist to confirm uint64 is missing
# Search for int64 and uint32 helper definitions
rg -nP 'function\s+(int64|uint32|char|byte)\s*\(' --type=php -A 3Length of output: 667 The Verification confirms that other scalar helpers (int64 at line 70, uint32 at line 118, char at line 149, byte at line 156) are properly defined in Either remove the uint64 override from |
||
|
|
||
| override(\some(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Option::class, | ||
| ])); | ||
|
|
||
| override(\none(), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Option::class, | ||
| ])); | ||
|
|
||
| override(\option(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Option::class, | ||
| ])); | ||
|
|
||
| override(\ok(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Result::class, | ||
| ])); | ||
|
|
||
| override(\err(0), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Result::class, | ||
| ])); | ||
|
|
||
| override(\result(function(){}), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Result::class, | ||
| ])); | ||
|
|
||
| override(\stringArray([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Arrays\StringArray::class, | ||
| ])); | ||
|
|
||
| override(\intArray([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Arrays\IntArray::class, | ||
| ])); | ||
|
|
||
| override(\floatArray([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Arrays\FloatArray::class, | ||
| ])); | ||
|
|
||
| override(\byteSlice([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Arrays\ByteSlice::class, | ||
| ])); | ||
|
|
||
| override(\listData([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\ListData::class, | ||
| ])); | ||
|
|
||
| override(\dictionary([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Dictionary::class, | ||
| ])); | ||
|
|
||
| override(\struct([]), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Struct\Struct::class, | ||
| ])); | ||
|
|
||
| override(\union([], []), map([ | ||
| '' => \Nejcc\PhpDatatypes\Composite\Union\UnionType::class, | ||
| ])); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,77 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to `php-datatypes` will be documented in this file | ||
| All notable changes to `php-datatypes` will be documented in this file. | ||
|
|
||
| ## 1.0.0 - 201X-XX-XX | ||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| - initial release | ||
| ## [2.0.0] - 2024-12-19 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verify the release date. The changelog lists the release date as "2024-12-19", but this PR was created on 2025-05-30. Ensure the date reflects the actual or intended release date for v2.0.0. 🤖 Prompt for AI Agents |
||
|
|
||
| ### Added | ||
| - PHP 8.4 compatibility and CI testing | ||
| - PHPStan static analysis configuration (level 9) | ||
| - `Dictionary::toArray()`, `isEmpty()`, and `getAll()` methods | ||
| - Benchmark suite for performance testing | ||
| - `Option<T>` type for nullable values | ||
| - `Result<T, E>` type for error handling | ||
| - Mutation testing with Infection | ||
| - Laravel integration (validation rules, service provider) | ||
| - PHPStorm metadata for better IDE support | ||
| - Comprehensive example demonstrating all features | ||
|
|
||
| ### Changed | ||
| - **BREAKING:** All concrete datatype classes are now `final` to prevent inheritance issues | ||
| - **BREAKING:** All methods now have explicit return types for better type safety | ||
| - **BREAKING:** All Laravel validation rules and casts are now `final` | ||
| - Updated minimum PHP version requirement to ^8.4 | ||
| - Enhanced CI workflow to test PHP 8.4 | ||
| - Improved code quality with static analysis | ||
| - Enhanced parameter type declarations throughout the codebase | ||
|
|
||
| ### Fixed | ||
| - Missing serialization methods in Dictionary class | ||
| - Missing return types in various methods | ||
| - Parameter type declarations for better type safety | ||
|
|
||
| ### Migration Guide | ||
|
|
||
| If you were extending any datatype classes, you'll need to use composition instead: | ||
|
|
||
| **Before (v1.x):** | ||
| ```php | ||
| class MyCustomInt8 extends Int8 { | ||
| // custom implementation | ||
| } | ||
| ``` | ||
|
|
||
| **After (v2.0):** | ||
| ```php | ||
| class MyCustomInt8 { | ||
| private Int8 $int8; | ||
|
|
||
| public function __construct(int $value) { | ||
| $this->int8 = new Int8($value); | ||
| } | ||
|
|
||
| public function getValue(): int { | ||
| return $this->int8->getValue(); | ||
| } | ||
|
|
||
| // delegate other methods as needed | ||
| } | ||
| ``` | ||
|
|
||
| ## [1.0.0] - 2024-12-19 | ||
|
|
||
| ### Added | ||
| - Initial release with comprehensive type system | ||
| - Scalar types: Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128 | ||
| - Floating point types: Float32, Float64 | ||
| - Boolean, Char, and Byte types | ||
| - Composite types: Arrays, Structs, Unions, Lists, Dictionaries | ||
| - String types: AsciiString, Utf8String, EmailString, and 20+ specialized string types | ||
| - Vector types: Vec2, Vec3, Vec4 | ||
| - Serialization support: JSON, XML, Binary | ||
| - Comprehensive test suite (592 tests, 1042 assertions) | ||
| - Helper functions for all types | ||
| - Type-safe operations with overflow/underflow protection | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align CI matrix with PHP ^8.4 requirement to fix Composer failures.
Current matrix includes 8.2/8.3, but composer.json requires php ^8.4; jobs on 8.2/8.3 fail early.
Recommended diff:
Optional (reduce dependency conflicts on prefer-lowest):
📝 Committable suggestion
🤖 Prompt for AI Agents