Skip to content

Commit

Permalink
Phpstan: fix missing sfTask* return statement
Browse files Browse the repository at this point in the history
  • Loading branch information
thePanz committed Mar 21, 2024
1 parent 70aa655 commit 1844457
Show file tree
Hide file tree
Showing 31 changed files with 67 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/task/app/sfAppRoutesTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected function execute($arguments = [], $options = [])

// display
$arguments['name'] ? $this->outputRoute($arguments['application'], $arguments['name']) : $this->outputRoutes($arguments['application']);

return 0;
}

protected function outputRoutes($application)
Expand Down
2 changes: 2 additions & 0 deletions lib/task/cache/sfCacheClearTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ protected function execute($arguments = [], $options = [])
if (null === $options['app'] && 'all' == $options['type']) {
$this->getFilesystem()->remove(sfFinder::type('file')->discard('.*')->in(sfConfig::get('sf_cache_dir')));
}

return 0;
}

protected function getClearCacheMethod($type)
Expand Down
2 changes: 2 additions & 0 deletions lib/task/configure/sfConfigureAuthorTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@ protected function execute($arguments = [], $options = [])
}

file_put_contents($file, $ini);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/generator/sfGenerateAppTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@ protected function execute($arguments = [], $options = [])

// Create test dir
$this->getFilesystem()->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/generator/sfGenerateModuleTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,7 @@ protected function execute($arguments = [], $options = [])
// customize php and yml files
$finder = sfFinder::type('file')->name('*.php', '*.yml');
$this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/generator/sfGenerateProjectTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ protected function execute($arguments = [], $options = [])
$fixPerms->run();

$this->replaceTokens();

return 0;
}

protected function canRunInstaller($installer)
Expand Down
2 changes: 2 additions & 0 deletions lib/task/generator/sfGenerateTaskTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,7 @@ protected function execute(\$arguments = array(), \$options = array())

$this->logSection('task', sprintf('Creating "%s" task file', $taskFile));
file_put_contents($taskFile, $content);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/help/sfHelpTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ protected function execute($arguments = [], $options = [])
} else {
$this->outputAsText($task);
}

return 0;
}

protected function outputAsText(sfTask $task)
Expand Down
2 changes: 2 additions & 0 deletions lib/task/help/sfListTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function execute($arguments = [], $options = [])
} else {
$this->outputAsText($arguments['namespace'], $tasks);
}

return 0;
}

protected function outputAsText($namespace, $tasks)
Expand Down
2 changes: 2 additions & 0 deletions lib/task/i18n/sfI18nExtractTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function execute($arguments = [], $options = [])

$extract->deleteOldMessages();
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/task/i18n/sfI18nFindTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function execute($arguments = [], $options = [])
$this->log(" {$message}\n");
}
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/task/log/sfLogClearTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ protected function execute($arguments = [], $options = [])
{
$logs = sfFinder::type('file')->in(sfConfig::get('sf_log_dir'));
$this->getFilesystem()->remove($logs);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/log/sfLogRotateTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,7 @@ protected function configure()
protected function execute($arguments = [], $options = [])
{
$this->rotate($arguments['application'], $arguments['env'], $options['period'], $options['history'], true);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginAddChannelTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ protected function execute($arguments = [], $options = [])
$this->logSection('plugin', sprintf('add channel "%s"', $arguments['name']));

$this->getPluginManager()->getEnvironment()->registerChannel($arguments['name']);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginInstallTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,7 @@ protected function execute($arguments = [], $options = [])
}

$this->getPluginManager()->installPlugin($arguments['name'], $options);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginListTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ protected function execute($arguments = [], $options = [])
$alias = $this->getPluginManager()->getEnvironment()->getRegistry()->getChannel($package->getChannel())->getAlias();
$this->log(sprintf(' %-40s %10s-%-6s %s', $this->formatter->format($package->getPackage(), 'INFO'), $package->getVersion(), $package->getState() ?: null, $this->formatter->format(sprintf('# %s (%s)', $package->getChannel(), $alias), 'COMMENT')));
}

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginPublishAssetsTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protected function execute($arguments = [], $options = [])
$this->logSection('plugin', 'Configuring plugin - '.$plugin);
$this->installPluginAssets($plugin, $pluginConfiguration->getRootDir(), $options['relative']);
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginUninstallTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,7 @@ protected function execute($arguments = [], $options = [])
$this->logSection('plugin', sprintf('uninstalling plugin "%s"', $arguments['name']));

