Skip to content

v1.4.0

Choose a tag to compare

@mostafasoufi mostafasoufi released this 11 Sep 08:45
· 4 commits to main since this release

Added

  • PHP cross-version compatibility fixing via extra.wp-scoper.php_compat: true (default false): opt-in pass that rewrites implicitly-nullable parameters (Type $x = null) in scoped dependency code to the explicit form (?Type $x = null, and A|B $x = null → A|B|null $x = null). PHP 8.4 deprecates the implicit form, so dependencies pinned for an older PHP floor (e.g. thecodingmachine/safe kept for PHP 8.0 support) otherwise flood PHP 8.4/8.5 runtimes with E_DEPRECATED notices. The rewrite is behaviour-identical and valid on any PHP ≥ 7.1. The target PHP floor is auto-detected from the host composer.json (config.platform.php preferred, require.php fallback) — no hardcoded version — and gates the fixer so rewritten syntax stays valid for the declared minimum. Skips already-nullable types, mixed, unions already containing null, intersection types, untyped params, and non-null defaults. Applied to copied dependency files only — the host project's own source is never rewritten. New NullableParamReplacer; new Config API: isPhpCompatEnabled(), getTargetPhpFloor(), targetPhpAtLeast(), parsePhpFloor(), and a new optional $phpConstraint parameter on Config::fromArray(). Existing configs without php_compat are unaffected.