rectorphp / rector

Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
https://getrector.com
MIT License
8.32k stars 670 forks source link

missing native array typehint #8627

Closed staabm closed 3 weeks ago

staabm commented 3 weeks ago

Bug Report

Subject Details
Rector version e.g. v1.0.0 (invoke vendor/bin/rector --version)

Minimal PHP Code Causing Issue

https://getrector.com/demo/45658bf6-99fd-457d-9601-4a9d496c12b3

Expected Behaviour

I wonder why none of the typeDeclaration-rules adds a native array property type for private $exitcodeLabels; in this code

samsonasik commented 3 weeks ago

it may be due re-asign (by ArrayDimFetch) on other method, using only on construct seems add the type hint https://getrector.com/demo/09879ef0-4c66-4b30-b3d1-0d60c5659229

staabm commented 3 weeks ago

ok, let me debug TypedPropertyFromStrictConstructorRector

samsonasik commented 3 weeks ago

I created PR https://github.com/rectorphp/rector-src/pull/5861 already.