Skip to content

Commit

Permalink
chore: Bumped
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Oct 11, 2024
1 parent d440357 commit 1caadd8
Show file tree
Hide file tree
Showing 38 changed files with 2,032 additions and 1,417 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install Dependencies
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
- name: Run Unit tests
run: vendor/bin/phpunit -v --whitelist ./src tests
- name: Run atoum unit tests
run: vendor/bin/atoum -d tests
- name: Run PHP Code Sniffer
run: vendor/bin/phpcs -p ./src
- name: Run PHPStan
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Roadiz
#
/pimple.json

# Ignore Google webmaster tool verification
/google*.html
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2024 Ambroise Maupate
Copyright © 2023 Ambroise Maupate

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
test:
vendor/bin/atoum -d tests
vendor/bin/phpstan analyse -c phpstan.neon
vendor/bin/phpcs --report=full --report-file=./report.txt -p ./src

dev-test:
vendor/bin/atoum -d tests -l

phpcs:
vendor/bin/phpcs --report=full --report-file=./report.txt -p ./src

phpcbf:
vendor/bin/phpcbf --report=full --report-file=./report.txt -p ./src
30 changes: 12 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,26 @@
"ext-zip": "*",
"ext-simplexml": "*",
"ext-fileinfo": "*",
"doctrine/orm": "~2.19.0",
"doctrine/orm": "~2.17.0",
"enshrined/svg-sanitize": "^0.15",
"guzzlehttp/guzzle": "^7.2.0",
"guzzlehttp/psr7": "^2.0",
"intervention/image": "^2.5",
"league/flysystem": "^3.0",
"monolog/monolog": "^1.24.0 || ^2.1.1",
"symfony/asset": "6.4.*",
"symfony/console": "6.4.*",
"symfony/event-dispatcher": "6.4.*",
"symfony/filesystem": "6.4.*",
"symfony/finder": "6.4.*",
"symfony/http-foundation": "6.4.*",
"symfony/options-resolver": "6.4.*",
"symfony/serializer": "6.4.*",
"symfony/asset": "5.4.*",
"symfony/console": "5.4.*",
"symfony/event-dispatcher": "5.4.*",
"symfony/filesystem": "5.4.*",
"symfony/finder": "5.4.*",
"symfony/http-foundation": "5.4.*",
"symfony/options-resolver": "5.4.*",
"symfony/serializer": "5.4.*",
"twig/twig": "^3.1"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^9.5",
"api-platform/metadata": "^3.2.12",
"atoum/atoum": "^4.0.0",
"squizlabs/php_codesniffer": "^3.5",
"phpstan/phpstan": "^1.5.3",
"phpstan/phpstan-doctrine": "^1.3"
Expand All @@ -55,11 +54,6 @@
"RZ\\Roadiz\\Documents\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"RZ\\Roadiz\\Documents\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
Expand All @@ -68,8 +62,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
"dev-master": "2.2.x-dev",
"dev-develop": "2.3.x-dev"
}
}
}
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3"
services:
test80:
image: roadiz/php80-runner
working_dir: /build
command: >
bash -c "
composer install -o &&
make test"
volumes:
- ./:/build
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
parameters:
level: 7
level: max
paths:
- src
excludePaths:
- */node_modules/*
- */bower_components/*
- */static/*
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '#Call to an undefined method Doctrine\\Persistence\\ObjectRepository#'
- '#Call to an undefined method Doctrine\\Persistence\\ObjectManager#'
- '#Call to an undefined method Doctrine\\ORM\\EntityRepository#'
Expand All @@ -22,6 +20,8 @@ parameters:
- '#but returns Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'
- '#does not accept Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

includes:
- vendor/phpstan/phpstan-doctrine/extension.neon
Expand Down
4 changes: 2 additions & 2 deletions src/Console/DocumentClearFolderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ protected function getDocumentQueryBuilder(FolderInterface $folder): QueryBuilde
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);
$folderId = $input->getArgument('folderId');

if (!\is_numeric($folderId) || $folderId <= 0) {
$folderId = intval($input->getArgument('folderId'));

Check failure on line 40 in src/Console/DocumentClearFolderCommand.php

View workflow job for this annotation

GitHub Actions / run-tests (8.1)

Parameter #1 $value of function intval expects array|bool|float|int|resource|string|null, mixed given.

Check failure on line 40 in src/Console/DocumentClearFolderCommand.php

View workflow job for this annotation

GitHub Actions / run-tests (8.2)

Parameter #1 $value of function intval expects array|bool|float|int|resource|string|null, mixed given.

Check failure on line 40 in src/Console/DocumentClearFolderCommand.php

View workflow job for this annotation

GitHub Actions / run-tests (8.3)

Parameter #1 $value of function intval expects array|bool|float|int|resource|string|null, mixed given.
if ($folderId <= 0) {
throw new \InvalidArgumentException('Folder ID must be a valid ID');
}
$em = $this->getManager();
Expand Down
5 changes: 4 additions & 1 deletion src/DocumentArchiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
*/
final class DocumentArchiver
{
public function __construct(private readonly FilesystemOperator $documentsStorage)
private FilesystemOperator $documentsStorage;

public function __construct(FilesystemOperator $documentsStorage)
{
$this->documentsStorage = $documentsStorage;
}

/**
Expand Down
25 changes: 19 additions & 6 deletions src/DownscaleImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,27 @@

final class DownscaleImageManager
{
protected EntityManagerInterface $em;
protected ?LoggerInterface $logger;
protected int $maxPixelSize = 0;
protected string $rawImageSuffix = ".raw";
protected ImageManager $imageManager;
private FilesystemOperator $documentsStorage;

public function __construct(
private readonly EntityManagerInterface $em,
private readonly FilesystemOperator $documentsStorage,
private readonly ImageManager $imageManager,
private readonly ?LoggerInterface $logger = null,
private readonly int $maxPixelSize = 0,
private readonly string $rawImageSuffix = ".raw"
EntityManagerInterface $em,
FilesystemOperator $documentsStorage,
ImageManager $imageManager,
?LoggerInterface $logger = null,
int $maxPixelSize = 0,
string $rawImageSuffix = ".raw"
) {
$this->maxPixelSize = $maxPixelSize;
$this->rawImageSuffix = $rawImageSuffix;
$this->em = $em;
$this->logger = $logger;
$this->imageManager = $imageManager;
$this->documentsStorage = $documentsStorage;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/Exceptions/DocumentWithoutFileException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@

final class DocumentWithoutFileException extends \RuntimeException
{
public function __construct(private readonly DocumentInterface $document)
private DocumentInterface $document;

public function __construct(DocumentInterface $document)
{
$this->document = $document;
parent::__construct(sprintf('Document (%s) does not have a file on system.', (string) $document));
}

/**
* @return DocumentInterface
*/
public function getDocument(): DocumentInterface
{
return $this->document;
Expand Down
5 changes: 0 additions & 5 deletions src/MediaFinders/AbstractDeezerEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,4 @@ public function getSource(array &$options = []): string
// https://widget.deezer.com/widget/dark/playlist/9313425622
return $baseUri . '?' . http_build_query($queryString);
}

protected function areDuplicatesAllowed(): bool
{
return true;
}
}
5 changes: 0 additions & 5 deletions src/MediaFinders/AbstractMixcloudEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,4 @@ public function getSource(array &$options = []): string

