Skip to content

Commit

Permalink
next release (#181)
Browse files Browse the repository at this point in the history
* add return annotation

To get rid of this warning: 

Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Knp\DictionaryBundle\Dictionary\Traceable" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in ImportYamlTest::testLoadYamlConfig with data set "oberon" from App\Tests\Service

* docs: remove $ so gitclip works (#186)

* Use dependency injection (#188)

getting the dictionary through DI is a better practice that getting it from the container.

* Allow Symfony 6.3

* refactor: remove support of php 7.4

* Add Symfony 6.2 to matrix (#183)

* chore: drop support of Symfony 6.1 & 6.2

* tests: remove beberlei/assert and replace it by webmozart/assert (already in indirect dependencies) (#185)

* fix: add missing Symfony 6.3 supported version constant

* refactor: ad type to Dictionary ArrayAccess methods

* ci: remove Symfony CLI security check (#194)

* refactor: fix cs issues

* ci: remove Symfony CLI security check

* test: add tests for Symfony 6.3 and php 8.2

---------

Co-authored-by: Tac Tacelosky <[email protected]>
  • Loading branch information
PedroTroller and tacman authored Jun 15, 2023
1 parent ead34f5 commit 2cd8ac2
Show file tree
Hide file tree
Showing 28 changed files with 217 additions and 254 deletions.
38 changes: 14 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ jobs:
steps:
- checkout
- run: |
echo 'deb [trusted=yes] https://repo.symfony.com/apt/ /' | tee /etc/apt/sources.list.d/symfony-cli.list
apt-get update
apt-get -y install git zip jq symfony-cli
apt-get -y install git zip jq
- run: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
Expand All @@ -43,19 +42,18 @@ jobs:
mv composer.new.json composer.json
cat composer.json
- run: composer update << parameters.composer-options >> --ignore-platform-req=ext-intl
- run: symfony security:check
- run: vendor/bin/phpstan analyse --no-progress --memory-limit=-1
- run: vendor/bin/phpspec run -v --config=phpspec.no-coverage.yml
- run: bin/lint-twig src/
- run: vendor/bin/php-cs-fixer fix --diff --dry-run -vvv
- run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run -vvv

workflows:
version: 2
workflow:
jobs:
- test:
name: php7.4
php: "7.4"
name: php8.0
php: "8.0"
matrix:
parameters:
symfony:
Expand All @@ -64,36 +62,28 @@ workflows:
- "--prefer-stable --prefer-lowest"
- "--prefer-stable"
- test:
name: php8.0
php: "8.0"
name: php8.1
php: "8.1"
minimum-stability: 'dev' # Remove on Symfony 6.4 release
matrix:
parameters:
symfony:
- "5.4"
- "6.0"
- "6.2"
- "6.3"
composer-options:
- "--prefer-stable --prefer-lowest"
- "--prefer-stable"
- test:
name: php8.1
php: "8.1"
name: php8.2
php: "8.2"
minimum-stability: 'dev' # Remove on Symfony 6.4 release
matrix:
parameters:
symfony:
- "5.4"
- "6.0"
- "6.1"
- "6.2"
- "6.3"
composer-options:
- "--prefer-stable --prefer-lowest"
- "--prefer-stable"
# - test:
# name: php8.1-dev
# php: "8.1"
# minimum-stability: "dev"
# matrix:
# parameters:
# symfony:
# - "6.2"
# composer-options:
# - "--prefer-stable --prefer-lowest"
# - "--prefer-stable"
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$config->setRules(
PedroTroller\CS\Fixer\RuleSetFactory::create()
->phpCsFixer(true)
->php(7.4, true)
->php(8.0, true)
->pedrotroller(true)
->enable('align_multiline_comment')
->enable('array_indentation')
Expand Down
25 changes: 13 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@
}
],
"require": {
"php": ">=7.4",
"symfony/config": "^5.4 || ^6.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/form": "^5.4 || ^6.0",
"symfony/http-foundation": "^5.4 || ^6.0",
"symfony/http-kernel": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0",
"php": ">=8.0",
"symfony/config": "^5.4 || ^6.2@dev",
"symfony/dependency-injection": "^5.4 || ^6.2@dev",
"symfony/form": "^5.4 || ^6.2@dev",
"symfony/http-foundation": "^5.4 || ^6.2@dev",
"symfony/http-kernel": "^5.4 || ^6.2@dev",
"symfony/validator": "^5.4 || ^6.2@dev",
"twig/twig": "^2.15.3 || ^3.4.3"
},
"require-dev": {
"beberlei/assert": "^3.3",
"fakerphp/faker": "^1.19",
"fakerphp/faker": "^1.20",
"friends-of-phpspec/phpspec-code-coverage": "^6.1",
"friendsofphp/php-cs-fixer": "^3.13",
"pedrotroller/php-cs-custom-fixer": "^2.28",
"phpspec/phpspec": "^7.2",
"phpspec/prophecy": "^1.15",
"phpstan/phpstan": "^1.9",
"symfony/twig-bridge": "^5.4 || ^6.0",
"symfony/var-dumper": "^5.4 || ^6.0"
"rector/rector": "^0.14.7",
"symfony/twig-bridge": "^5.4 || ^6.2@dev",
"symfony/var-dumper": "^5.4 || ^6.2@dev",
"webmozart/assert": "^1.11"
},
"minimum-stability": "stable",
"autoload": {
Expand All @@ -58,7 +59,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
"dev-master": "3.4.x-dev"
}
}
}
31 changes: 31 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig
->paths(
[
__DIR__.'/src',
]
)
;

$rectorConfig
->phpVersion(
PhpVersion::PHP_80
)
;

$rectorConfig
->sets(
[
LevelSetList::UP_TO_PHP_80,
]
)
;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace spec\Knp\DictionaryBundle\DependencyInjection\Compiler;

use Assert\Assert;
use Knp\DictionaryBundle\DependencyInjection\Compiler\DictionaryBuildingPass;
use Knp\DictionaryBundle\DependencyInjection\Compiler\DictionaryRegistrationPass;
use Knp\DictionaryBundle\Dictionary;
use Knp\DictionaryBundle\Dictionary\Factory\Aggregate;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Webmozart\Assert\Assert;

final class DictionaryBuildingPassSpec extends ObjectBehavior
{
Expand All @@ -35,23 +35,29 @@ function it_builds_a_value_as_key_dictionary_from_the_config(ContainerBuilder $c
$container->setDefinition(
'knp_dictionary.dictionary.dico1',
Argument::that(function ($definition): bool {
Assert::that($definition->getClass())->eq(Dictionary::class);
Assert::eq($definition->getClass(), Dictionary::class);

$factory = $definition->getFactory();

Assert::that($factory[0]->__toString())->eq(Aggregate::class);
Assert::eq((string) $factory[0], Aggregate::class);

Assert::that($factory[1])->eq('create');
Assert::eq($factory[1], 'create');

Assert::that($definition->getArguments())->eq([
'dico1',
Assert::eq(
$definition->getArguments(),
[
'type' => Dictionary::VALUE_AS_KEY,
'content' => ['foo', 'bar', 'baz'],
],
]);

Assert::that($definition->getTags())->eq([DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]);
'dico1',
[
'type' => Dictionary::VALUE_AS_KEY,
'content' => ['foo', 'bar', 'baz'],
],
]
);

Assert::eq(
$definition->getTags(),
[DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]
);

return true;
})
Expand All @@ -75,23 +81,26 @@ function it_builds_a_value_dictionary_from_the_config(ContainerBuilder $containe
$container->setDefinition(
'knp_dictionary.dictionary.dico1',
Argument::that(function ($definition): bool {
Assert::that($definition->getClass())->eq(Dictionary::class);
Assert::eq($definition->getClass(), Dictionary::class);

$factory = $definition->getFactory();

Assert::that($factory[0]->__toString())->eq(Aggregate::class);
Assert::eq((string) $factory[0], Aggregate::class);

Assert::that($factory[1])->eq('create');
Assert::eq($factory[1], 'create');

Assert::that($definition->getArguments())->eq([
'dico1',
Assert::eq(
$definition->getArguments(),
[
'type' => Dictionary::VALUE,
'content' => [2 => 'foo', 10 => 'bar', 100 => 'baz'],
],
]);
'dico1',
[
'type' => Dictionary::VALUE,
'content' => [2 => 'foo', 10 => 'bar', 100 => 'baz'],
],
]
);

Assert::that($definition->getTags(), [DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]);
Assert::eq($definition->getTags(), [DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]);

return true;
})
Expand All @@ -115,23 +124,26 @@ function it_builds_a_key_value_dictionary_from_the_config(ContainerBuilder $cont
$container->setDefinition(
'knp_dictionary.dictionary.dico1',
Argument::that(function ($definition): bool {
Assert::that($definition->getClass())->eq(Dictionary::class);
Assert::eq($definition->getClass(), Dictionary::class);

$factory = $definition->getFactory();

Assert::that($factory[0]->__toString())->eq(Aggregate::class);
Assert::eq((string) $factory[0], Aggregate::class);

Assert::that($factory[1])->eq('create');
Assert::eq($factory[1], 'create');

Assert::that($definition->getArguments())->eq([
'dico1',
Assert::eq(
$definition->getArguments(),
[
'type' => Dictionary::KEY_VALUE,
'content' => [2 => 'foo', 10 => 'bar', 100 => 'baz'],
],
]);

Assert::that($definition->getTags())->eq([DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]);
'dico1',
[
'type' => Dictionary::KEY_VALUE,
'content' => [2 => 'foo', 10 => 'bar', 100 => 'baz'],
],
]
);

Assert::eq($definition->getTags(), [DictionaryRegistrationPass::TAG_DICTIONARY => [[]]]);

return true;
})
Expand Down
Loading

0 comments on commit 2cd8ac2

Please sign in to comment.