Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
php-version:
- 8.3
- 8.4
- 8.5
dependencies:
- "highest"
symfony_version:
Expand All @@ -36,29 +37,39 @@ jobs:
- symfony_version: "6.4.*"
php-version: "8.4"
dependencies: "highest"
- symfony_version: "6.4.*"
php-version: "8.5"
dependencies: "highest"

# Test against latest Symfony 7.4
- symfony_version: "7.4.*"
php-version: "8.3"
dependencies: "highest"
- symfony_version: "7.4.*"
php-version: "8.4"
dependencies: "highest"
- symfony_version: "7.4.*"
php-version: "8.5"
dependencies: "highest"

# Test against the highest dependencies
- php-version: "8.3"
dependencies: "highest"
- php-version: "8.4"
dependencies: "highest"
- php-version: "8.5"
dependencies: "highest"

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: "zend.assertions=1"

- name: "symfony/flex is required to install the correct symfony version"
if: ${{ matrix.symfony_version }}
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require symfony/flex
tools: flex

- name: "Configure Symfony version for symfony/flex"
if: ${{ matrix.symfony_version }}
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ coding-standard-fix:
.PHONY: static-analysis
static-analysis: ## Run static analysis checks
./vendor/bin/phpstan --configuration=config/phpstan.neon --memory-limit=256M
./vendor/bin/psalm --config config/psalm.xml --no-cache

.PHONY: static-analysis-update
static-analysis-update: ## Update static analysis baselines
./vendor/bin/phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon --allow-empty-baseline
./vendor/bin/psalm --config config/psalm.xml --set-baseline=psalm.baseline.xml --show-info=true --no-cache

.PHONY: security-analysis
security-analysis: ## Run static analysis security checks
./vendor/bin/psalm -c config/psalm.xml --taint-analysis

.PHONY: unit-tests
unit-tests: ## Run unit test suite
Expand All @@ -40,4 +34,4 @@ composer-validate:
./vendor/bin/composer validate

