Skip to content

Commit

Permalink
Update php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Jan 30, 2025
1 parent 865009a commit 5def817
Show file tree
Hide file tree
Showing 59 changed files with 1,048 additions and 390 deletions.
8 changes: 7 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'assign_null_coalescing_to_coalesce_equal' => true,
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
'cast_spaces' => true,
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'include' => true,
'list_syntax' => true,
Expand All @@ -23,7 +25,7 @@
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
Expand All @@ -32,10 +34,14 @@
'phpdoc_scalar' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'return_type_declaration' => true,
'short_scalar_cast' => true,
'single_space_around_construct' => true,
'statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => true],
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'unary_operator_spaces' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
8 changes: 7 additions & 1 deletion .php_cs_module
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ return $config
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'assign_null_coalescing_to_coalesce_equal' => true,
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
'cast_spaces' => true,
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'include' => true,
'list_syntax' => true,
Expand All @@ -23,7 +25,7 @@ return $config
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
Expand All @@ -32,10 +34,14 @@ return $config
'phpdoc_scalar' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'return_type_declaration' => true,
'short_scalar_cast' => true,
'single_space_around_construct' => true,
'statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => true],
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'unary_operator_spaces' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
2 changes: 1 addition & 1 deletion application/src/Api/Adapter/ItemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function buildQuery(QueryBuilder $qb, array $query)
"$subItemAlias.itemSets",
$subItemSetAlias, 'WITH',
$qb->expr()->in("$subItemSetAlias.id", $this->createNamedParameter($qb, $itemSets))
);
);
$qb->andWhere($qb->expr()->notIn("omeka_root.id", $subQb->getDQL()));
}
}
Expand Down
36 changes: 18 additions & 18 deletions application/src/Api/Adapter/SiteAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,25 +150,25 @@ public function hydrate(Request $request, EntityInterface $entity,
$subErrorStore = new ErrorStore;
$subrequest = new Request(Request::CREATE, 'site_pages');
$subrequest->setContent(
[
'o:title' => $translator->translate('Welcome'),
'o:slug' => 'welcome',
'o:block' => [
[
'o:layout' => 'html',
'o:data' => ['html' => $this->getFirstPageContent()],
],
[
'o:layout' => 'lineBreak',
'o:data' => ['break_type' => 'opaque'],
],
[
'o:layout' => 'html',
'o:data' => ['html' => $this->getSecondPageContent()],
],
[
'o:title' => $translator->translate('Welcome'),
'o:slug' => 'welcome',
'o:block' => [
[
'o:layout' => 'html',
'o:data' => ['html' => $this->getFirstPageContent()],
],
]
);
[
'o:layout' => 'lineBreak',
'o:data' => ['break_type' => 'opaque'],
],
[
'o:layout' => 'html',
'o:data' => ['html' => $this->getSecondPageContent()],
],
],
]
);
try {
$adapter->hydrateEntity($subrequest, $page, $subErrorStore);
} catch (ValidationException $e) {
Expand Down
4 changes: 2 additions & 2 deletions application/src/Api/Adapter/SitePageAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public function validateEntity(EntityInterface $entity, ErrorStore $errorStore)
}
$site = $entity->getSite();
if ($site && $site->getId() && !$this->isUnique($entity, [
'slug' => $slug,
'site' => $entity->getSite(),
'slug' => $slug,
'site' => $entity->getSite(),
])) {
$errorStore->addError('o:slug', new Message(
'The slug "%s" is already taken.', // @translate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public function getJsonLd()
];
if ($this->modified()) {
$dateTime['o:modified'] = [
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
];
}

Expand Down
4 changes: 2 additions & 2 deletions application/src/Api/Representation/JobRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public function getJsonLd()
];
if ($this->ended()) {
$dateTime['o:ended'] = [
'@value' => $this->getDateTime($this->ended()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value' => $this->getDateTime($this->ended()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
];
}

Expand Down
4 changes: 2 additions & 2 deletions application/src/Api/Representation/SitePageRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function getJsonLd()
$modified = null;
if ($this->modified()) {
$modified = [
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
];
}
return [
Expand Down
6 changes: 3 additions & 3 deletions application/src/Api/Representation/SiteRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function getJsonLd()
$modified = null;
if ($this->modified()) {
$modified = [
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value' => $this->getDateTime($this->modified()),
'@type' => 'http://www.w3.org/2001/XMLSchema#dateTime',
];
}
$url = $this->getViewHelper('Url');
Expand Down Expand Up @@ -280,7 +280,7 @@ public function adminNav()

$iterator = new RecursiveIteratorIterator($nav->getContainer(), RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $page) {
if ($page->getPrivilege() && ! $page->getResource()) {
if ($page->getPrivilege() && !$page->getResource()) {
$page->setResource($this->resource);
}
}
Expand Down
14 changes: 7 additions & 7 deletions application/src/ColumnType/ColumnTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ interface ColumnTypeInterface
/**
* Get the label of this column type.
*/
public function getLabel() : string;
public function getLabel(): string;

/**
* Get the resource types that can use this column type.
*/
public function getResourceTypes() : array;
public function getResourceTypes(): array;

/**
* Get the maximum amount of this column type for one category.
*/
public function getMaxColumns() : ?int;
public function getMaxColumns(): ?int;

/**
* Render the data form of this column type.
*
* Form elements must have a "data-column-data-key" attribute with a value
* that corresponds to the key in the column data array.
*/
public function renderDataForm(PhpRenderer $view, array $data) : string;
public function renderDataForm(PhpRenderer $view, array $data): string;

/**
* Get the corresponding sort_by value of this column type.
*/
public function getSortBy(array $data) : ?string;
public function getSortBy(array $data): ?string;

/**
* Render the header of a column of this type.
*/
public function renderHeader(PhpRenderer $view, array $data) : string;
public function renderHeader(PhpRenderer $view, array $data): string;

/**
* Render the content of a column of this type.
*
* Return null to signal the use of a user-defined default.
*/
public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data) : ?string;
public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data): ?string;
}
14 changes: 7 additions & 7 deletions application/src/ColumnType/Created.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@

class Created implements ColumnTypeInterface
{
public function getLabel() : string
public function getLabel(): string
{
return 'Created'; // @translate
}

public function getResourceTypes() : array
public function getResourceTypes(): array
{
return ['items', 'item_sets', 'media', 'sites'];
}

public function getMaxColumns() : ?int
public function getMaxColumns(): ?int
{
return 1;
}

public function renderDataForm(PhpRenderer $view, array $data) : string
public function renderDataForm(PhpRenderer $view, array $data): string
{
return '';
}

public function getSortBy(array $data) : ?string
public function getSortBy(array $data): ?string
{
return 'created';
}

public function renderHeader(PhpRenderer $view, array $data) : string
public function renderHeader(PhpRenderer $view, array $data): string
{
return $this->getlabel();
}

public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data) : ?string
public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data): ?string
{
return $view->i18n()->dateFormat($resource->created());
}
Expand Down
14 changes: 7 additions & 7 deletions application/src/ColumnType/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@

class Id implements ColumnTypeInterface
{
public function getLabel() : string
public function getLabel(): string
{
return 'ID'; // @translate
}

public function getResourceTypes() : array
public function getResourceTypes(): array
{
return ['items', 'item_sets', 'media'];
}

public function getMaxColumns() : ?int
public function getMaxColumns(): ?int
{
return 1;
}

public function renderDataForm(PhpRenderer $view, array $data) : string
public function renderDataForm(PhpRenderer $view, array $data): string
{
return '';
}

public function getSortBy(array $data) : ?string
public function getSortBy(array $data): ?string
{
return 'id';
}

public function renderHeader(PhpRenderer $view, array $data) : string
public function renderHeader(PhpRenderer $view, array $data): string
{
return $this->getLabel();
}

public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data) : ?string
public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data): ?string
{
return $resource->id();
}
Expand Down
14 changes: 7 additions & 7 deletions application/src/ColumnType/IsOpen.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@

class IsOpen implements ColumnTypeInterface
{
public function getLabel() : string
public function getLabel(): string
{
return 'Is open'; // @translate
}

public function getResourceTypes() : array
public function getResourceTypes(): array
{
return ['item_sets'];
}

public function getMaxColumns() : ?int
public function getMaxColumns(): ?int
{
return 1;
}

public function renderDataForm(PhpRenderer $view, array $data) : string
public function renderDataForm(PhpRenderer $view, array $data): string
{
return '';
}

public function getSortBy(array $data) : ?string
public function getSortBy(array $data): ?string
{
return 'is_open';
}

public function renderHeader(PhpRenderer $view, array $data) : string
public function renderHeader(PhpRenderer $view, array $data): string
{
return $this->getLabel();
}

public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data) : ?string
public function renderContent(PhpRenderer $view, AbstractEntityRepresentation $resource, array $data): ?string
{
return $resource->isOpen()
? $view->translate('Yes')
Expand Down
Loading

0 comments on commit 5def817

Please sign in to comment.