-
Notifications
You must be signed in to change notification settings - Fork 29
Description
We've come upon an issue (at least with the Stripe PHP SDK) where use
references within a class are not replaced properly during reprefixing
Reproduction Steps
With this composer.json file:
{
"name": "thoams/stripe-strauss",
"autoload": {
"psr-4": {
"Thoams\\StripeStrauss\\": "src/"
}
},
"require-dev": {
"brianhenryie/strauss": "^0.22.2"
},
"require": {
"stripe/stripe-php": "^17.1"
},
"scripts": {
"prefix-namespaces": [
"strauss",
"@php composer dump-autoload"
],
"post-install-cmd": [
"@prefix-namespaces"
],
"post-update-cmd": [
"@prefix-namespaces"
]
}
}
- Run
composer run prefix-namespaces
- Open
vendor-prefixed/stripe/stripe-php/Billing/CreditGrant.php
- Observe that the line incorrectly replaced:
Updated:
use \\Thoams\\StripeStrauss\\Stripe\ApiOperations\Update;
Elsewhere in the file the replacement works correctly, however.
There's other instances of this throughout the reprefixed stripe lib.
Another dev on my team working on this rolled back to 0.20.1 and this issue does not occur on this version (I didn't actually test it, but I trust his word) but we can't use that version due to issues with JsonWrapper (JsonMapper/JsonMapper#195) that was addressed in 0.22.1
He was wrong. The issue started with 0.22.0
I've run out of time today to try to figure out the exact cause of the issue or I'd open a PR to try to address it. I picked through the code a bit but I couldn't pinpoint it.
Thanks for your effort on this project, we're big fans