Skip to content

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 14, 2021

Currently rector got error :

PHP Fatal error:  Uncaught Error: Call to undefined method ReflectionProperty::getDefaultValue() in /home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/packages/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php:168

Fatal error: Uncaught Error: Call to undefined method ReflectionProperty::getDefaultValue() in /home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/packages/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php:168

When running on php 7.x

This PR try to fix it based on phpmanual comment https://www.php.net/manual/en/reflectionproperty.getdefaultvalue.php#126007

Note: New rector rule is needed for it.

Fixes rectorphp/rector#6869

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba
Copy link
Member

Thanks for the fix.

We should have a downgrade Rector rule, that handles this. It's valid syntax on PHP 8.1.

@samsonasik
Copy link
Member Author

I will create separate PR for that, this PR is a temporary fix so we can have the fixed code early in the scoped version.

@TomasVotruba TomasVotruba merged commit 9983200 into main Dec 14, 2021
@TomasVotruba TomasVotruba deleted the fix-undefined-reflectionproperty-getdefaultvalue branch December 14, 2021 08:14
@TomasVotruba
Copy link
Member

Ok, let's merge temporary fix then. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call to undefined method ReflectionProperty::getDefaultValue() on php 7.x
2 participants