Skip to content

Commit

Permalink
Reduce visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Dec 13, 2024
1 parent 3c97f8b commit d698ce8
Show file tree
Hide file tree
Showing 32 changed files with 85 additions and 116 deletions.
6 changes: 4 additions & 2 deletions build/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
Expand All @@ -44,7 +45,7 @@
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
//SetList::NAMING,
//SetList::PRIVATIZATION,
SetList::PRIVATIZATION,
//SetList::STRICT_BOOLEANS,
//SetList::TYPE_DECLARATION,
]);
Expand Down Expand Up @@ -74,7 +75,8 @@
RemoveAlwaysTrueIfConditionRector::class => [__DIR__ . '/../libraries/bootstrap.php'],
// Do not add $app and $db as properties
CompleteDynamicPropertiesRector::class => [__DIR__ . '/../libraries/src/Plugin/CMSPlugin.php'],

// The setArgument function in events uses unused functions
PrivatizeFinalClassMethodRector::class => ['*/Event/*'],
// Ignore vendor
'*/vendor/*'
]);
Expand Down
8 changes: 4 additions & 4 deletions installation/src/Application/CliInstallationApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ final class CliInstallationApplication extends Application implements CMSApplica
* @var MVCFactory
* @since 4.3.0
*/
protected $mvcFactory;
private $mvcFactory;

/**
* Object to imitate the session object
*
* @var Registry
* @since 4.3.0
*/
protected $session;
private $session;

/**
* The client application Id
*
* @var Integer
* @since 5.0.2
*/
protected $clientId = 2;
private $clientId = 2;

