Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AssociationController extends FormController
* @param string $urlVar The name of the URL variable if different from the primary key
* (sometimes required to avoid router collisions).
*
* @return boolean True if access level check and checkout passes, false otherwise.
* @return FormController|boolean True if access level check and checkout passes, false otherwise.
*
* @since 3.7.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Input\Input;
use Joomla\Utilities\ArrayHelper;

/**
Expand All @@ -38,7 +39,7 @@ class BannersController extends AdminController
* @param array $config An optional associative array of configuration settings.
* @param MVCFactoryInterface $factory The factory.
* @param CmsApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
* @param Input $input Input
*
* @since 3.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getQuickiconContent()

// Number bytes are returned in format xxx.xx MB
$bytes = HTMLHelper::_('number.bytes', $size, 'MB', 1);

if (!empty($bytes))
{
$result['amount'] = $bytes;
Expand Down Expand Up @@ -114,7 +114,7 @@ public function deleteAll()
// Check for request forgeries
$this->checkToken();

$app = $this->app;
/** @var \Joomla\Component\Cache\Administrator\Model\CacheModel $model */
$model = $this->getModel('cache');
$allCleared = true;

Expand All @@ -124,7 +124,7 @@ public function deleteAll()
{
if ($mCache->clean($cache->group) === false)
{
$app->enqueueMessage(
$this->app->enqueueMessage(
Text::sprintf(
'COM_CACHE_EXPIRED_ITEMS_DELETE_ERROR', Text::_('JADMINISTRATOR') . ' > ' . $cache->group
), 'error'
Expand All @@ -135,14 +135,14 @@ public function deleteAll()

if ($allCleared)
{
$app->enqueueMessage(Text::_('COM_CACHE_MSG_ALL_CACHE_GROUPS_CLEARED'), 'message');
$this->app->enqueueMessage(Text::_('COM_CACHE_MSG_ALL_CACHE_GROUPS_CLEARED'), 'message');
}
else
{
$app->enqueueMessage(Text::_('COM_CACHE_MSG_SOME_CACHE_GROUPS_CLEARED'), 'warning');
$this->app->enqueueMessage(Text::_('COM_CACHE_MSG_SOME_CACHE_GROUPS_CLEARED'), 'warning');
}

$app->triggerEvent('onAfterPurge', array());
$this->app->triggerEvent('onAfterPurge', array());
$this->setRedirect('index.php?option=com_cache&view=cache');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function getModel($name = 'Category', $prefix = 'Administrator', $config
}

/**
* Method to get the number of content categories
* Outputs the JSON-encoded amount of published content categories
*
* @return string The JSON-encoded amount of published content categories
* @return void
*
* @since 4.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public function batch($model = null)
{
$this->checkToken();

// Set the model
/** @var \Joomla\Component\Categories\Administrator\Model\CategoryModel $model */
$model = $this->getModel('Category');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
*
* @return static This object to support chaining.
* @return static|boolean This object to support chaining.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff like this makes me realize a lot of the Joomla code would choke up a static analyzer.

  1. I'm pretty sure the base display() method in the controllers only documents a $this return, no type covariance

  2. I'm pretty sure all of the controller returns are unused anyway, either stuff is being echoed thanks to the output buffer being started or it's just all ignored

  3. Seriously, this return type just makes me sad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d like to move a lot of it to exceptions or in many of these cases as we are just setting redirects into the controller probably return $this would work. But for now I’m just documenting correctly can do a second round of cleanup specifically on that

*
* @since 1.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function checkin()
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
Expand All @@ -99,6 +100,7 @@ public function getMenuBadgeData()
* @return void
*
* @since 4.0
* @throws \Exception
*/
public function getQuickiconContent()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function cancel()
/**
* Saves the form
*
* @return mixed
* @return void|boolean Void on success. Boolean false on fail.
*
* @since 4.0.0
*/
Expand Down Expand Up @@ -205,7 +205,7 @@ public function save()
/**
* Method to remove root in global configuration.
*
* @return boolean True on success.
* @return boolean
*
* @since 3.2
*/
Expand Down Expand Up @@ -247,12 +247,14 @@ public function removeroot()

// Set the redirect based on the task.
$this->setRedirect(Route::_('index.php'), Text::_('COM_CONFIG_SAVE_SUCCESS'));

return true;
}

/**
* Method to send the test mail.
*
* @return string
* @return void
*
* @since 3.5
*/
Expand Down Expand Up @@ -290,7 +292,7 @@ public function sendtestmail()
/**
* Method to GET permission value and give it to the model for storing in the database.
*
* @return boolean true on success, false when failed
* @return void
*
* @since 3.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Client\ClientHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Input\Input;

/**
* Note: this view is intended only to be opened in a popup
Expand All @@ -34,7 +36,7 @@ class ComponentController extends BaseController
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
* @param Input $input Input
*
* @since 3.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RequestController extends BaseController
/**
* Execute the controller.
*
* @return mixed A rendered view or true
* @return mixed A rendered view or false
*
* @since 3.2
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ public function getJson()
{
$this->app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error');

return;
return false;
}

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DisplayController extends BaseController
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
*
* @return static This object to support chaining.
* @return static |boolean This object to support chaining. False on failure.
*
* @since 1.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DisplayController extends BaseController
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return BaseController|bool This object to support chaining.
* @return BaseController|boolean This object to support chaining.
*
* @since 1.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function delete()
}
else
{
// Get the model.
/** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */
$model = $this->getModel();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DisplayController extends BaseController
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
*
* @return static A \JControllerLegacy object to support chaining.
* @return static An instance of the current object to support chaining.
*
* @since 3.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public function display($cachable = false, $urlparams = false)
$this->app->enqueueMessage(Text::sprintf('COM_CSP_PLUGIN_MODAL_DISABLED', $link), 'error');
}

parent::display();
return parent::display();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;

/**
* Fields Controller
*
* @since 3.7.0
*/
class DisplayController extends \Joomla\CMS\MVC\Controller\BaseController
class DisplayController extends BaseController
{
/**
* The default view.
Expand All @@ -39,7 +40,7 @@ class DisplayController extends \Joomla\CMS\MVC\Controller\BaseController
* @param boolean $cachable If true, the view output will be cached
* @param array|bool $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}
*
* @return Controller|boolean A Controller object to support chaining.
* @return BaseController|boolean A Controller object to support chaining.
*
* @since 3.7.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
use Joomla\Input\Input;
use Joomla\Registry\Registry;

/**
Expand Down Expand Up @@ -52,7 +53,7 @@ class FieldController extends FormController
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
* @param Input $input Input
*
* @since 3.7.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DisplayController extends BaseController
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
*
* @return static A Controller object to support chaining.
* @return static|boolean A Controller object to support chaining or false on failure.
*
* @since 2.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SearchesController extends BaseController
/**
* Method to reset the search log table.
*
* @return boolean
* @return void
*/
public function reset()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Model\AdminModel;

/**
Expand Down Expand Up @@ -96,7 +97,7 @@ public function getFilter()
* @param array $data Data for the form. [optional]
* @param boolean $loadData True if the form is to load its own data (default case), false if not. [optional]
*
* @return \JForm|boolean A \JForm object on success, false on failure
* @return Form|boolean A \JForm object on success, false on failure
*
* @since 2.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function fix()
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function display($cachable = false, $urlparams = false)
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function ajax()
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\Database\ParameterType;
use Joomla\Utilities\ArrayHelper;
Expand Down Expand Up @@ -86,7 +87,7 @@ protected function populateState($ordering = 'name', $direction = 'asc')
/**
* Method to get the database query.
*
* @return \JDatabaseQuery the database query
* @return DatabaseQuery the database query
*
* @since 3.1
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function publish(&$eid = array(), $value = 1)
/**
* Refreshes the cached manifest information for an extension.
*
* @param int $eid extension identifier (key in #__extensions)
* @param int|int[] $eid extension identifier (key in #__extensions)
*
* @return boolean result of refresh
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function display($cachable = false, $urlparams = false)
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
Expand Down
Loading