Skip to content

Commit

Permalink
Update composer deps and update php-cs-fixer conf
Browse files Browse the repository at this point in the history
Update composer dependencies:
- jasig/phpcas is no longer maintained. apereo/phpcas is the suggested
  replacement.
- Updating to php-cs-fixer 3.64.0 introduces some new rules which would
  lead to changes in over ~400 files. Selectively changing or turning
  off some of these rules that would lead to problems.
  • Loading branch information
anvit committed Oct 21, 2024
1 parent ac57193 commit e42994a
Show file tree
Hide file tree
Showing 211 changed files with 1,818 additions and 1,685 deletions.
63 changes: 53 additions & 10 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,71 @@
<?php

// Exclude cache folder (vendor is already excluded)
// Exclude cache and docker folders (vendor is already excluded)
// and model classes generated with Propel.
$finder = PhpCsFixer\Finder::create()
->exclude('.coverage')
->exclude('cache')
->notPath('docker/')
->notPath('#/model/om/#')
->notPath('#/model/map/#')
->in(__DIR__)
;

// Indentation inside switch blocks and some multiline
// elements (control statements, assignments, strings)
// is not considered. See:
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/776
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4502
//
// PhpCsFixer's method_argument_space default value,
// which includes ensure_fully_multiline, causes
// inconsistencies in templates.
// method_argument_space, statement_indentation
/*
* Indentation inside switch blocks and some multiline
* elements (control statements, assignments, strings)
* is not considered. See:
* https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/776
* https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4502
*
* PhpCsFixer's method_argument_space default value,
* which includes ensure_fully_multiline, causes
* inconsistencies in templates.
*/

// fully_qualified_strict_types
/*
* TODO: Currently the only cases where we don't have fully
* qualified strict types is where we reference Elastica,
* and having those helps developers quickly find locations
* where Elastica is present in the AtoM codebase outside
* plugins. When ES is no longer deeply integrated with the
* AtoM code base, this rule exception can be removed.
*/

// string_implicit_backslashes
/*
* This breaks regex strings, and currently there are no
* options that distinguish regex strings from regular
* strings.
*/

// no_superfluous_phpdoc_tags
/*
* This removes phpdoc where the function signature already
* includes types. Adding this exception since we still
* want to retain phpdoc specially if they include a
* description.
*/

// multiline_whitespace_before_semicolons
/*
* This prevents semicolons to be moved to a new line in
* cases where there are chained multiline function calls.
* Adding this exception since the semicolons in new lines
* are not indented.
*/
return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PhpCsFixer' => true,
'method_argument_space' => ['on_multiline' => 'ignore'],
'statement_indentation' => false,
'fully_qualified_strict_types' => false,
'string_implicit_backslashes' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'no_superfluous_phpdoc_tags' => false,
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion apps/qubit/modules/actor/templates/_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<ul>

<?php if (QubitAcl::check($resource, 'update') || (QubitAcl::check($resource, 'translate'))) { ?>
<?php if (QubitAcl::check($resource, 'update') || QubitAcl::check($resource, 'translate')) { ?>
<li><?php echo link_to(__('Edit'), [$resource, 'module' => 'actor', 'action' => 'edit'], ['class' => 'c-btn c-btn-submit', 'title' => __('Edit')]); ?></li>
<?php } ?>

Expand Down
3 changes: 2 additions & 1 deletion apps/qubit/modules/actor/templates/_occupations.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</tr>
</thead><tbody>

<?php $i = 0; foreach ($occupations as $item) { ?>
<?php $i = 0;
foreach ($occupations as $item) { ?>
<?php $form->getWidgetSchema()->setNameFormat("occupations[{$i}][%s]"); ?>

<tr class="<?php echo 0 == $i % 2 ? 'even' : 'odd'; ?> related_obj_<?php echo $item->id; ?>">
Expand Down
4 changes: 1 addition & 3 deletions apps/qubit/modules/admin/actions/error404Action.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@

class AdminError404Action extends sfAction
{
public function execute($request)
{
}
public function execute($request) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@

class AdminTranslatePermissionAction extends sfAction
{
public function execute($request)
{
}
public function execute($request) {}
}
10 changes: 8 additions & 2 deletions apps/qubit/modules/clipboard/actions/exportAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public function execute($request)

// Determine if there are non-visible elements that should be hidden
$this->nonVisibleElementsIncluded = false;
$defTemplate = sfConfig::get(('app_default_template_'.strtolower($this->objectType)));
$defTemplate = sfConfig::get('app_default_template_'.strtolower($this->objectType));

foreach (sfConfig::getAll() as $setting => $value) {
if (
(false !== strpos($setting, ('app_element_visibility_'.$defTemplate)))
(false !== strpos($setting, 'app_element_visibility_'.$defTemplate))
&& (0 == sfConfig::get($setting))
) {
$this->nonVisibleElementsIncluded = true;
Expand Down Expand Up @@ -338,6 +338,7 @@ protected function addField($name)
);

break;

// Enable field includeDescendants if:
// options enabled
// and, information object type
Expand All @@ -357,6 +358,7 @@ protected function addField($name)
}

break;

// Enable field includeAllLevels if:
// options enabled
// and, information object type
Expand All @@ -372,6 +374,7 @@ protected function addField($name)
}

break;

// Enable field levels if:
// options enabled
// and, information object type
Expand Down Expand Up @@ -405,6 +408,7 @@ protected function addField($name)
}

break;

// Enable field includeDigitalObjects if:
// digital objects are available
case 'includeDigitalObjects':
Expand All @@ -429,6 +433,7 @@ protected function addField($name)
}

break;

// Enable field includeDrafts if:
// information object type
// and, user is authenticated
Expand All @@ -451,6 +456,7 @@ protected function addField($name)
}

