-
Notifications
You must be signed in to change notification settings - Fork 23
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
Not prefixing all classes? #50
Comments
The CSF_Metabox class is not present in your library. Strauss scans the files in the library, decides what the updated name should be (prefix+original), then makes those replacements. In this case, CSF_Metabox was never seen, so its class is not being prefixed, so references to it don't get updated. If you have CSF_Metabox in a second library and both are included in your project, the reference should be updated correctly. |
@BrianHenryIE ah, got it. Thanks for explaining. It's great to get strauss working finally. Looking forward to use it more in future projects. |
@BrianHenryIE, I'm running into a similar issue when I try to use Strauss with the stripe-php library (https://github.com/stripe/stripe-php) Basically, Strauss is not changing the classes in the My special config:
An example of the problem: Original file: Strauss changes: public static function all($params = null, $opts = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \NewPrefix\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof \Stripe\Collection)) {
throw new \NewPrefix\Stripe\Exception\UnexpectedValueException(
'Expected type ' . \NewPrefix\Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);
return $obj;
} So, Strauss changed the class in the message but did not change the conditional above. Any ideas? Thank you! |
Hi Brian,
I spent sometime tonight figuring out how to make this work, including setting up a composer package at https://packagist.org/packages/qriouslad/codestar-framework for the library I needed to prefix.
I've successfully executed the strauss script via composer to prefix that package, however, I noticed not all classes are properly prefixed.
For example, in setup.class.php, while
if ( class_exists( 'CSF_Options' ))
is successfully prefixed intoif ( class_exists( 'Prefix_CSF_Options' ))
, theif (class_exists( 'CSF_Metabox' ))
part remains the same, not getting prefixed, as well as other classes in that file.Since this library is not using namespaces yet, I needed to use this in the package composer.json:
"autoload": { "classmap": ["src/"] },
...where the library files are inside the /src/ folder. Could this be a method that is not yet fully supported by strauss?
The text was updated successfully, but these errors were encountered: