Skip to content

Commit

Permalink
Update PHP CS Fixer rules
Browse files Browse the repository at this point in the history
Add exceptions for some of the new rules in PHP CS Fixer 3.64.0
  • Loading branch information
anvit committed Oct 10, 2024
1 parent e601537 commit 1e9114f
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 58 deletions.
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$finder = PhpCsFixer\Finder::create()
->exclude('.coverage')
->exclude('cache')
->notPath('docker/')
->notPath('#/model/om/#')
->notPath('#/model/map/#')
->in(__DIR__)
Expand All @@ -20,9 +21,27 @@
// which includes ensure_fully_multiline, causes
// inconsistencies in templates.
return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PhpCsFixer' => true,
'method_argument_space' => ['on_multiline' => 'ignore'],
'fully_qualified_strict_types' => false,
'statement_indentation' => false,
'single_line_empty_body' => false,
'string_implicit_backslashes' => false,
'no_extra_blank_lines' => ['tokens' => ['extra']],
'single_line_comment_spacing' => false,
'no_multiple_statements_per_line' => false,
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield']],
'multiline_whitespace_before_semicolons' => false,
'single_space_around_construct' => false,
'phpdoc_separation' => false,
'phpdoc_align' => false,
'phpdoc_trim' => false,
'no_superfluous_phpdoc_tags' => false,
'nullable_type_declaration_for_default_null_value' => false,
'no_useless_concat_operator' => false,
'blank_line_before_statement' => false,
])
->setFinder($finder)
;
4 changes: 2 additions & 2 deletions apps/qubit/modules/informationobject/templates/_actions.php
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion lib/QubitFlatfileImport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ private function getExistingNotes($objectId, $typeId, $culture)
AND n.type_id=?
AND i.culture=?';

$statement = self::sqlQuery($query, [$objectId, $typeId, $culture]);
$statement = self::sqlQuery($query, [$objectId, $typeId, $culture]);