break;

// Enable field includeNonVisibleElements if:
// information object type
// and, user is authenticated
Expand Down
1 change: 1 addition & 0 deletions apps/qubit/modules/clipboard/actions/viewAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private function setESSort($request)
$this->search->query->addSort(['referenceCode.untouched' => $request->sortDir]);

break;

// Sort by title if information object, go with authorized form of name if repository / actor
case 'alphabetic':
$fieldName = 'QubitInformationObject' === $this->entityType ? 'title' : 'authorizedFormOfName';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ protected function doElasticsearchQuery($term, $options = [])
return QubitSearch::getInstance()
->index
->getType('QubitInformationObject')
->search($query->getQuery(false, false))
;
->search($query->getQuery(false, false));
}

/**
Expand Down Expand Up @@ -239,8 +238,7 @@ protected function countChildren($id, $options = [])
return QubitSearch::getInstance()
->index
->getType('QubitInformationObject')
->count($query->getQuery(false, false))
;
->count($query->getQuery(false, false));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@
*/
class DigitalObjectEditRepresentationComponent extends sfComponent
{
public function execute($request)
{
}
public function execute($request) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ protected function getDescendantDigitalObjectCount()
$results = QubitSearch::getInstance()
->index
->getType('QubitInformationObject')
->search($search->getQuery(false, true))
;
->search($search->getQuery(false, true));

return $results->getTotalHits();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ protected function setMasterFileShowProperties()
|| $this->showMasterFileMediaType
|| $this->showMasterFileMimeType
|| $this->showMasterFileSize
|| $this->showMasterFileCreatedAt
;
|| $this->showMasterFileCreatedAt;
}

protected function setReferenceCopyShowProperties()
Expand Down Expand Up @@ -320,9 +319,8 @@ protected function setOriginalFileShowProperties()
check_field_visibility('app_element_visibility_digital_object_preservation_system_original_ingested')
&& !$this->isEmpty($this->originalFileIngestedAt)
);
$this->showOriginalFilePermissions = (
check_field_visibility('app_element_visibility_digital_object_preservation_system_original_permissions')
);
$this->showOriginalFilePermissions =
check_field_visibility('app_element_visibility_digital_object_preservation_system_original_permissions');

return $this->showOriginalFileName
|| $this->showOriginalFormatName
Expand Down Expand Up @@ -351,9 +349,8 @@ protected function setPreservationCopyShowProperties()
check_field_visibility('app_element_visibility_digital_object_preservation_system_preservation_normalized')
&& !$this->isEmpty($this->preservationCopyNormalizedAt)
);
$this->showPreservationCopyPermissions = (
check_field_visibility('app_element_visibility_digital_object_preservation_system_preservation_permissions')
);
$this->showPreservationCopyPermissions =
check_field_visibility('app_element_visibility_digital_object_preservation_system_preservation_permissions');

