Skip to content

fix(flow-php/types): re-narrow assert() and cast() return - #2588

Merged
norberttech merged 1 commit into
1.xfrom
flow-type-cast-assert-narrow-bug
Aug 7, 2026
Merged

fix(flow-php/types): re-narrow assert() and cast() return#2588
norberttech merged 1 commit into
1.xfrom
flow-type-cast-assert-narrow-bug

Conversation

@norberttech

Copy link
Copy Markdown
Member

Change Log


Added

  • flow-php/types - static analysis fixture pinning the narrowed type of every type_*() through assert(), cast() and isValid()

Fixed

  • flow-php/types - NonEmptyStringType and PositiveIntegerType erased their narrow type on assert() and cast()
  • flow-php/types - UuidType::cast(), UnionType::cast() and IntersectionType::cast() resolved to mixed
  • flow-php/types - EnumType::cast() resolved to UnitEnum instead of the enum class

Changed

  • flow-php/types - assertion tags dropped the @phpstan- prefix
  • flow-php/types - architecture docs record why every implementation keeps its @template and restates @return

Removed

Deprecated

Security

- restate @return on the six methods that erased it
- rebind T in EnumType::cast() through assert()
- pin all 34 types with a static-analysis fixture
- drop @phpstan- prefix from assertion tags
- document why every Type keeps its @template
@norberttech norberttech added this to the 0.43.0 milestone Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.34%. Comparing base (bc5d672) to head (d591a4f).
⚠️ Report is 2 commits behind head on 1.x.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##                1.x    #2588   +/-   ##
=========================================
  Coverage     86.34%   86.34%           
  Complexity    23756    23756           
=========================================
  Files          1823     1823           
  Lines         72026    72026           
=========================================
  Hits          62188    62188           
  Misses         9838     9838           
Components Coverage Δ
etl 90.87% <ø> (ø)
cli 89.40% <ø> (ø)
lib-array-dot 81.44% <ø> (ø)
lib-azure-sdk 64.44% <ø> (ø)
lib-doctrine-dbal-bulk 93.61% <ø> (ø)
lib-filesystem 86.67% <ø> (ø)
lib-types 91.73% <100.00%> (ø)
lib-parquet 70.23% <ø> (ø)
lib-parquet-viewer 82.26% <ø> (ø)
lib-snappy 89.82% <ø> (ø)
lib-dremel 0.00% <ø> (ø)
lib-postgresql 87.74% <ø> (ø)
lib-telemetry 86.64% <ø> (ø)
bridge-filesystem-async-aws 92.74% <ø> (ø)
bridge-filesystem-azure 90.45% <ø> (ø)
bridge-monolog-http 96.82% <ø> (ø)
bridge-monolog-telemetry 94.79% <ø> (ø)
bridge-openapi-specification 92.07% <ø> (ø)
symfony-http-foundation 78.57% <ø> (ø)
bridge-psr18-telemetry 100.00% <ø> (ø)
bridge-psr3-telemetry 98.95% <ø> (ø)
bridge-psr7-telemetry 100.00% <ø> (ø)
bridge-telemetry-otlp 90.11% <ø> (ø)
bridge-symfony-http-foundation-telemetry 92.85% <ø> (ø)
bridge-symfony-filesystem-bundle 91.85% <ø> (ø)
bridge-symfony-filesystem-cache 98.18% <ø> (ø)
bridge-symfony-postgresql-bundle 93.57% <ø> (ø)
bridge-symfony-postgresql-cache 94.41% <ø> (ø)
bridge-symfony-postgresql-messenger 98.80% <ø> (ø)
bridge-symfony-postgresql-session 93.65% <ø> (ø)
bridge-symfony-telemetry-bundle 90.72% <ø> (ø)
adapter-chartjs 84.05% <ø> (ø)
adapter-csv 89.46% <ø> (ø)
adapter-doctrine 90.75% <ø> (ø)
adapter-google-sheet 91.56% <ø> (ø)
adapter-http 75.79% <ø> (ø)
adapter-json 87.66% <ø> (ø)
adapter-logger 50.00% <ø> (ø)
adapter-parquet 88.85% <ø> (ø)
adapter-text 92.59% <ø> (ø)
adapter-xml 84.45% <ø> (ø)
adapter-avro 0.00% <ø> (ø)
adapter-excel 87.20% <ø> (ø)
adapter-postgresql 90.84% <ø> (ø)
adapter-seal 83.61% <ø> (ø)
bridge-phpunit-postgresql 75.30% <ø> (ø)
bridge-phpunit-telemetry 87.36% <ø> (ø)
bridge-phpstan-types 0.00% <ø> (ø)
bridge-postgresql-valinor 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@norberttech
norberttech merged commit 90a5731 into 1.x Aug 7, 2026
48 checks passed
@norberttech
norberttech deleted the flow-type-cast-assert-narrow-bug branch August 7, 2026 17:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant