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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate:form gives PHP Fatal error: Uncaught TypeError: Return value of "CRM\CivixBundle\Command\AddFormCommand::execute()" must be of the type int, "null" returned. in ...\vendor\symfony\console\Command\Command.php:301 #304

Merged
merged 3 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/AbstractAddPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$mixins = new Mixins($info, $basedir->string('mixin'), ['[email protected]', '[email protected]']);
$mixins->save($ctx, $output);
$info->save($ctx, $output);
return 0;
}

abstract protected function getPhpTemplate(InputInterface $input);
Expand Down
3 changes: 2 additions & 1 deletion src/CRM/CivixBundle/Command/AddAngularDirectiveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$attrs = $info->get()->attributes();
if ($attrs['type'] != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

$ctx['tsDomain'] = (string) $attrs['key'];
Expand Down Expand Up @@ -80,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$ext->init($ctx);
$ext->save($ctx, $output);
return 0;
}

public function toHyphen($dirName) {
Expand Down
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/AddAngularModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$ext->loadInit($ctx);
$ext->save($ctx, $output);
return 0;
}

}
3 changes: 2 additions & 1 deletion src/CRM/CivixBundle/Command/AddAngularPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$attrs = $info->get()->attributes();
if ($attrs['type'] != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

$ctx['tsDomain'] = (string) $attrs['key'];
Expand Down Expand Up @@ -81,6 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$ext->init($ctx);
$ext->save($ctx, $output);
return 0;
}

}
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/AddApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$phpUnitInitFiles->initPhpunitBootstrap($basedir->string('tests', 'phpunit', 'bootstrap.php'), $ctx, $output);

$info->save($ctx, $output);
return 0;
}

}
3 changes: 2 additions & 1 deletion src/CRM/CivixBundle/Command/AddCaseTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$civicrm_api3 = Services::api3();
if (!$civicrm_api3 || !$civicrm_api3->local) {
$output->writeln("Requires access to local CiviCRM source tree. Configure civicrm_api3_conf_path.</error>");
return;
return 1;
}

$this->assertCurrentFormat();
Expand Down Expand Up @@ -59,6 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$mixins = new Mixins($info, $basedir->string('mixin'), ['[email protected]']);
$mixins->save($ctx, $output);
$info->save($ctx, $output);
return 0;
}

}
4 changes: 3 additions & 1 deletion src/CRM/CivixBundle/Command/AddCustomDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$attrs = $info->get()->attributes();
if ($attrs['type'] != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

$dirs = new Dirs([
Expand Down Expand Up @@ -77,6 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
else {
$output->writeln(" * NOTE: By default, this file will not be loaded automatically -- you must define installation or upgrade logic to load the file.");
}

return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('<comment>You are missing an upgrader class. Your generated SQL files will not be executed on enable and uninstall. Fix this by running `civix generate:upgrader`.</comment>');
}

return 0;
}

private function orderTables(&$tables, $output) {
Expand Down
4 changes: 3 additions & 1 deletion src/CRM/CivixBundle/Command/AddEntityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$civicrm_api3 = Services::api3();
if (!$civicrm_api3 || !$civicrm_api3->local) {
$output->writeln("<error>Require access to local CiviCRM source tree. Configure civicrm_api3_conf_path.</error>");
return;
return 1;
}

$this->assertCurrentFormat();
Expand Down Expand Up @@ -152,6 +152,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$output->writeln('<comment>You should now make any changes to the entity xml file and run `civix generate:entity-boilerplate` to generate necessary boilerplate.</comment>');
$output->writeln('<comment>Note: no changes have been made to the database. You can update the database by uninstalling and re-enabling the extension.</comment>');

return 0;
}

}
2 changes: 2 additions & 0 deletions src/CRM/CivixBundle/Command/AddReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$ext->loadInit($ctx);
$ext->save($ctx, $output);

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/CRM/CivixBundle/Command/AddSearchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function ($phpSrc) use ($origTplFile, $ctx) {

$ext->loadInit($ctx);
$ext->save($ctx, $output);

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/CRM/CivixBundle/Command/AddTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$phpUnitInitFiles->initPhpunitBootstrap($basedir->string('tests', 'phpunit', 'bootstrap.php'), $ctx, $output);
$this->initTestClass(
$input->getArgument('<CRM_Full_ClassName>'), $this->getTestTemplate($input->getOption('template')), $basedir, $ctx, $output);

return 0;
}

