Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78494c6

Browse files
authored
chore: cs (#32)
1 parent ec2158f commit 78494c6

File tree

140 files changed

+404
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+404
-515
lines changed

.php-cs-fixer.dist.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,22 @@
88

99
$config = new PhpCsFixer\Config();
1010
return $config->setRules([
11-
'@PSR12' => true,
12-
'array_syntax' => ['syntax' => 'short'],
13-
14-
// imports
11+
'@PER-CS2.0' => true,
12+
'@PER-CS2.0:risky' => true,
1513
'fully_qualified_strict_types' => true,
1614
'global_namespace_import' => [
1715
'import_classes' => false,
1816
'import_constants' => false,
1917
'import_functions' => false,
2018
],
21-
'no_leading_import_slash' => true,
2219
'no_unneeded_import_alias' => true,
2320
'no_unused_imports' => true,
2421
'ordered_imports' => [
2522
'sort_algorithm' => 'alpha',
26-
'imports_order' => ['const', 'class', 'function']
23+
'imports_order' => ['class', 'function', 'const']
2724
],
28-
'single_line_after_imports' => true,
29-
'no_useless_else' => true,
30-
'no_useless_return' => true,
3125
'declare_strict_types' => true,
26+
'native_function_invocation' => ['include' => ['@compiler_optimized']],
3227
'header_comment' => [
3328
'header' => <<<EOF
3429
This file is part of rekalogika/file-src package.

packages/file-association-entity/src/EmbeddedMetadata.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function getOther(string $key): int|string|bool|null
7575
$this->other = [];
7676
}
7777

78-
if (!array_key_exists($key, $this->other)) {
78+
if (!\array_key_exists($key, $this->other)) {
7979
throw new MetadataNotFoundException($key);
8080
}
8181

@@ -172,7 +172,7 @@ public function delete(string $key): void
172172
Constants::FILE_MODIFICATION_TIME => $this->modificationTime = null,
173173
Constants::MEDIA_WIDTH => $this->width = null,
174174
Constants::MEDIA_HEIGHT => $this->height = null,
175-
default => $this->unsetOther($key)
175+
default => $this->unsetOther($key),
176176
};
177177
}
178178

@@ -187,6 +187,6 @@ public function merge(iterable $metadata): void
187187
#[\Override]
188188
public function count(): int
189189
{
190-
return count($this->getOthers()) + 6;
190+
return \count($this->getOthers()) + 6;
191191
}
192192
}

packages/file-association-entity/src/FileCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class FileCollection extends CollectionDecorator implements DirectoryInter
3939
*/
4040
public function __construct(
4141
Collection $files,
42-
private readonly null|string|(TranslatableInterface&\Stringable) $name = null
42+
private readonly null|string|(TranslatableInterface&\Stringable) $name = null,
4343
) {
4444
parent::__construct($files);
4545
}

packages/file-association-entity/src/FileDecorator.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FileDecorator implements FileInterface
3131

3232
public static function getFile(
3333
?FileInterface $file,
34-
EmbeddedMetadata $metadata
34+
EmbeddedMetadata $metadata,
3535
): ?FileInterface {
3636
if ($metadata->isFilePresent() === false) {
3737
// metadata says the file does not exist, and the file does not
@@ -70,7 +70,7 @@ public static function getFile(
7070
public static function setFile(
7171
?FileInterface $input,
7272
?FileInterface &$file,
73-
EmbeddedMetadata $metadata
73+
EmbeddedMetadata $metadata,
7474
): void {
7575
$metadata->clear();
7676

@@ -87,7 +87,7 @@ public static function setFile(
8787
public static function setFileMandatory(
8888
FileInterface $input,
8989
FileInterface &$file,
90-
EmbeddedMetadata $metadata
90+
EmbeddedMetadata $metadata,
9191
): void {
9292
$metadata->clear();
9393
$file = $input;
@@ -100,9 +100,8 @@ public static function setFileMandatory(
100100

101101
private function __construct(
102102
private FileInterface $file,
103-
private EmbeddedMetadata $metadata
104-
) {
105-
}
103+
private EmbeddedMetadata $metadata,
104+
) {}
106105

107106
//
108107
// other methods
@@ -115,13 +114,13 @@ public static function syncMetadata(FileInterface $file): void
115114
{
116115
if (!$file instanceof self) {
117116
throw new \InvalidArgumentException(
118-
sprintf('"syncMetadata()" only accepts %s', static::class)
117+
\sprintf('"syncMetadata()" only accepts %s', static::class),
119118
);
120119
}
121120

122121
$file->metadata->clear();
123122
$file->metadata->merge(
124-
$file->file->get(RawMetadataInterface::class) ?? []
123+
$file->file->get(RawMetadataInterface::class) ?? [],
125124
);
126125
}
127126

@@ -143,7 +142,7 @@ public function get(string $id)
143142

144143
/** @psalm-suppress MixedReturnStatement */
145144
return MetadataFactory::create(
146-
$this->get(RawMetadataInterface::class) ?? new RawMetadata()
145+
$this->get(RawMetadataInterface::class) ?? new RawMetadata(),
147146
)
148147
->get($id);
149148
}

packages/file-association-entity/src/FileMetadataDecorator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class FileMetadataDecorator implements RawMetadataInterface, \IteratorAggregate
2727
public function __construct(
2828
private readonly RawMetadataInterface $embeddedMetadata,
2929
private readonly RawMetadataInterface $fileMetadata,
30-
) {
31-
}
30+
) {}
3231

3332
#[\Override]
3433
public function getIterator(): \Traversable

packages/file-association-entity/src/ReadableFileCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class ReadableFileCollection extends ReadableCollectionDecorator implement
3939
*/
4040
public function __construct(
4141
ReadableCollection $files,
42-
private readonly null|string|(TranslatableInterface&\Stringable) $name = null
42+
private readonly null|string|(TranslatableInterface&\Stringable) $name = null,
4343
) {
4444
parent::__construct($files);
4545
}

packages/file-association-entity/src/UnsetFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class UnsetFile extends \Exception implements NullFileInterface
3333
*/
3434
public function __construct(string $className, string $propertyName)
3535
{
36-
parent::__construct(sprintf(
36+
parent::__construct(\sprintf(
3737
'File property "%s" in class "%s" is unset. This might be caused by the use of `AbstractQuery::toIterable()`. If that is the case, you can: 1. stop involving "%s" in the query; 2. pre-hydrate the file entities before the query; or 3. use other means to iterate the query.',
3838
$propertyName,
3939
$className,
40-
$className
40+
$className,
4141
));
4242
}
4343

packages/file-association/src/Attribute/AsFileAssociation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AsFileAssociation
2727
public function __construct(
2828
string $fetch = 'EAGER',
2929
) {
30-
if (!in_array($fetch, ['EAGER', 'LAZY'])) {
30+
if (!\in_array($fetch, ['EAGER', 'LAZY'])) {
3131
throw new \InvalidArgumentException('Fetch mode can only be EAGER or LAZY.');
3232
}
3333

packages/file-association/src/Attribute/WithFileAssociation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@
1414
namespace Rekalogika\File\Association\Attribute;
1515

1616
#[\Attribute(\Attribute::TARGET_CLASS)]
17-
class WithFileAssociation
18-
{
19-
}
17+
class WithFileAssociation {}

packages/file-association/src/Contracts/FileLocationResolverInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ interface FileLocationResolverInterface
2626
{
2727
public function getFileLocation(
2828
object $object,
29-
string $propertyName
29+
string $propertyName,
3030
): FilePointerInterface;
3131
}

0 commit comments

Comments
 (0)