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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate non-bundled install; generate against current WP-CLI instance. #207

Merged
merged 4 commits into from Feb 19, 2018
Merged
Diff settings

Always

Just for now

Prev

Sigh, undo previous "Simplify callable check" as doesn't work.

  • Loading branch information...
gitlost committed Feb 9, 2018
commit f760f71b11720fe1220617f5fafe8238ff136fff
Copy path View file
@@ -178,16 +178,24 @@ private static function update_commands_data( $command, &$commands_data, $full )
$repo_url = 'https://github.com/wp-cli/wp-cli';
}
if ( $reflection->hasProperty( 'when_invoked' ) ) {
// See `CommandFactory::create_subcommand()`.
$filename = '';
$when_invoked = $reflection->getProperty( 'when_invoked' );
$when_invoked->setAccessible( true );
$closure = $when_invoked->getValue( $command );
$closure_reflection = new \ReflectionFunction( $closure );
// PHP stores use clause arguments of closures as static variables internally - see https://bugs.php.net/bug.php?id=71250
$static = $closure_reflection->getStaticVariables();
if ( is_array( $static ) && isset( $static['callable'] ) && is_callable( $static['callable'] ) ) {
$reflection_func = new \ReflectionFunction( $static['callable'] );
$filename = $reflection_func->getFileName();
if ( is_array( $static ) && isset( $static['callable'] ) ) {
// See `CommandFactory::create_subcommand()`.
if ( is_array( $static['callable'] ) && isset( $static['callable'][0] ) ) {
$reflection_class = new \ReflectionClass( $static['callable'][0] );
$filename = $reflection_class->getFileName();
} elseif ( is_callable( $static['callable'] ) ) {
$reflection_func = new \ReflectionFunction( $static['callable'] );
$filename = $reflection_func->getFileName();
}
}
if ( $filename ) {
preg_match( '#vendor/([^/]+/[^/]+)#', $filename, $matches );
if ( ! empty( $matches[1] ) ) {
$repo_url = 'https://github.com/' . $matches[1];
ProTip! Use n and p to navigate between commits in a pull request.
You can鈥檛 perform that action at this time.