protected function getTestTemplate($type) {
Expand Down
2 changes: 2 additions & 0 deletions src/CRM/CivixBundle/Command/AddThemeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$ext->loadInit($ctx);
$ext->save($ctx, $output);

return 0;
}

}
4 changes: 3 additions & 1 deletion src/CRM/CivixBundle/Command/AddUpgraderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$attrs = $info->get()->attributes();
if ($attrs['type'] != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

$dirs = [
Expand Down Expand Up @@ -63,6 +63,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$module = new Module(Services::templating());
$module->loadInit($ctx);
$module->save($ctx, $output);

return 0;
}

}
3 changes: 2 additions & 1 deletion src/CRM/CivixBundle/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$attrs = $info->get()->attributes();
if ($attrs['type'] != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

$ctx['zipFile'] = $basedir->string('build', $ctx['fullName'] . '.zip');
Expand All @@ -54,6 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
throw new \RuntimeException('Failed to create zip');
}
print $process->getOutput();
return 0;
}

}
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/ConfigGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
foreach ($this->getInterestingParameters() as $key) {
printf("%-40s \"%s\"\n", $key, @$config['parameters'][$key]);
}
return 0;
}

protected function getInterestingParameters() {
Expand Down
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/ConfigSetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$data['parameters'][$input->getArgument('key')] = $input->getArgument('value');
$ext->builders['ini']->set($data);
$ext->save($ctx, $output);
return 0;
}

}
2 changes: 2 additions & 0 deletions src/CRM/CivixBundle/Command/InfoGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
foreach ($info->get()->xpath($xpath) as $node) {
$output->writeln((string) $node, OutputInterface::OUTPUT_RAW);
}

return 0;
}

}
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/InfoSetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}

$info->save($ctx, $output);
return 0;
}

}
7 changes: 4 additions & 3 deletions src/CRM/CivixBundle/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// Name should start with an alpha and only contain alphanumeric, - and .
if (!Naming::isValidFullName($name)) {
$output->writeln('<error>Malformed package name</error>');
return;
return 1;
}

$ctx['basedir'] = $name;
Expand All @@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
else {
$output->writeln("<error>Missing author name or email address</error>");
$output->writeln("<error>Please pass --author and --email, or set defaults in ~/.gitconfig</error>");
return;
return 1;
}
$ctx['license'] = $input->getOption('license');
if ($licenses->get($ctx['license'])) {
Expand All @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
else {
$output->writeln('<error>Unrecognized license (' . $ctx['license'] . ')</error>');
return;
return 1;
}

if ($input->getOption('compatibility') === 'current') {
Expand Down Expand Up @@ -156,6 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$ext->save($ctx, $output);

$this->tryEnable($input, $output, $ctx['fullName']);
return 0;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/PingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
else {
$output->writeln('<error>Ping failed: API Error: ' . $civicrm_api3->errorMsg() . '</error>');
}
return 0;
}

}
13 changes: 7 additions & 6 deletions src/CRM/CivixBundle/Command/TestRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,32 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$info->load($ctx);
if ($info->getType() != 'module') {
$output->writeln('<error>Wrong extension type: ' . $attrs['type'] . '</error>');
return;
return 1;
}

// Find the main phpunit
$civicrm_api3 = Services::api3();
if (!$civicrm_api3 || !$civicrm_api3->local) {
$output->writeln("<error>'test' requires access to local CiviCRM source tree. Configure civicrm_api3_conf_path.</error>");
return;
return 1;
}
global $civicrm_root;
if (empty($civicrm_root) || !is_dir($civicrm_root)) {
$output->writeln("<error>Failed to locate CiviCRM root path: $civicrm_root</error>");
return;
return 1;
}
$phpunit_bin = "$civicrm_root/tools/scripts/phpunit";
if (!file_exists($phpunit_bin)) {
$output->writeln("<error>Failed to locate PHPUnit:\n $phpunit_bin</error>");
$output->writeln("<error>Have you configured CiviCRM for testing? See also:\n https://docs.civicrm.org/dev/en/latest/testing/#setup</error>");
return;
return 1;
}
$test_settings_path = "$civicrm_root/tests/phpunit/CiviTest/civicrm.settings.php";
$test_settings_dist_path = "$civicrm_root/tests/phpunit/CiviTest/civicrm.settings.dist.php";
if (!file_exists($test_settings_path) && !file_exists($test_settings_dist_path)) {
$output->writeln("<error>Failed to locate test settings:\n $test_settings_path</error>");
$output->writeln("<error>Have you configured CiviCRM for testing? See also:\n https://docs.civicrm.org/dev/en/latest/testing/#setup</error>");
return;
return 1;
}
if (file_exists($test_settings_path) && self::checkLegacyExtensionSettings($test_settings_path)) {
$output->writeln("<comment>Warning: Possible conflicts in $test_settings_path</comment>");
Expand All @@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$phpunit_boot = $this->getBootstrapFile($info->getKey(), $input->getOption('clear'));
if (empty($phpunit_boot) || !file_exists($phpunit_boot)) {
$output->writeln("<error>Failed to create PHPUnit bootstrap file</error>");
return;
return 1;
}

$tests_dir = implode(DIRECTORY_SEPARATOR, [getcwd(), 'tests', 'phpunit']);
Expand Down Expand Up @@ -121,6 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->write($buffer);
});
$output->write("\n");
return 0;
}

/**
Expand Down