/**
* Class constructor.
Expand All @@ -102,7 +102,7 @@ public function __construct(
*
* @since 4.3.0
*/
protected ?Language $language = null
private ?Language $language = null
) {
// Register the application name.
$this->setName('Joomla CLI installation');
Expand Down
6 changes: 1 addition & 5 deletions installation/src/Application/InstallationApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,12 @@ public function execute()
* will extend this method in child classes to provide configuration data from whatever data source is relevant
* for your specific application.
*
* @param string $file The path and filename of the configuration file. If not provided, configuration.php
* in JPATH_BASE will be used.
* @param string $class The class name to instantiate.
*
* @return mixed Either an array or object to be loaded into the configuration object.
*
* @since 1.7.3
* @throws \RuntimeException
*/
protected function fetchConfigurationData($file = '', $class = 'JConfig')
private function fetchConfigurationData()
{
return [];
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Application/ApiApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class ApiApplication extends CMSApplication
* @var array
* @since 4.0.0
*/
protected $formatMapper = [];
private $formatMapper = [];

/**
* The authentication plugin type
Expand Down Expand Up @@ -332,7 +332,7 @@ protected function route()
*
* @since 4.0.0
*/
protected function handlePreflight($method, $router)
private function handlePreflight($method, $router)
{
/**
* If not an OPTIONS request or CORS is not enabled,
Expand Down
18 changes: 9 additions & 9 deletions libraries/src/Application/SiteApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ final class SiteApplication extends CMSApplication
* @var boolean
* @since 4.0.0
*/
protected $language_filter = false;
private $language_filter = false;

/**
* Option to detect language by the browser
*
* @var boolean
* @since 4.0.0
*/
protected $detect_browser = false;
private $detect_browser = false;

/**
* The registered URL parameters.
Expand Down Expand Up @@ -107,7 +107,7 @@ public function __construct(?Input $input = null, ?Registry $config = null, ?Web
*
* @throws \Exception When you are not authorised to view the home page menu item
*/
protected function authorise($itemid)
private function authorise($itemid)
{
$menus = $this->getMenu();
$user = Factory::getUser();
Expand Down Expand Up @@ -436,7 +436,7 @@ public function getTemplate($params = false)
/** @var OutputController $cache */
$cache = $this->getCacheControllerFactory()->createCacheController('output', ['defaultgroup' => 'com_templates']);

$tag = $this->getLanguageFilter() ? $this->getLanguage()->getTag() : '';
$tag = $this->language_filter ? $this->getLanguage()->getTag() : '';

$cacheId = 'templates0' . $tag;

Expand All @@ -448,7 +448,7 @@ public function getTemplate($params = false)

foreach ($templates as &$template) {
// Create home element
if ($template->home == 1 && !isset($template_home) || $this->getLanguageFilter() && $template->home == $tag) {
if ($template->home == 1 && !isset($template_home) || $this->language_filter && $template->home == $tag) {
$template_home = clone $template;
}

Expand Down Expand Up @@ -566,7 +566,7 @@ protected function initialiseApp($options = [])
}
}

if (empty($options['language']) && $this->getLanguageFilter()) {
if (empty($options['language']) && $this->language_filter) {
// Detect cookie language
$lang = $this->input->cookie->get(md5($this->get('secret') . 'language'), null, 'string');

Expand All @@ -586,7 +586,7 @@ protected function initialiseApp($options = [])
}
}

if (empty($options['language']) && $this->getDetectBrowser()) {
if (empty($options['language']) && $this->detect_browser) {
// Detect browser language
$lang = LanguageHelper::detectLanguage();

Expand Down Expand Up @@ -786,7 +786,7 @@ protected function route()
*/
public function setDetectBrowser($state = false)
{
$old = $this->getDetectBrowser();
$old = $this->detect_browser;
$this->detect_browser = $state;

return $old;
Expand All @@ -803,7 +803,7 @@ public function setDetectBrowser($state = false)
*/
public function setLanguageFilter($state = false)
{
$old = $this->getLanguageFilter();
$old = $this->language_filter;
$this->language_filter = $state;

return $old;
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Editor/Button/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class Button implements ButtonInterface
*
* @since 5.0.0
*/
public function __construct(protected string $name, protected array $props = [], protected array $options = [])
public function __construct(private readonly string $name, private array $props = [], private array $options = [])
{
}

Expand Down Expand Up @@ -56,7 +56,7 @@ public function get(string $name, $default = null)
\E_USER_DEPRECATED
);

return $this->getOptions();
return $this->options;
}

return \array_key_exists($name, $this->props) ? $this->props[$name] : $default;
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Editor/Button/ButtonsRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class ButtonsRegistry implements ButtonsRegistryInterface, DispatcherAware
* @var array
* @since 5.0.0
*/
protected $registry = [];
private $registry = [];

/**
* Internal flag of initialisation
Expand Down
8 changes: 4 additions & 4 deletions libraries/src/Installer/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ public function parseQueries(\SimpleXMLElement $element)
// Get the database connector object
$db = & $this->_db;

if (!$element instanceof \SimpleXMLElement || !\count($element->children())) {
if (\count($element->children()) === 0) {
// Either the tag does not exist or has no children therefore we return zero files processed.
return 0;
}
Expand Down Expand Up @@ -1376,7 +1376,7 @@ protected function updateSchemaTable(int $eid, string $version, bool $update = f
public function parseFiles(\SimpleXMLElement $element, $cid = 0, $oldFiles = null, $oldMD5 = null)
{
// Get the array of file nodes to process; we checked whether this had children above.
if (!$element instanceof \SimpleXMLElement || !\count($element->children())) {
if (\count($element->children()) === 0) {
// Either the tag does not exist or has no children (hence no files to process) therefore we return zero files processed.
return 0;
}
Expand Down Expand Up @@ -1503,7 +1503,7 @@ public function parseFiles(\SimpleXMLElement $element, $cid = 0, $oldFiles = nul
public function parseLanguages(\SimpleXMLElement $element, $cid = 0)
{
// @todo: work out why the below line triggers 'node no longer exists' errors with files
if (!$element instanceof \SimpleXMLElement || !\count($element->children())) {
if (\count($element->children()) === 0) {
// Either the tag does not exist or has no children therefore we return zero files processed.
return 0;
}
Expand Down Expand Up @@ -1614,7 +1614,7 @@ public function parseLanguages(\SimpleXMLElement $element, $cid = 0)
*/
public function parseMedia(\SimpleXMLElement $element, $cid = 0)
{
if (!$element instanceof \SimpleXMLElement || !\count($element->children())) {
if (\count($element->children()) === 0) {
// Either the tag does not exist or has no children therefore we return zero files processed.
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Log/DelegatingPsrLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class DelegatingPsrLogger extends AbstractLogger
* @var array
* @since 3.8.0
*/
protected $priorityMap = [
private $priorityMap = [
LogLevel::EMERGENCY => Log::EMERGENCY,
LogLevel::ALERT => Log::ALERT,
LogLevel::CRITICAL => Log::CRITICAL,
Expand All @@ -55,7 +55,7 @@ public function __construct(
*
* @since 3.8.0
*/
protected Log $logger
private readonly Log $logger
)
{
}
Expand Down
10 changes: 5 additions & 5 deletions plugins/actionlog/joomla/src/Extension/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,31 @@ final class Joomla extends ActionLogPlugin implements SubscriberInterface
* @var array
* @since 3.9.0
*/
protected $loggableExtensions = [];
private $loggableExtensions = [];

/**
* Context aliases
*
* @var array
* @since 3.9.0
*/
protected $contextAliases = ['com_content.form' => 'com_content.article'];
private $contextAliases = ['com_content.form' => 'com_content.article'];

/**
* Flag for loggable Api.
*
* @var boolean
* @since 4.0.0
*/
protected $loggableApi = false;
private $loggableApi = false;

/**
* Array of loggable verbs.
*
* @var array
* @since 4.0.0
*/
protected $loggableVerbs = [];
private $loggableVerbs = [];

/**
* Constructor.
Expand Down Expand Up @@ -961,7 +961,7 @@ public function onUserLogout(LogoutEvent $event): void
*
* @since 3.9.0
*/
protected function checkLoggable($extension)
private function checkLoggable($extension)
{
return \in_array($extension, $this->loggableExtensions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class ConfirmConsent extends CMSPlugin
*
* @since 3.9.0
*/
protected $supportedContext = [
private $supportedContext = [
'com_contact.contact',
'com_privacy.request',
];
Expand Down
4 changes: 2 additions & 2 deletions plugins/content/finder/src/Extension/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class Finder extends CMSPlugin
*
* @since 5.0.0
*/
protected $pluginsImported = false;
private $pluginsImported = false;

/**
* Smart Search after save content method.
Expand Down Expand Up @@ -163,7 +163,7 @@ public function onCategoryChangeState($extension, $pks, $value)
*
* @since 5.0.0
*/
protected function importFinderPlugins()
private function importFinderPlugins()
{
if ($this->pluginsImported) {
return;
Expand Down
4 changes: 2 additions & 2 deletions plugins/content/loadmodule/src/Extension/LoadModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
final class LoadModule extends CMSPlugin
{
protected static $modules = [];
private static $modules = [];

protected static $mods = [];
private static $mods = [];

/**
* Plugin that loads module positions within content
Expand Down
2 changes: 1 addition & 1 deletion plugins/content/pagebreak/src/Extension/PageBreak.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class PageBreak extends CMSPlugin
* @var array
* @since 4.0.0
*/
protected $list = [];
private $list = [];

/**
* Plugin that adds a pagebreak into the text and truncates text at that point
Expand Down
4 changes: 2 additions & 2 deletions plugins/content/vote/src/Extension/Vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function onSchemaBeforeCompileHead($schema, $context): void
*
* @since 5.2.0
*/
protected function prepareAggregateRating($context)
private function prepareAggregateRating($context)
{
[$extension, $view, $id] = explode('.', $context);

Expand Down Expand Up @@ -211,7 +211,7 @@ protected function prepareAggregateRating($context)
*
* @since 5.2.0
*/
protected function prepareProductAggregateRating($context)
private function prepareProductAggregateRating($context)
{
[$extension, $view, $id] = explode('.', $context);

Expand Down
Loading

0 comments on commit d698ce8

Please sign in to comment.