diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 695780a..0c9be5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.1', '8.2', '8.3' ] + php: [ '8.2', '8.3', '8.4', '8.5' ] strategy: [ 'highest' ] sf_version: [''] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index c663e3d..ae4b9e9 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@master - name: PHP-CS-Fixer - uses: docker://jakzal/phpqa:php8.1-alpine + uses: docker://jakzal/phpqa:php8.2-alpine with: args: php-cs-fixer fix --diff --dry-run -vvv @@ -19,6 +19,6 @@ jobs: steps: - uses: actions/checkout@master - name: PHPStan - uses: docker://jakzal/phpqa:php8.1-alpine + uses: docker://jakzal/phpqa:php8.2-alpine with: args: phpstan analyze --no-progress diff --git a/.gitignore b/.gitignore index bc4d0f4..101afff 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /phpspec.yml /phpunit.xml /vendor/ +/.php-cs-fixer.cache diff --git a/Makefile b/Makefile index c001421..2cb6500 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ .PHONY: cs-fix phpstan DIR := ${CURDIR} -QA_IMAGE := jakzal/phpqa:php7.3-alpine +QA_IMAGE := jakzal/phpqa:php8.2-alpine cs-lint: - @docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff --dry-run -vvv + @docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --dry-run -vvv cs-fix: - @docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff -vvv + @docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix -vvv phpstan: @docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyse diff --git a/composer.json b/composer.json index fa423e7..2623b8f 100644 --- a/composer.json +++ b/composer.json @@ -9,18 +9,18 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nikic/php-parser": "^5.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/finder": "^5.4 || ^6.4 || ^7.0", + "symfony/finder": "^5.4 || ^6.4 || ^7.0 || ^8.0", "twig/twig": "^2.0 || ^3.0", "phpstan/phpdoc-parser": "^2.3" }, "require-dev": { - "symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0", - "symfony/translation": "^5.4 || ^6.4 || ^7.0", - "symfony/validator": "^5.4 || ^6.4 || ^7.0", - "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0", + "symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/translation": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/validator": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0", "knplabs/knp-menu": "^3.1" }, "autoload": { diff --git a/tests/Functional/BladeTest.php b/tests/Functional/BladeTest.php index 22c692a..b4faec6 100644 --- a/tests/Functional/BladeTest.php +++ b/tests/Functional/BladeTest.php @@ -38,7 +38,7 @@ private function getSourceLocations($relativePath) return $collection; } - public function testExtractLang() + public function testExtractLang(): void { $collection = $this->getSourceLocations('Blade/lang.blade.php'); @@ -47,7 +47,7 @@ public function testExtractLang() $this->assertEquals('foo.bar', $source->getMessage()); } - public function testExtractTrans() + public function testExtractTrans(): void { $collection = $this->getSourceLocations('Blade/trans.blade.php'); @@ -56,7 +56,7 @@ public function testExtractTrans() $this->assertEquals('foo.bar', $source->getMessage()); } - public function testExtractTransChoice() + public function testExtractTransChoice(): void { $collection = $this->getSourceLocations('Blade/trans_choice.blade.php'); diff --git a/tests/Functional/Visitor/Php/DescriptionTest.php b/tests/Functional/Visitor/Php/DescriptionTest.php index 44073b2..cda7299 100644 --- a/tests/Functional/Visitor/Php/DescriptionTest.php +++ b/tests/Functional/Visitor/Php/DescriptionTest.php @@ -16,7 +16,7 @@ final class DescriptionTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeLabelExplicit(), DescriptionType::class); diff --git a/tests/Functional/Visitor/Php/Knp/MenuTest.php b/tests/Functional/Visitor/Php/Knp/MenuTest.php index ca2cc57..a6a82af 100644 --- a/tests/Functional/Visitor/Php/Knp/MenuTest.php +++ b/tests/Functional/Visitor/Php/Knp/MenuTest.php @@ -18,7 +18,7 @@ final class MenuTest extends BasePHPVisitorTest { - public function testExtractOne() + public function testExtractOne(): void { $collection = $this->getSourceLocations(new ItemLabel(), Resources\Php\Knp\Menu::class); @@ -30,7 +30,7 @@ public function testExtractOne() $this->assertEquals('foo.second.label', $collection->get(3)->getMessage()); } - public function testExtractTwo() + public function testExtractTwo(): void { $collection = $this->getSourceLocations(new LinkTitle(), Resources\Php\Knp\Menu::class); diff --git a/tests/Functional/Visitor/Php/SourceLocationContainerExtractorTest.php b/tests/Functional/Visitor/Php/SourceLocationContainerExtractorTest.php index cd37842..62be0a6 100644 --- a/tests/Functional/Visitor/Php/SourceLocationContainerExtractorTest.php +++ b/tests/Functional/Visitor/Php/SourceLocationContainerExtractorTest.php @@ -19,7 +19,7 @@ */ final class SourceLocationContainerExtractorTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new SourceLocationContainerVisitor(), Resources\Php\SourceLocationContainer::class); diff --git a/tests/Functional/Visitor/Php/Symfony/ConstraintTest.php b/tests/Functional/Visitor/Php/Symfony/ConstraintTest.php index d4623dd..eb43cdc 100644 --- a/tests/Functional/Visitor/Php/Symfony/ConstraintTest.php +++ b/tests/Functional/Visitor/Php/Symfony/ConstraintTest.php @@ -20,7 +20,7 @@ */ final class ConstraintTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new Constraint(), Resources\Php\Symfony\Constraint::class); diff --git a/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransChoiceTest.php b/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransChoiceTest.php index 08adc82..ec8671d 100644 --- a/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransChoiceTest.php +++ b/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransChoiceTest.php @@ -20,7 +20,7 @@ */ final class ContainerAwareTransChoiceTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new ContainerAwareTransChoice(), Resources\Php\Symfony\ContainerAwareTransChoice::class); diff --git a/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransTest.php b/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransTest.php index 644e44e..9a6e837 100644 --- a/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransTest.php +++ b/tests/Functional/Visitor/Php/Symfony/ContainerAwareTransTest.php @@ -20,7 +20,7 @@ */ final class ContainerAwareTransTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new ContainerAwareTrans(), Resources\Php\Symfony\ContainerAwareTrans::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FlashMessageTest.php b/tests/Functional/Visitor/Php/Symfony/FlashMessageTest.php index fc1e37a..5568e4a 100644 --- a/tests/Functional/Visitor/Php/Symfony/FlashMessageTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FlashMessageTest.php @@ -20,7 +20,7 @@ */ final class FlashMessageTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FlashMessage(), Resources\Php\Symfony\FlashMessage::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormEmptyValueTest.php b/tests/Functional/Visitor/Php/Symfony/FormEmptyValueTest.php index f5874fa..76825ad 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormEmptyValueTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormEmptyValueTest.php @@ -20,7 +20,7 @@ */ class FormEmptyValueTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeEmptyValue(), Resources\Php\Symfony\EmptyValueType::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeChoicesTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeChoicesTest.php index cdaaeb5..75791bd 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeChoicesTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeChoicesTest.php @@ -19,7 +19,7 @@ */ class FormTypeChoicesTest extends BasePHPVisitorTest { - public function testSimpleSymfony3x() + public function testSimpleSymfony3x(): void { $collection = $this->getSourceLocations(new FormTypeChoices(), SimpleChoiceSymfony3xType::class); @@ -28,7 +28,7 @@ public function testSimpleSymfony3x() $this->assertEquals(10, $collection->get(0)->getLine()); } - public function testSimpleSymfony27() + public function testSimpleSymfony27(): void { $visitor = new FormTypeChoices(); $visitor->setSymfonyMajorVersion(2); @@ -42,7 +42,7 @@ public function testSimpleSymfony27() $this->assertEquals(12, $collection->get(0)->getLine()); } - public function testChainedChoice() + public function testChainedChoice(): void { $visitor = new FormTypeChoices(); $visitor->setSymfonyMajorVersion(3); @@ -53,7 +53,7 @@ public function testChainedChoice() $this->assertEquals('label2', $collection->get(1)->getMessage()); } - public function testExtractError() + public function testExtractError(): void { $collection = $this->getSourceLocations(new FormTypeChoices(), SimpleChoiceSymfony3xErrorType::class); @@ -61,7 +61,7 @@ public function testExtractError() $this->assertCount(1, $errors); } - public function testPassedChoices() + public function testPassedChoices(): void { $collection = $this->getSourceLocations(new FormTypeChoices(), SimpleChoicePassArrayType::class); @@ -70,7 +70,7 @@ public function testPassedChoices() $this->assertEquals(9, $collection->get(0)->getLine()); } - public function testChoiceTranslationDomain() + public function testChoiceTranslationDomain(): void { $collection = $this->getSourceLocations(new FormTypeChoices(), FormDomainChoiceType::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeHelpTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeHelpTest.php index bb18561..b62b940 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeHelpTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeHelpTest.php @@ -18,7 +18,7 @@ final class FormTypeHelpTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeHelp(), Resources\Php\Symfony\HelpFormType::class); @@ -28,7 +28,7 @@ public function testExtract() $this->assertEquals('form.help.text.but.no.label', $collection->get(1)->getMessage()); } - public function testExtractError() + public function testExtractError(): void { $collection = $this->getSourceLocations(new FormTypeHelp(), Resources\Php\Symfony\HelpFormErrorType::class); @@ -37,7 +37,7 @@ public function testExtractError() $this->assertCount(2, $errors); } - public function testChildVisitationNotBlocked() + public function testChildVisitationNotBlocked(): void { $collection = $this->getSourceLocations( [ diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeInvalidMessageTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeInvalidMessageTest.php index 6fa97d9..ac23681 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeInvalidMessageTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeInvalidMessageTest.php @@ -20,7 +20,7 @@ */ class FormTypeInvalidMessageTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeInvalidMessage(), Resources\Php\Symfony\FormInvalidMessage::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelExplicitTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelExplicitTest.php index 7e8c19e..bc2331b 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelExplicitTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelExplicitTest.php @@ -20,7 +20,7 @@ */ class FormTypeLabelExplicitTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeLabelExplicit(), Resources\Php\Symfony\ExplicitLabelType::class); @@ -35,13 +35,13 @@ public function testExtract() $this->assertCount(4, $collection->getErrors()); } - public function testWillNotExtractTypeless() + public function testWillNotExtractTypeless(): void { $collection = $this->getSourceLocations(new FormTypeLabelExplicit(), Resources\Php\Symfony\ExplicitLabelTypeless::class); $this->assertCount(0, $collection); } - public function testWithLabelFalse() + public function testWithLabelFalse(): void { $collection = $this->getSourceLocations(new FormTypeLabelExplicit(), Resources\Php\Symfony\ExplicitLabelFalseType::class); $this->assertEmpty($collection); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelImplicitTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelImplicitTest.php index c1afda0..9cae5d3 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelImplicitTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelImplicitTest.php @@ -19,7 +19,7 @@ */ class FormTypeLabelImplicitTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeLabelImplicit(), ImplicitLabelType::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelTest.php index 66f2f52..991068b 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeLabelTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeLabelTest.php @@ -43,7 +43,7 @@ public function __construct() parent::__construct(); } - public function testTranslationDomain() + public function testTranslationDomain(): void { $collection = $this->getSourceLocations($this->allFormVisitors, Resources\Php\Symfony\FormDomainType::class); diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypePlaceholderTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypePlaceholderTest.php index ed37c29..78c9a94 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypePlaceholderTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypePlaceholderTest.php @@ -21,7 +21,7 @@ */ final class FormTypePlaceholderTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypePlaceholder(), Resources\Php\Symfony\PlaceholderFormType::class); @@ -35,7 +35,7 @@ public function testExtract() $this->assertEquals('form.date_placeholder.day', $collection->get(5)->getMessage()); } - public function testExtractError() + public function testExtractError(): void { $collection = $this->getSourceLocations(new FormTypePlaceholder(), Resources\Php\Symfony\PlaceholderFormErrorType::class); @@ -44,7 +44,7 @@ public function testExtractError() $this->assertCount(3, $errors); } - public function testChildVisitationNotBlocked() + public function testChildVisitationNotBlocked(): void { $collection = $this->getSourceLocations( [ diff --git a/tests/Functional/Visitor/Php/Symfony/FormTypeTitleTest.php b/tests/Functional/Visitor/Php/Symfony/FormTypeTitleTest.php index c69d416..961b315 100644 --- a/tests/Functional/Visitor/Php/Symfony/FormTypeTitleTest.php +++ b/tests/Functional/Visitor/Php/Symfony/FormTypeTitleTest.php @@ -21,7 +21,7 @@ */ final class FormTypeTitleTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new FormTypeTitle(), Resources\Php\Symfony\TitleFormType::class); @@ -30,7 +30,7 @@ public function testExtract() $this->assertEquals('form.title.text', $collection->get(0)->getMessage()); } - public function testExtractError() + public function testExtractError(): void { $collection = $this->getSourceLocations(new FormTypeTitle(), Resources\Php\Symfony\TitleFormErrorType::class); @@ -39,7 +39,7 @@ public function testExtractError() $this->assertCount(1, $errors); } - public function testChildVisitationNotBlocked() + public function testChildVisitationNotBlocked(): void { $collection = $this->getSourceLocations( [ diff --git a/tests/Functional/Visitor/Php/Symfony/ValidationAnnotationTest.php b/tests/Functional/Visitor/Php/Symfony/ValidationAnnotationTest.php index 3a4e770..b295547 100644 --- a/tests/Functional/Visitor/Php/Symfony/ValidationAnnotationTest.php +++ b/tests/Functional/Visitor/Php/Symfony/ValidationAnnotationTest.php @@ -22,7 +22,7 @@ */ final class ValidationAnnotationTest extends BasePHPVisitorTest { - public function testExtractAnnotation() + public function testExtractAnnotation(): void { $factory = new LazyLoadingMetadataFactory(new AttributeLoader()); $extractor = new ValidationAnnotation($factory); diff --git a/tests/Functional/Visitor/Php/TranslateAnnotationVisitorTest.php b/tests/Functional/Visitor/Php/TranslateAnnotationVisitorTest.php index 022ea4b..180bc31 100644 --- a/tests/Functional/Visitor/Php/TranslateAnnotationVisitorTest.php +++ b/tests/Functional/Visitor/Php/TranslateAnnotationVisitorTest.php @@ -16,7 +16,7 @@ final class TranslateAnnotationVisitorTest extends BasePHPVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new TranslateAnnotationVisitor(), TestTranslateAnnotationFile::class); diff --git a/tests/Functional/Visitor/Twig/TranslationBlockTest.php b/tests/Functional/Visitor/Twig/TranslationBlockTest.php index 2db0734..c07a2ea 100644 --- a/tests/Functional/Visitor/Twig/TranslationBlockTest.php +++ b/tests/Functional/Visitor/Twig/TranslationBlockTest.php @@ -19,7 +19,7 @@ */ final class TranslationBlockTest extends BaseTwigVisitorTest { - public function testTrans() + public function testTrans(): void { $collection = $this->getSourceLocations(new TwigVisitor(), 'Twig/TranslationBlock/trans.html.twig'); @@ -37,7 +37,7 @@ public function testTrans() $this->assertEquals('messages', $source->getContext()['domain']); } - public function testTranschoice() + public function testTranschoice(): void { if (!class_exists(TransChoiceTokenParser::class)) { $this->markTestSkipped('Transchoice is not available anymore.'); diff --git a/tests/Functional/Visitor/Twig/TranslationFilterTest.php b/tests/Functional/Visitor/Twig/TranslationFilterTest.php index dd7bf65..8dacd23 100644 --- a/tests/Functional/Visitor/Twig/TranslationFilterTest.php +++ b/tests/Functional/Visitor/Twig/TranslationFilterTest.php @@ -18,7 +18,7 @@ */ final class TranslationFilterTest extends BaseTwigVisitorTest { - public function testExtract() + public function testExtract(): void { $collection = $this->getSourceLocations(new TwigVisitor(), 'Twig/TranslationFilter/trans.html.twig'); @@ -27,7 +27,7 @@ public function testExtract() $this->assertEquals('foobar', $source->getMessage()); } - public function testDescExtract() + public function testDescExtract(): void { $collection = $this->getSourceLocations(new TwigVisitor(), 'Twig/TranslationFilter/desc.html.twig'); @@ -37,7 +37,7 @@ public function testDescExtract() $this->assertEquals('baz', $source->getContext()['desc']); } - public function testDescExtractError() + public function testDescExtractError(): void { $collection = $this->getSourceLocations(new TwigVisitor(), 'Twig/TranslationFilter/desc-error.html.twig'); diff --git a/tests/Smoke/AllExtractorsTest.php b/tests/Smoke/AllExtractorsTest.php index 0c7549e..a2b82bc 100644 --- a/tests/Smoke/AllExtractorsTest.php +++ b/tests/Smoke/AllExtractorsTest.php @@ -43,7 +43,7 @@ */ class AllExtractorsTest extends TestCase { - public function testNoException() + public function testNoException(): void { $extractor = new Extractor(); $extractor->addFileExtractor($this->getPHPFileExtractor()); diff --git a/tests/Unit/Model/SourceLocationTest.php b/tests/Unit/Model/SourceLocationTest.php index 9b5617d..f56837a 100644 --- a/tests/Unit/Model/SourceLocationTest.php +++ b/tests/Unit/Model/SourceLocationTest.php @@ -16,7 +16,7 @@ class SourceLocationTest extends TestCase { - public function testCreateHere() + public function testCreateHere(): void { $location = SourceLocation::createHere('foobar', ['foo' => 'bar']); @@ -27,7 +27,7 @@ public function testCreateHere() $this->assertEquals(['foo' => 'bar'], $location->getContext()); } - public function testCreateHereViaCallback() + public function testCreateHereViaCallback(): void { $location = array_map('\Translation\Extractor\Model\SourceLocation::createHere', ['baz'])[0];