return $this->showPreservationCopyFileName
|| $this->showPreservationCopyFileSize
Expand Down
1 change: 1 addition & 0 deletions apps/qubit/modules/function/actions/browseAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function execute($request)
switch ($request->sort) {
case 'identifier':
$criteria->{$sortFunction}(QubitFunctionObject::DESCRIPTION_IDENTIFIER);

// And then back to authorized form of name
// no break
case 'alphabetic':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function getDescendantDateTypes($resource)

foreach ($eventData as $event) {
$eventTypeTerm = QubitTerm::getById($event['type_id']);
$eventTypes[($event['type_id'])] = $eventTypeTerm->getName(['cultureFallback' => true]);
$eventTypes[$event['type_id']] = $eventTypeTerm->getName(['cultureFallback' => true]);
}

return $eventTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public function execute($request)
$this->status = $this->context->i18n->__('Uploaded');

break;

// It should never get here if we don't add more finding aid
// statuses
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ private static function getResults($resource, $limit = 10, $page = 1, $sort = nu
]);

break;

// Avoid sorting when we are just counting records
case null:
break;
Expand Down
6 changes: 3 additions & 3 deletions apps/qubit/modules/informationobject/templates/_actions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<section class="actions">
<ul>

<?php if (QubitAcl::check($resource, 'update') || (QubitAcl::check($resource, 'translate'))) { ?>
<?php if (QubitAcl::check($resource, 'update') || QubitAcl::check($resource, 'translate')) { ?>
<li><?php echo link_to(__('Edit'), [$resource, 'module' => 'informationobject', 'action' => 'edit'], ['class' => 'c-btn c-btn-submit']); ?></li>
<?php } ?>

Expand Down Expand Up @@ -63,9 +63,9 @@

<li class="divider"></li>

<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit']); ?></li>
<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit']); ?></li>
<?php if ($resource->hasChildren()) { ?>
<li><?php echo link_to(__('Manage rights inheritance'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'manage']); ?></li>
<li><?php echo link_to(__('Manage rights inheritance'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'manage']); ?></li>
<?php } ?>

<?php if (sfConfig::get('app_audit_log_enabled', false)) { ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</tr>
</thead><tbody>

<?php $i = 0; foreach ($alternativeIdentifiers as $item) { ?>
<?php $i = 0;
foreach ($alternativeIdentifiers as $item) { ?>
<?php $form->getWidgetSchema()->setNameFormat("alternativeIdentifiers[{$i}][%s]"); ?>

<tr class="<?php echo 0 == $i % 2 ? 'even' : 'odd'; ?> related_obj_<?php echo $item->id; ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
</th>
</tr>
</thead><tbody>
<?php $row = 1; foreach ($results as $item) { ?>
<?php $row = 1;
foreach ($results as $item) { ?>
<tr>
<td>
<?php echo $row++; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<body>
<h1 class="label"><?php echo $reportTypeLabel.$this->i18n->__(' report'); ?></h1><hr>

<?php $row = 1; foreach ($results as $parent => $items) { ?>
<?php $row = 1;
foreach ($results as $parent => $items) { ?>
<h2 class="element-invisible"><?php echo $this->i18n->__('%1% hierarchy', ['%1%' => sfConfig::get('app_ui_label_informationobject')]); ?></h2>
<div class="resource-hierarchy">
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
</th>
</tr>
</thead><tbody>
<?php $row = 1; foreach ($results as $item) { ?>
<?php $row = 1;
foreach ($results as $item) { ?>
<tr>
<td>
<?php echo $row++; ?>
Expand Down
2 changes: 1 addition & 1 deletion apps/qubit/modules/menu/templates/listSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<tr>
<td<?php if (QubitMenu::ROOT_ID == $item['parentId']) { ?> style="font-weight: bold"<?php } ?>>

<?php echo str_repeat('&nbsp;&nbsp;', ($item['depth'] - 1)); ?>
<?php echo str_repeat('&nbsp;&nbsp;', $item['depth'] - 1); ?>

<?php if (isset($item['prev'])) { ?>
<?php echo link_to(image_tag('up.gif', ['alt' => __('Move up')]), ['module' => 'menu', 'action' => 'list', 'move' => $item['id'], 'before' => $item['prev']], ['title' => __('Move item up in list')]); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ protected function addField($name)
return parent::addField($name);
}

protected function processField($field)
{
}
protected function processField($field) {}

/**
* Launch the file import background job and return.
Expand Down
3 changes: 2 additions & 1 deletion apps/qubit/modules/object/templates/_notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
</tr>
</thead><tbody>

<?php $i = 0; foreach ($notes as $item) { ?>
<?php $i = 0;
foreach ($notes as $item) { ?>

<?php $form->getWidgetSchema()->setNameFormat($arrayName."[{$i}][%s]"); ?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function execute($request)
}

if (sfConfig::get('app_enable_institutional_scoping')) {
//remove search-realm
// remove search-realm
$this->context->user->removeAttribute('search-realm');
}

Expand Down
Loading

0 comments on commit e42994a

Please sign in to comment.