braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
545 stars 225 forks source link

Update IsNode.php #320

Open ElonSmithee opened 2 years ago

hollabaq86 commented 2 years ago

👋 @ElonSmithee can we get some context on these changes? Why do we need them? What is the problem that this PR solves? Just trying to get some additional info behind these changes. thanks!

ElonSmithee commented 2 years ago

This object type screams allover IDE trying to pass simple string, It’s redundant to inform that object must be passed and then convert it to string. Let user decide which way data will be converted. Will it be magical _toString, custom toString, simple cast or straight string.

upd. If string not what you wish, add dochints with multiple choices

@params mixed|object|string $var

crookedneighbor commented 2 years ago

@ElonSmithee would this change prevent an IDE from allowing the dev to pass, say, a number and have it automatically be coerced to a string?

ElonSmithee commented 2 years ago

@ElonSmithee would this change prevent an IDE from allowing the dev to pass, say, a number and have it automatically be coerced to a string?

They will notice type inconsistency and will cast it manualy

hollabaq86 commented 2 years ago

for internal use, ticket 2003