<?php

/**
 * Execute arbitrary PHP code.
 *
 * ## EXAMPLES
 *
 *     # Display WordPress content directory.
 *     $ wp eval 'echo WP_CONTENT_DIR;'
 *     /var/www/wordpress/wp-content
 *
 *     # Generate a random number.
 *     $ wp eval 'echo rand();' --skip-wordpress
 *     479620423
 */
class Eval_Command extends WP_CLI_Command {

	/**
	 * Execute arbitrary PHP code.
	 *
	 * ## OPTIONS
	 *
	 * <php-code>
	 * : The code to execute, as a string.
	 *
	 * [--skip-wordpress]
	 * : Execute code without loading WordPress.
	 *
	 * ## EXAMPLES
	 *
	 *     # Display WordPress content directory.
	 *     $ wp eval 'echo WP_CONTENT_DIR;'
	 *     /var/www/wordpress/wp-content
	 *
	 *     # Generate a random number.
	 *     $ wp eval 'echo rand();' --skip-wordpress
	 *     479620423
	 *
	 * @when before_wp_load
	 */
	public function __invoke( $args, $assoc_args ) {

		if ( null === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-wordpress' ) ) {
			WP_CLI::get_runner()->load_wordpress();
		}

		eval( $args[0] );
	}
}

WP_CLI::add_command( 'eval', 'Eval_Command' );

<?php

class Eval_Command extends WP_CLI_Command {

	/**
	 * Execute arbitrary PHP code.
	 *
	 * ## OPTIONS
	 *
	 * <php-code>
	 * : The code to execute, as a string.
	 *
	 * [--skip-wordpress]
	 * : Execute code without loading WordPress.
	 *
	 * @when before_wp_load
	 *
	 * ## EXAMPLES
	 *
	 *     $ wp eval 'echo WP_CONTENT_DIR;'
	 *     /var/www/wordpress/wp-content
	 *
	 *     $ wp eval 'echo rand();' --skip-wordpress
	 *     479620423
	 */
	public function __invoke( $args, $assoc_args ) {

		if ( null === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-wordpress' ) ) {
			WP_CLI::get_runner()->load_wordpress();
		}

		eval( $args[0] );
	}
}

WP_CLI::add_command( 'eval', 'Eval_Command' );


--- 
+++ 
@@ -1,5 +1,18 @@
 <?php
 
+/**
+ * Execute arbitrary PHP code.
+ *
+ * ## EXAMPLES
+ *
+ *     # Display WordPress content directory.
+ *     $ wp eval 'echo WP_CONTENT_DIR;'
+ *     /var/www/wordpress/wp-content
+ *
+ *     # Generate a random number.
+ *     $ wp eval 'echo rand();' --skip-wordpress
+ *     479620423
+ */
 class Eval_Command extends WP_CLI_Command {
 
 	/**
@@ -13,15 +26,17 @@
 	 * [--skip-wordpress]
 	 * : Execute code without loading WordPress.
 	 *
-	 * @when before_wp_load
-	 *
 	 * ## EXAMPLES
 	 *
+	 *     # Display WordPress content directory.
 	 *     $ wp eval 'echo WP_CONTENT_DIR;'
 	 *     /var/www/wordpress/wp-content
 	 *
+	 *     # Generate a random number.
 	 *     $ wp eval 'echo rand();' --skip-wordpress
 	 *     479620423
+	 *
+	 * @when before_wp_load
 	 */
 	public function __invoke( $args, $assoc_args ) {
 
@@ -34,4 +49,3 @@
 }
 
 WP_CLI::add_command( 'eval', 'Eval_Command' );
-
Add example in Eval class
