Skip to content

Commit

Permalink
bug #76 Allow symfony translation contracts (danut007ro)
Browse files Browse the repository at this point in the history
This PR was merged into the 0.5-dev branch.

Discussion
----------

Allow symfony translation contracts

On a new sf5 installation there is no `TranslatorInterface` in translation component since it has been moved to contracts. This pull request allows to use either of them.

Commits
-------

2a7d757 Allow symfony translation contracts
  • Loading branch information
xabbuh committed Mar 2, 2020
2 parents 02cdf72 + 2a7d757 commit 27d67bb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ env:
matrix:
include:
- php: 7.1
env: PHPSTAN_CONFIG=phpstan-php-71.neon
- php: 7.2
- php: 7.3
- php: 7.4
- php: 7.1
env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" PHPSTAN_CONFIG=phpstan-low.neon
env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" PHPSTAN_CONFIG=phpstan-php-71.neon
- php: 7.2
env: COMPOSER_OPTIONS=""

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.13",
"phpstan/phpstan": "^0.12.1",
"phpstan/phpstan": "^0.12.4",
"symfony/phpunit-bridge": "^4.4||^5.0",
"symfony/translation": "^4.4||^5.0"
},
Expand Down
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,11 @@ parameters:
count: 1
path: src/ExceptionHandling/FormExceptionHandler.php

-
message: "#^Property SensioLabs\\\\RichModelForms\\\\ExceptionHandling\\\\FormExceptionHandler\\:\\:\\$translator has unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface as its type\\.$#"
count: 1
path: src/ExceptionHandling/FormExceptionHandler.php

-
message: "#^Parameter \\$translator of method SensioLabs\\\\RichModelForms\\\\ExceptionHandling\\\\FormExceptionHandler\\:\\:__construct\\(\\) has invalid typehint type Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
count: 1
path: src/ExceptionHandling/FormExceptionHandler.php

-
message: "#^Method SensioLabs\\\\RichModelForms\\\\ExceptionHandling\\\\FormExceptionHandler\\:\\:handleException\\(\\) has parameter \\$data with no typehint specified\\.$#"
count: 1
path: src/ExceptionHandling/FormExceptionHandler.php

-
message: "#^Call to method trans\\(\\) on an unknown class Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\.$#"
count: 1
path: src/ExceptionHandling/FormExceptionHandler.php

-
message: "#^Method SensioLabs\\\\RichModelForms\\\\ExceptionHandling\\\\FallbackExceptionHandler\\:\\:getError\\(\\) has parameter \\$data with no typehint specified\\.$#"
count: 1
Expand Down
10 changes: 0 additions & 10 deletions phpstan-low.neon → phpstan-php-71.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ includes:

parameters:
ignoreErrors:
-
message: "#^Method SensioLabs\\\\RichModelForms\\\\DataMapper\\\\DataMapper\\:\\:mapDataToForms\\(\\) has parameter \\$data with no typehint specified\\.$#"
count: 1
path: src/DataMapper/DataMapper.php

-
message: "#^Parameter \\#2 \\$forms of method Symfony\\\\Component\\\\Form\\\\DataMapperInterface\\:\\:mapDataToForms\\(\\) expects iterable\\<Symfony\\\\Component\\\\Form\\\\FormInterface\\>&Traversable, array\\<int, Symfony\\\\Component\\\\Form\\\\FormInterface\\> given\\.$#"
count: 1
path: src/DataMapper/DataMapper.php

-
message: "#^Method SensioLabs\\\\RichModelForms\\\\DataMapper\\\\DataMapper\\:\\:mapFormsToData\\(\\) has parameter \\$data with no typehint specified\\.$#"
count: 1
path: src/DataMapper/DataMapper.php

-
message: "#^Parameter \\#1 \\$forms of method Symfony\\\\Component\\\\Form\\\\DataMapperInterface\\:\\:mapFormsToData\\(\\) expects iterable\\<Symfony\\\\Component\\\\Form\\\\FormInterface\\>&Traversable, array\\<int, Symfony\\\\Component\\\\Form\\\\FormInterface\\> given\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/ExceptionHandling/FormExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
Expand Down

0 comments on commit 27d67bb

Please sign in to comment.