Skip to content

Commit 6f71c77

Browse files
committed
fix: Maintain PHP 7.4 compatibility with union types in PHPDoc only
Use union types (string|int|float|bool|null) in PHPDoc for better IDE support and documentation, but keep code compatible with PHP 7.4+ by not using union types in actual code signatures. This provides the best of both worlds: - Compatible with PHP 7.4+ (no breaking changes) - Better IDE autocompletion and type checking - More specific than generic 'mixed' type
1 parent 564f83b commit 6f71c77

3 files changed

Lines changed: 47 additions & 7 deletions

File tree

bin/lib/ConfigLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function readPackagesFromYaml(string $yamlPath, string $section):
7171
* @return string|int|float|bool|null Configuration value or default
7272
* Returns: bool for 'true'/'false', int/float for numbers, string for text, null if not found
7373
*/
74-
public static function readConfigValue(string $yamlPath, string $key, string|int|float|bool|null $default = null): string|int|float|bool|null
74+
public static function readConfigValue(string $yamlPath, string $key, $default = null)
7575
{
7676
if (!file_exists($yamlPath)) {
7777
return $default;

docs/CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [2.0.23] - 2026-01-18
1111

12-
### Fixed
13-
- **PHP 7.4 compatibility**: Removed `mixed` type hint from `ConfigLoader::readConfigValue()` method
14-
- The `mixed` type was introduced in PHP 8.0, but the project supports PHP 7.4+
15-
- Changed to untyped parameter with PHPDoc annotation for backward compatibility
16-
- Fixes test failure on PHP 7.4 CI environment
12+
### Changed
13+
- **Improved type hints**: Updated `ConfigLoader::readConfigValue()` PHPDoc with union types for better type safety
14+
- PHPDoc now uses `string|int|float|bool|null` union types for better IDE support and static analysis
15+
- Code remains compatible with PHP 7.4+ (union types only in PHPDoc, not in code)
16+
- More specific than generic `mixed` type
17+
- Provides better autocompletion and type checking in IDEs
1718

1819
### Added
1920
- **Command-line options configuration in YAML**: All command-line options can now be configured as defaults in `generate-composer-require.yaml`

docs/UPGRADING.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,46 @@ This guide will help you upgrade Composer Update Helper to newer versions.
1818

1919
## Version-Specific Upgrade Notes
2020

21-
### Upgrading to 2.0.22+ (Unreleased)
21+
### Upgrading to 2.0.23+
22+
23+
#### What's New
24+
This release adds command-line options configuration in YAML and extends wildcard dependency checking. See [CHANGELOG.md](CHANGELOG.md#2023) for complete details.
25+
26+
**New Features:**
27+
- **Command-line options configuration in YAML**: Configure default values for all command-line options in `generate-composer-require.yaml`
28+
- Set your preferred defaults once, then override them when needed via command-line arguments
29+
- Available options: `show-release-info`, `show-release-detail`, `show-impact-analysis`, `save-impact-to-file`, `verbose`, `debug`
30+
- Example: Set `show-release-info: true` in YAML to always show release info by default
31+
- Command-line arguments always override YAML configuration
32+
- See [Configuration Guide](docs/CONFIGURATION.md#command-line-options-configuration) for complete details
33+
- **Wildcard Dependency Checking**: Extended dependency conflict detection to support wildcard constraints (`^`, `~`, `*`)
34+
- Previously, dependency checking was skipped for packages with wildcard constraints
35+
- Now properly validates wildcard constraints against dependent package requirements
36+
- Improves conflict detection accuracy for framework constraints and version ranges
37+
38+
**Changed:**
39+
- **Improved type hints**: Better type safety with union types in PHPDoc for `ConfigLoader::readConfigValue()`
40+
- PHPDoc uses `string|int|float|bool|null` union types for better IDE support
41+
- Code remains compatible with PHP 7.4+ (union types only in documentation)
42+
- More specific than generic `mixed` type
43+
44+
#### Migration Notes
45+
- **No action required**: These are new features that enhance existing functionality
46+
- **YAML configuration for command-line options** (optional): You can now set default values for command-line options in your `generate-composer-require.yaml`:
47+
```yaml
48+
# Set defaults for command-line options
49+
show-release-info: true # Always show release info by default
50+
show-impact-analysis: true # Always show impact analysis by default
51+
verbose: false # Don't show verbose output by default
52+
```
53+
- Command-line arguments always override YAML configuration
54+
- Example: If you set `show-release-info: true` in YAML but run `./generate-composer-require.sh --no-release-info`, release info will be disabled for that run
55+
- **Wildcard dependency checking**: Now works automatically for all constraint types (`^`, `~`, `*`). No configuration needed.
56+
57+
#### Breaking Changes
58+
- None
59+
60+
### Upgrading to 2.0.22+
2261

2362
#### What's New
2463
This release adds several new features to help resolve dependency conflicts and provide better guidance when automatic solutions aren't available. See [CHANGELOG.md](CHANGELOG.md#unreleased) for complete details.

0 commit comments

Comments
 (0)