Conversation
gwillz
force-pushed
the
feat/php8
branch
2 times, most recently
from
July 17, 2026 03:56
9c8cf88 to
c7b23df
Compare
gwillz
marked this pull request as ready for review
July 17, 2026 03:57
There was a problem hiding this comment.
Pull request overview
This PR modernizes the karmabunny/kb PHP utility library for PHP 8.2+ by adding strict typing throughout and removing legacy PHP-version conditionals, alongside updating the karmabunny/interfaces dependency to an unreleased v2 dev branch.
Changes:
- Add
declare(strict_types=1)and apply stronger return/parameter/property types across the codebase. - Remove PHP version checks / compatibility shims now that the minimum runtime is PHP 8.2.
- Update tooling/dependencies (Composer + PHPStan + PHPCS) and adjust event tests for the updated Events API.
Reviewed changes
Copilot reviewed 91 out of 92 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Bumps PHP requirement to ^8.2 and pins karmabunny/interfaces to a dev branch |
| composer.lock | Updates lockfile for PHP 8.2 platform/dependency changes |
| phpcs.xml | Updates PHPCompatibility testVersion to 8.2- |
| phpstan.neon | Updates analyzed PHP version range to 8.2–8.5 |
| src/ArrayAccessTrait.php | Adds PHP 8-compatible ArrayAccess method signatures |
| src/Arrays.php | Adds strict types and improves typing across array helpers |
| src/AttributeTag.php | Adds strict types and removes pre-PHP8 attribute handling |
| src/BaseRule.php | Adds typed properties/method signatures for validation rules |
| src/Buffer.php | Adds strict types and return types for buffer helpers |
| src/CallbackRule.php | Adds typing for callback-based validation rule |
| src/CachedHelperTrait.php | Adds return types to cache helper methods |
| src/Cli.php | Adds strict types and return/param types for CLI helpers |
| src/Collection.php | Removes Serializable and adds typed JsonSerializable implementation |
| src/Config.php | Adds strict types and stronger method/property types |
| src/Configure.php | Adds strict types and stronger typing for configuration factory |
| src/ConfigureTrait.php | Adds return type to configure helper |
| src/CountryNames.php | Adds return types to country code/name lookups |
| src/CountryZones.php | Adds types to timezone lookup helper |
| src/CsvExport.php | Removes PHP version branching and uses PHP 8.2+ fputcsv signature |
| src/CsvImport.php | Adds typed properties and return types to CSV importer |
| src/DataObject.php | Tightens constructor type to iterable |
| src/DirtyChecksums.php | Adds typed properties and method return types |
| src/DocType.php | Adds typed properties and tightens doc type parsing return type |
| src/DocValidator.php | Switches to ValidatorInterface and adds stronger typing |
| src/DocValidatorTrait.php | Adds ValidatesInterface mixin note and typed validate/valid |
| src/Enc.php | Adds return types and hardens helpers against null regex returns |
| src/Encrypt.php | Adds typed config property |
| src/Env.php | Adds typed statics and return type for get() |
| src/Event.php | Adds typed properties for sender/handled |
| src/EventableTrait.php | Adds typed signatures for on/off wrappers |
| src/Events.php | Adds strict types, typed storage, and typed on/trigger/off APIs |
| src/Generate.php | Adds typed properties and method signatures to generator |
| src/HttpStatus.php | Adds more specific STRINGS array doc typing |
| src/Inflector.php | Adds typed properties and method signatures |
| src/Job.php | Adds typed properties, constructor options, and typed execute() |
| src/Json.php | Adds strict types and switches to JSON_THROW_ON_ERROR defaults |
| src/Log.php | Adds stronger types and updates logger/filter signatures |
| src/LoggerTrait.php | Adds typed signatures for logger management |
| src/PropertiesTrait.php | Removes legacy PHP checks and uses ReflectionNamedType |
| src/Reflect.php | Adds strict types and simplifies reflection logic for PHP 8.2+ |
| src/RulesClassValidator.php | Adds typing across rule-based class validator |
| src/RulesStaticValidator.php | Adds typed properties and method signatures |
| src/RulesValidatorTrait.php | Adds ValidatesInterface mixin note and typed validate/valid |
| src/Security.php | Adds parameter/return types for security helpers |
| src/Secrets.php | Adds typed properties and method signatures |
| src/SerializeTrait.php | Drops legacy Serializable wrappers and types __unserialize |
| src/Shell.php | Adds typed signatures for shell helpers |
| src/ShellOptions.php | Adds typed properties and typed parse()/descriptor handling |
| src/ShellOutput.php | Adds typed properties and adjusts read loop logic |
| src/SortFieldsTrait.php | Adds SortableInterface mixin note and typed compare signature |
| src/Text.php | Makes static config fields typed and tightens method signatures |
| src/Time.php | Tightens types, deprecates legacy wrappers, updates generators |
| src/TimeZones.php | Adds typed static map cache |
| src/ToJsonTrait.php | Implements typed JsonSerializable return |
| src/UpdateStrictTrait.php | Types update() as iterable and adds ConfigurableInterface mixin note |
| src/UpdateTidyTrait.php | Types update() as iterable and adds ConfigurableInterface mixin note |
| src/UpdateTrait.php | Types update() as iterable and adds ConfigurableInterface mixin note |
| src/Url.php | Adds typed URL parts and updates query handling signatures |
| src/UrlDecodeException.php | Adds typed property and typed fluent setter |
| src/Uuid.php | Tightens parameter/return types for UUID helpers |
| src/ValidErrorsTrait.php | Adds ValidatesInterface mixin note and types validate() |
| src/Validity.php | Adds mixed-accepting validation APIs and tightens signatures |
| src/ValidationException.php | Types errors property and fluent addErrors() return |
| src/VirtualArrayTrait.php | Removes ReturnTypeWillChange and applies proper ArrayAccess signatures |
| src/VirtualMethodsTrait.php | Tightens __get signature for PHP 8+ |
| src/Wrap.php | Adds @deprecated note and tightens return types |
| src/XML.php | Adds strict types, removes PHP version checks, and tightens signatures |
| src/XMLException.php | Types libxml error list property |
| src/rules/AllInArrayRule.php | Types allowed list and method signatures |
| src/rules/AllMatchRule.php | Types validate() signature |
| src/rules/AllUniqueRule.php | Types validate() signature |
| src/rules/BinaryRule.php | Types validateOne() signature |
| src/rules/DateRangeRule.php | Types rule config properties and validate() signature |
| src/rules/EmailRule.php | Types validateOne() signature |
| src/rules/InArrayRule.php | Types allowed list and validateOne() signature |
| src/rules/Ipv4AddrOrCidrRule.php | Types validateOne() signature |
| src/rules/Ipv4AddrRule.php | Types validateOne() signature |
| src/rules/Ipv4CidrRule.php | Types validateOne() signature |
| src/rules/LengthRule.php | Types min/max properties and validateOne() signature |
| src/rules/MysqlDateRule.php | Types validateOne() signature |
| src/rules/MysqlDateTimeRule.php | Types validateOne() signature |
| src/rules/MysqlTimeRule.php | Types validateOne() signature |
| src/rules/NumericRule.php | Types validateOne() signature |
| src/rules/OneRequiredRule.php | Types group property, parse(), and validate() signature |
| src/rules/PasswordRule.php | Types digits property and validateOne() signature |
| src/rules/PhoneRule.php | Types digits property and validateOne() signature |
| src/rules/PositiveIntRule.php | Types validateOne() signature |
| src/rules/ProseTextRule.php | Types validateOne() signature |
| src/rules/RangeRule.php | Types min/max properties and validateOne() signature |
| src/rules/RegexRule.php | Types pattern property, parse(), and validateOne() signature |
| src/rules/RequiredRule.php | Types validate() signature |
| tests/EventTest.php | Updates tests to use named append: arg for Events::on() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Callable guarantees two elements for an array.
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.
Strong types and removal of PHP version checks.
Requires unreleased v2 of
karmabunny/interfaces. Respective PR is here: Karmabunny/kbinterfaces#1