Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "Undefined Property" solution #264

Merged
merged 2 commits into from Jul 13, 2020
Merged

Added "Undefined Property" solution #264

merged 2 commits into from Jul 13, 2020

Conversation

musa11971
Copy link
Contributor

This solution provides the developer with a suggested object property name, if a similar one is found. This is useful in the case of a typo.
You could compare this solution to UndefinedVariableSolutionProvider, but for object properties.

Example

Consider the following class:

class Car 
{
	public $name;
}

Scenarios:

Code Solution triggered? Description
$car->na ❌ No -
$car->nam ✅ Yes Did you mean App\Car::$name ?
$car->name ❌ No -
$car->namee ✅ Yes Did you mean App\Car::$name ?
$car->nameee ✅ Yes Did you mean App\Car::$name ?
$car->nameeee ❌ No -
$car->something ❌ No -

Screenshot

Testing

./vendor/bin/phpunit --filter=UndefinedPropertySolutionProvider

This solution currently provides the developer with suggested property names, if a similar property is found.

For example "$user->nam" would get corrected to "$user->name"
@freekmurze freekmurze merged commit 0f96846 into facade:master Jul 13, 2020
@freekmurze
Copy link
Collaborator

Thank you!

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