return 'https://www.mixcloud.com/widget/iframe/?' . http_build_query($queryString);
}

protected function areDuplicatesAllowed(): bool
{
return true;
}
}
7 changes: 1 addition & 6 deletions src/MediaFinders/AbstractPodcastFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function createDocumentFromFeed(

if (null !== $file) {
$documentFactory->setFile($file);
$document = $documentFactory->getDocument(false, $this->areDuplicatesAllowed());
$document = $documentFactory->getDocument();
if (null !== $document) {
/*
* Create document metas
Expand Down Expand Up @@ -239,9 +239,4 @@ public function getThumbnailURL(): ?string
}
return null;
}

protected function areDuplicatesAllowed(): bool
{
return true;
}
}
5 changes: 0 additions & 5 deletions src/MediaFinders/AbstractSoundcloudEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,4 @@ public function getSource(array &$options = []): string

return 'https://w.soundcloud.com/player/?' . http_build_query($queryString);
}

protected function areDuplicatesAllowed(): bool
{
return true;
}
}
5 changes: 0 additions & 5 deletions src/MediaFinders/AbstractSpotifyEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,4 @@ public function getSource(array &$options = []): string

return $this->embedId;
}

protected function areDuplicatesAllowed(): bool
{
return true;
}
}
Loading

0 comments on commit 1caadd8

Please sign in to comment.