$this->getPluginManager()->uninstallPlugin($arguments['name'], $options['channel']);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/plugin/sfPluginUpgradeTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@ protected function execute($arguments = [], $options = [])
$this->logSection('plugin', sprintf('upgrading plugin "%s"', $arguments['name']));

$this->getPluginManager()->installPlugin($arguments['name'], $options);

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectClearControllersTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ protected function execute($arguments = [], $options = [])
}
}
}

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectDeployTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ protected function execute($arguments = [], $options = [])
$this->getFilesystem()->execute($command, $options['trace'] ? [$this, 'logOutput'] : null, [$this, 'logErrors']);

$this->clearBuffers();

return 0;
}

protected function clearBuffers()
Expand Down
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectDisableTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ protected function execute($arguments = [], $options = [])
$this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env));
}
}

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectEnableTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,7 @@ protected function execute($arguments = [], $options = [])
$this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env));
}
}

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectOptimizeTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ protected function execute($arguments = [], $options = [])
file_put_contents($target, '<?php return '.var_export($data, true).';');

umask($current_umask);

return 0;
}

protected function optimizeGetControllerDirs($modules)
Expand Down
4 changes: 4 additions & 0 deletions lib/task/project/sfProjectPermissionsTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ protected function execute($arguments = [], $options = [])
['Permissions on the following file(s) could not be fixed:', ''],
array_map(function ($f) { return ' - '.sfDebug::shortenFilePath($f); }, $this->failed)
), 'ERROR_LARGE');

return 1;
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectSendEmailsTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ protected function execute($arguments = [], $options = [])
$sent = $this->getMailer()->flushQueue();

$this->logSection('project', sprintf('sent %s emails', $sent));

return 0;
}
}
2 changes: 2 additions & 0 deletions lib/task/project/sfProjectValidateTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ protected function execute($arguments = [], $options = [])

$this->log($v->getExplanation());
}

return 0;
}

protected function formatFile($file)
Expand Down
6 changes: 6 additions & 0 deletions lib/task/sfBaseTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function checkProjectExists()
if (!file_exists('symfony')) {
throw new sfException('You must be in a symfony project directory.');
}

return true;
}

/**
Expand All @@ -75,6 +77,8 @@ public function checkAppExists($app)
if (!is_dir(sfConfig::get('sf_apps_dir').'/'.$app)) {
throw new sfException(sprintf('Application "%s" does not exist', $app));
}

return true;
}

/**
Expand All @@ -92,6 +96,8 @@ public function checkModuleExists($app, $module)
if (!is_dir(sfConfig::get('sf_apps_dir').'/'.$app.'/modules/'.$module)) {
throw new sfException(sprintf('Module "%s/%s" does not exist.', $app, $module));
}

return true;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/task/test/sfTestCoverageTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ protected function execute($arguments = [], $options = [])

$coveredFiles = $this->getFiles(sfConfig::get('sf_root_dir').'/'.$arguments['lib_name']);
$coverage->output($coveredFiles);

return 0;
}

protected function getTestHarness($harnessOptions = [])
Expand Down
2 changes: 2 additions & 0 deletions lib/task/test/sfTestFunctionalTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ protected function execute($arguments = [], $options = [])
}
} else {
$this->logSection('functional', 'no controller found', null, 'ERROR');

return 1;
}
} else {
require_once __DIR__.'/sfLimeHarness.class.php';
Expand Down
2 changes: 1 addition & 1 deletion lib/task/test/sfTestPluginTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ protected function execute($arguments = [], $options = [])
$finder = sfFinder::type('file')->follow_link()->name('*Test.php');
$h->register($finder->in($h->base_dir));

$h->run();
return $h->run();
}
}

0 comments on commit 1844457

Please sign in to comment.