.PHONY: check
check: coding-standard-check static-analysis security-analysis unit-tests ## Run all checks for local development iterations
check: coding-standard-check static-analysis unit-tests ## Run all checks for local development iterations
33 changes: 15 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,26 @@
],
"homepage": "https://github.com/protung/cloudinary-bundle",
"require": {
"php": "~8.3.0 || ~8.4.0",
"azjezz/psl": "^3.0.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"azjezz/psl": "^3.0.0 || ^4.0.0",
"cloudinary/cloudinary_php": "^3.1.1",
"symfony/console": "^6.4 || ^7.2",
"symfony/finder": "^6.4 || ^7.2",
"symfony/framework-bundle": "^6.4 || ^7.2",
"symfony/yaml": "^6.4 || ^7.2"
"symfony/console": "^6.4 || ^7.2 || ^8.0",
"symfony/finder": "^6.4 || ^7.2 || ^8.0",
"symfony/framework-bundle": "^6.4 || ^7.2 || ^8.0",
"symfony/yaml": "^6.4 || ^7.2 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^13.0",
"ergebnis/composer-normalize": "^2.47.0",
"php-standard-library/phpstan-extension": "^2.0.0",
"php-standard-library/psalm-plugin": "^2.3",
"phpstan/phpstan": "^2.1.17",
"doctrine/coding-standard": "^14.0.0",
"ergebnis/composer-normalize": "^2.48.2",
"php-standard-library/phpstan-extension": "^2.0.2",
"phpstan/phpstan": "^2.1.33",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.6",
"phpstan/phpstan-strict-rules": "^2.0.4",
"phpstan/phpstan-symfony": "^2.0.6",
"phpunit/phpunit": "^12.2.6",
"psalm/plugin-phpunit": "^0.19.5",
"phpstan/phpstan-phpunit": "^2.0.10",
"phpstan/phpstan-strict-rules": "^2.0.7",
"phpstan/phpstan-symfony": "^2.0.9",
"phpunit/phpunit": "^12.5.1",
"roave/security-advisories": "dev-latest",
"twig/twig": "^3.21",
"vimeo/psalm": "^6.12.1"
"twig/twig": "^3.22.1"
},
"suggest": {
"twig/twig": "Allow to use the cloudinary_url function/filter"
Expand Down
24 changes: 15 additions & 9 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
parameters:
ignoreErrors:
-
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
rawMessage: 'Argument of an invalid type mixed supplied for foreach, only iterables are supported.'
identifier: foreach.nonIterable
count: 1
path: ../src/Command/DeleteCommand.php

-
message: '#^Parameter \#1 \$prefix of method Cloudinary\\Api\\Admin\\AdminApi\:\:deleteAssetsByPrefix\(\) expects string, mixed given\.$#'
rawMessage: 'Parameter #1 $prefix of method Cloudinary\Api\Admin\AdminApi::deleteAssetsByPrefix() expects string, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/DeleteCommand.php

-
message: '#^Parameter \#1 \$publicIds of method Cloudinary\\Api\\Admin\\AdminApi\:\:deleteAssets\(\) expects array\|string, mixed given\.$#'
rawMessage: 'Parameter #1 $publicIds of method Cloudinary\Api\Admin\AdminApi::deleteAssets() expects array|string, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/DeleteCommand.php

-
message: '#^Parameter \#2 \.\.\.\$args of function Psl\\Str\\format expects float\|int\|string, mixed given\.$#'
rawMessage: 'Parameter #2 ...$args of function Psl\Str\format expects float|int|string, mixed given.'
identifier: argument.type
count: 2
path: ../src/Command/DeleteCommand.php

-
message: '#^Parameter \#1 \$publicId of method Cloudinary\\Api\\Admin\\AdminApi\:\:asset\(\) expects string, mixed given\.$#'
rawMessage: 'Parameter #1 $publicId of method Cloudinary\Api\Admin\AdminApi::asset() expects string, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/InfoCommand.php

-
message: '#^Parameter \#2 \$derivedResources of method Speicher210\\CloudinaryBundle\\Command\\InfoCommand\:\:renderDerivedResources\(\) expects array\<array\{id\: string, format\: string, bytes\: int, transformation\: string, url\: string\}\>, mixed given\.$#'
rawMessage: 'Parameter #2 $derivedResources of method Speicher210\CloudinaryBundle\Command\InfoCommand::renderDerivedResources() expects array<array{id: string, format: string, bytes: int, transformation: string, url: string}>, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/InfoCommand.php

-
message: '#^Parameter \#1 \$dirs of method Symfony\\Component\\Finder\\Finder\:\:in\(\) expects array\<string\>\|string, mixed given\.$#'
rawMessage: 'Parameter #1 $dirs of method Symfony\Component\Finder\Finder::in() expects array<string>|string, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/UploadCommand.php

-
message: '#^Parameter \#1 \$node of function Psl\\Filesystem\\get_filename expects non\-empty\-string, string given\.$#'
rawMessage: 'Parameter #1 $node of function Psl\Filesystem\get_filename expects non-empty-string, string given.'
identifier: argument.type
count: 1
path: ../src/Command/UploadCommand.php

-
message: '#^Parameter \#1 \$patterns of method Symfony\\Component\\Finder\\Finder\:\:name\(\) expects array\<string\>\|string, mixed given\.$#'
rawMessage: 'Parameter #1 $patterns of method Symfony\Component\Finder\Finder::name() expects array<string>|string, mixed given.'
identifier: argument.type
count: 1
path: ../src/Command/UploadCommand.php

-
rawMessage: 'Method Speicher210\CloudinaryBundle\DependencyInjection\Configuration::getConfigTreeBuilder() return type with generic class Symfony\Component\Config\Definition\Builder\TreeBuilder does not specify its types: T'
identifier: missingType.generics
count: 1
path: ../src/DependencyInjection/Configuration.php
33 changes: 0 additions & 33 deletions config/psalm.baseline.xml

This file was deleted.

24 changes: 0 additions & 24 deletions config/psalm.xml

This file was deleted.

4 changes: 2 additions & 2 deletions src/DependencyInjection/Speicher210CloudinaryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ final class Speicher210CloudinaryExtension extends ConfigurableExtension
#[Override]
protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yaml');

$container
->getDefinition(CloudinaryFactory::class)
Expand Down
4 changes: 2 additions & 2 deletions src/Factory/CloudinaryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use function array_key_exists;
use function parse_url;

final class CloudinaryFactory
final readonly class CloudinaryFactory
{
private readonly Configuration $configuration;
private Configuration $configuration;

/**
* @param array{url?: string, cloud_name?: string, access_identifier?: array{api_key: string, api_secret: string}, secure?: bool} $config
Expand Down
42 changes: 0 additions & 42 deletions src/Resources/config/services.xml

This file was deleted.

51 changes: 51 additions & 0 deletions src/Resources/config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:
Speicher210\CloudinaryBundle\Factory\CloudinaryFactory:
public: false
arguments:
- [ ]

speicher210_cloudinary.cloudinary:
class: Speicher210\CloudinaryBundle\Cloudinary\Cloudinary
public: true
factory: [ '@Speicher210\CloudinaryBundle\Factory\CloudinaryFactory', 'createCloudinary' ]

Cloudinary\Cloudinary:
alias: speicher210_cloudinary.cloudinary
public: true

speicher210_cloudinary.uploader:
class: Speicher210\CloudinaryBundle\Cloudinary\Uploader
public: true
factory: [ '@speicher210_cloudinary.cloudinary', 'uploadApi' ]

speicher210_cloudinary.admin:
class: Speicher210\CloudinaryBundle\Cloudinary\Admin
public: true
factory: [ '@speicher210_cloudinary.cloudinary', 'adminApi' ]

twig.extension.cloudinary:
class: Speicher210\CloudinaryBundle\Twig\Extension\CloudinaryExtension
public: true
arguments:
- '@speicher210_cloudinary.cloudinary'
tags:
- { name: 'twig.extension' }

Speicher210\CloudinaryBundle\Command\DeleteCommand:
arguments:
- '@speicher210_cloudinary.admin'
tags:
- { name: 'console.command' }

Speicher210\CloudinaryBundle\Command\InfoCommand:
arguments:
- '@speicher210_cloudinary.admin'
tags:
- { name: 'console.command' }

Speicher210\CloudinaryBundle\Command\UploadCommand:
arguments:
- '@speicher210_cloudinary.uploader'
tags:
- { name: 'console.command' }