Skip to content

Commit

Permalink
Merge pull request #9 from BeAPI/fix-psr4-detection
Browse files Browse the repository at this point in the history
Fix psr4 detection
  • Loading branch information
Rahe authored Sep 15, 2020
2 parents a6de40a + d9ebba6 commit 277aba0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Command/ScaffoldPluginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
exit;
}

$is_psr_4 = is_dir( $downloadPath . '/classes/Admin/' );
$is_psr_4 = ! file_exists( $downloadPath . '/autoload.php' );
if ( $is_psr_4 ) {
$io->writeln( '<info>Plugin with PSR-4 detected</info>' );
} else {
Expand Down Expand Up @@ -253,11 +253,10 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
$pluginViewFolderName = $this->askAndConfirm( $io, "What is your plugin's view folder name ? (e.g: 'my-plugin') " );
self::doStrReplace( $installPath, 'bea-pb', $pluginViewFolderName );

if ( false === $no_autoload ) {
if ( $is_psr_4 && false === $no_autoload ) {

/**
* Add the new namespace to the autoload entry of the composer.json file.
*
*/
$composerPath = $composer->getConfig()->getConfigSource()->getName();
$composerFile = new JsonFile( $composerPath );
Expand Down

0 comments on commit 277aba0

Please sign in to comment.