When using a whitespace within the CPT name, script generates wrong file name and content.
File name generated: Instagram-posts.php (will not autopload in Composer 2.0)
File contents:
<?php
namespace Juniper\Cpt;
class Instagram - posts {
public string $cpt_slug;
public string $cpt_name;
public function __construct() {
$this->cpt_slug = substr( 'instagram-posts', 0, 20 );
$this->cpt_name = substr( 'Instagram posts', 0, 20 );
add_action( 'init', array( $this, 'register_custom_cpt' ) );
}
class name is wrong.
Also, this is creating another bug within the inc/include.php file:
$juniper_instagram - posts = new \Juniper\Cpt\Instagram() - posts();
Expected behaviour: script should detect whitespaces within the --name param and convert it correctly. Here it should give InstagramPosts.php filename and InstagramPosts class name
When using a whitespace within the CPT name, script generates wrong file name and content.
File name generated:
Instagram-posts.php(will not autopload in Composer 2.0)File contents:
class name is wrong.
Also, this is creating another bug within the
inc/include.phpfile:$juniper_instagram - posts = new \Juniper\Cpt\Instagram() - posts();Expected behaviour: script should detect whitespaces within the
--nameparam and convert it correctly. Here it should giveInstagramPosts.phpfilename andInstagramPostsclass name