foreach ($statement->fetchAll(PDO::FETCH_OBJ) as $row) {
$existingNotes[] = $row->content;
Expand Down
4 changes: 2 additions & 2 deletions lib/QubitXmlImport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1115,9 +1115,9 @@ private function handlePreSaveLogic($resource)
*
* @param QubitInformationObject $io The information object to check
*
* @return bool The information object passes the limit option or not
* @throws sfException When the limit option is not accepted
*
* @return bool The information object passes the limit option or not
*/
private function passesLimitOptionForIo($io)
{
Expand Down Expand Up @@ -1148,9 +1148,9 @@ private function passesLimitOptionForIo($io)
*
* @param QubitActor $actor The actor object to check
*
* @return bool The actor passes the limit option or not
* @throws sfException When the limit option is not accepted
*
* @return bool The actor passes the limit option or not
*/
private function passesLimitOptionForActor($actor)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/model/QubitJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ public function getNotes()
/**
* Generate a unique token property to associate unauthenticated users with jobs.
*
* @return QubitProperty generated user token property
* @throws sfException if a unique token can't be generated
*
* @return QubitProperty generated user token property
*/
public function generateUserTokenProperty()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/task/migrate/QubitMigrate104.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected function alterQubitMenus()
'parent_id' => 'QubitMenu_mainmenu',
'source_culture' => 'en',
'name' => 'admin',
'label' => ['de' => 'Administrator', 'en' => 'admin', 'es' => 'administrador', 'fa' => 'مدير', 'fr' => 'administrer', 'it' => 'amministra', 'sl' => 'administrator'],
'label' => ['de' => 'Administrator', 'en' => 'admin', 'es' => 'administrador', 'fa' => 'مدير', 'fr' => 'administrer', 'it' => 'amministra', 'sl' => 'administrator'],
'path' => 'user/list',
];
$this->data['QubitMenu']['QubitMenu_mainmenu_addedit_informationobject'] = [
Expand Down
44 changes: 22 additions & 22 deletions lib/task/migrate/migrations/arMigration0109.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,29 @@ public function up($configuration)
// Add the "Thematic Areas" terms
foreach (
[
['en' => 'Aboriginal Peoples', 'fr' => 'Peuples autochtones'],
['en' => 'Agriculture', 'fr' => 'Agriculture'],
['en' => 'Arts and Culture', 'fr' => 'Arts et culture'],
['en' => 'Communication', 'fr' => 'Communication'],
['en' => 'Education', 'fr' => 'Éducation'],
['en' => 'Environment', 'fr' => 'Environnement'],
['en' => 'Family / Domestic Life', 'fr' => 'Vie privée'],
['en' => 'Genealogical', 'fr' => 'Généalogique'],
['en' => 'Geography', 'fr' => 'Géographie'],
['en' => 'Aboriginal Peoples', 'fr' => 'Peuples autochtones'],
['en' => 'Agriculture', 'fr' => 'Agriculture'],
['en' => 'Arts and Culture', 'fr' => 'Arts et culture'],
['en' => 'Communication', 'fr' => 'Communication'],
['en' => 'Education', 'fr' => 'Éducation'],
['en' => 'Environment', 'fr' => 'Environnement'],
['en' => 'Family / Domestic Life', 'fr' => 'Vie privée'],
['en' => 'Genealogical', 'fr' => 'Généalogique'],
['en' => 'Geography', 'fr' => 'Géographie'],
['en' => 'Industry, Manufacturing and Commerce', 'fr' => 'Industries, fabrication, et commerce'],
['en' => 'Labour', 'fr' => 'Travail'],
['en' => 'Law and Justice', 'fr' => 'Droit et justice'],
['en' => 'Medicine and Health', 'fr' => 'Médecine et santé'],
['en' => 'Military', 'fr' => 'Forces armées'],
['en' => 'Natural Resources', 'fr' => 'Richesses naturelles'],
['en' => 'Politics and Government', 'fr' => 'Politique et gouvernement'],
['en' => 'Populations', 'fr' => 'Populations'],
['en' => 'Recreation / Leisure / Sports', 'fr' => 'Loisirs et sports'],
['en' => 'Religion', 'fr' => 'Religion'],
['en' => 'Science and Technology', 'fr' => 'Sciences et technologie'],
['en' => 'Social Organizations and Activities', 'fr' => 'Vie sociale'],
['en' => 'Transportation', 'fr' => 'Transport'],
['en' => 'Travel and Exploration', 'fr' => 'Voyages et exploration'],
['en' => 'Labour', 'fr' => 'Travail'],
['en' => 'Law and Justice', 'fr' => 'Droit et justice'],
['en' => 'Medicine and Health', 'fr' => 'Médecine et santé'],
['en' => 'Military', 'fr' => 'Forces armées'],
['en' => 'Natural Resources', 'fr' => 'Richesses naturelles'],
['en' => 'Politics and Government', 'fr' => 'Politique et gouvernement'],
['en' => 'Populations', 'fr' => 'Populations'],
['en' => 'Recreation / Leisure / Sports', 'fr' => 'Loisirs et sports'],
['en' => 'Religion', 'fr' => 'Religion'],
['en' => 'Science and Technology', 'fr' => 'Sciences et technologie'],
['en' => 'Social Organizations and Activities', 'fr' => 'Vie sociale'],
['en' => 'Transportation', 'fr' => 'Transport'],
['en' => 'Travel and Exploration', 'fr' => 'Voyages et exploration'],
]
as $termNames
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
</button>
<ul class="dropdown-menu mb-2">
<li><?php echo link_to(__('Create %1%', ['%1%' => sfConfig::get('app_ui_label_informationobject')]), [$resource, 'module' => 'accession', 'action' => 'addInformationObject'], ['class' => 'dropdown-item']); ?></li>
<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit'], ['class' => 'dropdown-item']); ?></li>
<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit'], ['class' => 'dropdown-item']); ?></li>
<li><?php echo link_to(__('Link physical storage'), [$resource, 'module' => 'object', 'action' => 'editPhysicalObjects'], ['class' => 'dropdown-item']); ?></li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

<li><hr class="dropdown-divider"></li>

<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit'], ['class' => 'dropdown-item']); ?></li>
<li><?php echo link_to(__('Create new rights'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'edit'], ['class' => 'dropdown-item']); ?></li>
<?php if ($resource->hasChildren()) { ?>
<li><?php echo link_to(__('Manage rights inheritance'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'manage'], ['class' => 'dropdown-item']); ?></li>
<li><?php echo link_to(__('Manage rights inheritance'), [$resource, 'sf_route' => 'slug/default', 'module' => 'right', 'action' => 'manage'], ['class' => 'dropdown-item']); ?></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 @@ -221,7 +221,7 @@
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<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>
<li><?php echo link_to(__('Link physical storage'), [$resource, 'module' => 'object', 'action' => 'editPhysicalObjects']); ?></li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion plugins/sfSkosPlugin/test/unit/importTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1024,5 +1024,5 @@ function getPrivateMethod($object, $name)

$result = $methodGetRootConcepts->invoke($importer);

$t->is(count($result), $totalConcepts, "Number of concepts found in ${item[name]} equals to {$totalConcepts}");
$t->is(count($result), $totalConcepts, "Number of concepts found in {$item[name]} equals to {$totalConcepts}");
}
4 changes: 2 additions & 2 deletions plugins/sfThumbnailPlugin/lib/sfThumbnail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function __destruct()
* @param string filename (with absolute path) of the image to load. If the filename is a http(s) URL, then an attempt to download the file will be made.
* @param mixed $image
*
* @return bool True if the image was properly loaded
* @throws Exception If the image cannot be loaded, or if its mime type is not supported
*
* @return bool True if the image was properly loaded
*/
public function loadFile($image)
{
Expand Down Expand Up @@ -122,9 +122,9 @@ public function loadFile($image)
* @param mixed $image
* @param mixed $mime
*
* @return bool True if the image was properly loaded
* @throws Exception If image mime type is not supported
*
* @return bool True if the image was properly loaded
*/
public function loadData($image, $mime)
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/sfWebBrowserPlugin/lib/sfWebBrowser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ public function getResponseDomCssSelector()
/**
* Get a SimpleXML version of the response.
*
* @return SimpleXMLElement The reponse contents
* @throws sfWebBrowserInvalidResponseException when response is not in a valid format
*
* @return SimpleXMLElement The reponse contents
*/
public function getResponseXML()
{
Expand Down
42 changes: 21 additions & 21 deletions test/functional/qubit/advancedSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@
// Information objects
// Properties: title, startDate, endDate, shoudlMatchSearch, filter
$cases = [
['Foobar1-'.$rand, '0500-02-03', '1100-04-04', false, ['t1', 't2']], // Case 1
['Foobar2-'.$rand, '1125-08-02', '1229-11-17', true, ['t1', 't2']], // Case 2
['Foobar3-'.$rand, '1712-01-02', '1992-04-22', false, ['t1', 't2']], // Case 3
['Foobar4-'.$rand, '0500-02-03', '1125-08-02', true, ['t1', 't2']], // Case 4
['Foobar5-'.$rand, '0500-02-03', '1992-04-22', true, ['t1', 't2']], // Case 5
['Foobar6-'.$rand, '1229-11-17', '1992-04-22', true, ['t1', 't2']], // Case 6
['Foobar7-'.$rand, '0500-02-03', '1100-04-04', false, ['t1']], // Case 7
['Foobar8-'.$rand, '0500-02-03', '1125-08-02', true, ['t1']], // Case 8
['Foobar9-'.$rand, '1125-08-02', '1229-11-17', true, ['t1']], // Case 9
['Foobar1-'.$rand, '0500-02-03', '1100-04-04', false, ['t1', 't2']], // Case 1
['Foobar2-'.$rand, '1125-08-02', '1229-11-17', true, ['t1', 't2']], // Case 2
['Foobar3-'.$rand, '1712-01-02', '1992-04-22', false, ['t1', 't2']], // Case 3
['Foobar4-'.$rand, '0500-02-03', '1125-08-02', true, ['t1', 't2']], // Case 4
['Foobar5-'.$rand, '0500-02-03', '1992-04-22', true, ['t1', 't2']], // Case 5
['Foobar6-'.$rand, '1229-11-17', '1992-04-22', true, ['t1', 't2']], // Case 6
['Foobar7-'.$rand, '0500-02-03', '1100-04-04', false, ['t1']], // Case 7
['Foobar8-'.$rand, '0500-02-03', '1125-08-02', true, ['t1']], // Case 8
['Foobar9-'.$rand, '1125-08-02', '1229-11-17', true, ['t1']], // Case 9
['Foobar10-'.$rand, '1125-08-02', '1229-11-17', true, ['t2']], // Case 10
['Foobar11-'.$rand, '1229-11-17', '1992-04-22', true, ['t2']], // Case 11
['Foobar11-'.$rand, '1229-11-17', '1992-04-22', true, ['t2']], // Case 11
['Foobar12-'.$rand, '1712-01-02', '1992-04-22', false, ['t2']], // Case 12
['Foobar13-'.$rand, '2015-00-00', '2020-00-00', true, ['t3', 't4']], // Case 13
['Foobar14-'.$rand, '2010-01-01', '2010-12-31', false, ['t3', 't4']], // Case 14
['Foobar15-'.$rand, '2010-01-01', '2015-02-28', true, ['t3', 't4']], // Case 15
['Foobar16-'.$rand, '2015-03-03', '2020-00-00', true, ['t3', 't4']], // Case 16
['Foobar17-'.$rand, '2020-00-00', '2025-00-00', false, ['t3', 't4']], // Case 17
['Foobar18-'.$rand, '2010-01-01', '2015-02-26', false, ['t3']], // Case 18
['Foobar19-'.$rand, '2020-00-00', '2025-00-00', true, ['t3']], // Case 19
['Foobar20-'.$rand, '2010-01-01', '2020-00-00', true, ['t3']], // Case 20
['Foobar21-'.$rand, '2015-03-03', '2020-00-00', true, ['t4']], // Case 21
['Foobar22-'.$rand, '2020-00-00', '2025-00-00', false, ['t4']], // Case 22
['Foobar23-'.$rand, '2010-01-01', '2010-12-31', true, ['t4']], // Case 23
['Foobar13-'.$rand, '2015-00-00', '2020-00-00', true, ['t3', 't4']], // Case 13
['Foobar14-'.$rand, '2010-01-01', '2010-12-31', false, ['t3', 't4']], // Case 14
['Foobar15-'.$rand, '2010-01-01', '2015-02-28', true, ['t3', 't4']], // Case 15
['Foobar16-'.$rand, '2015-03-03', '2020-00-00', true, ['t3', 't4']], // Case 16
['Foobar17-'.$rand, '2020-00-00', '2025-00-00', false, ['t3', 't4']], // Case 17
['Foobar18-'.$rand, '2010-01-01', '2015-02-26', false, ['t3']], // Case 18
['Foobar19-'.$rand, '2020-00-00', '2025-00-00', true, ['t3']], // Case 19
['Foobar20-'.$rand, '2010-01-01', '2020-00-00', true, ['t3']], // Case 20
['Foobar21-'.$rand, '2015-03-03', '2020-00-00', true, ['t4']], // Case 21
['Foobar22-'.$rand, '2020-00-00', '2025-00-00', false, ['t4']], // Case 22
['Foobar23-'.$rand, '2010-01-01', '2010-12-31', true, ['t4']], // Case 23
];

// Create information objects
Expand Down

0 comments on commit 1e9114f

Please sign in to comment.