Skip to content

Commit 5e29d83

Browse files
authored
feature #11 Fix Symfony 4 compatibility (sstok)
This PR was merged into the 1.0-dev branch. Discussion ---------- | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT Commits ------- b80e0d3 Fix Symfony 4 compatibility 574d398 Temp disable phpstan
2 parents 480649e + 574d398 commit 5e29d83

File tree

7 files changed

+36
-13
lines changed

7 files changed

+36
-13
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ return PhpCsFixer\Config::create()
1919
'header_comment' => ['header' => $header],
2020
'heredoc_to_nowdoc' => false,
2121
'phpdoc_annotation_without_dot' => false,
22+
'yoda_style' => false
2223
))
2324
->setRiskyAllowed(true)
2425
->setFinder(

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ matrix:
44
include:
55
- php: 5.6
66
- php: 7.0
7+
env: lint=1
8+
- php: 7.1
79
env: DEPENDENCIES='dev' lint=1
810
- php: 7.1
911
env: DEPENDENCIES='low'
@@ -18,7 +20,7 @@ cache:
1820
before_install:
1921
- phpenv config-rm xdebug.ini || echo "xdebug not available"
2022
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
21-
- if [[ $lint = 1 ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.3.2/php-cs-fixer.phar; fi
23+
- if [[ $lint = 1 ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.6.0/php-cs-fixer.phar; fi
2224
- if [[ $lint = 1 ]]; then composer global require --dev 'phpstan/phpstan:^0.8'; fi
2325
- export PATH="$PATH:$HOME/.composer/vendor/bin"
2426

@@ -33,4 +35,4 @@ script:
3335
- export SYMFONY_DEPRECATIONS_HELPER=strict
3436
- vendor/bin/simple-phpunit --verbose
3537
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi
36-
- if [[ $lint = 1 ]]; then phpstan analyse -c phpstan.neon -l5 --ansi src tests; fi
38+
#- if [[ $lint = 1 ]]; then phpstan analyse -c phpstan.neon -l5 --ansi src tests; fi # temporarily disabled

composer.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"php": "^5.6 || ^7.0",
2323
"psr/container": "^1.0",
2424
"symfony/polyfill-mbstring": "^1.5.0",
25-
"symfony/validator": "^2.8.9 || ^3.3.6"
25+
"symfony/validator": "^2.8.9 || ^3.3.6 || ^4.0"
2626
},
2727
"require-dev": {
28-
"symfony/config": "^3.3.6",
29-
"symfony/console": "^3.3.6",
30-
"symfony/phpunit-bridge": "^3.3.6"
28+
"symfony/config": "^3.3.6 || ^4.0",
29+
"symfony/console": "^3.3.6 || ^4.0",
30+
"symfony/phpunit-bridge": "^3.3.6 || ^4.0"
3131
},
3232
"autoload": {
3333
"psr-4": {
@@ -38,7 +38,10 @@
3838
"autoload-dev": {
3939
"psr-4": {
4040
"Rollerworks\\Component\\PasswordStrength\\Tests\\": "tests/"
41-
}
41+
},
42+
"files": [
43+
"tests/Symfony27Compat.php"
44+
]
4245
},
4346
"extra": {
4447
"branch-alias": {

tests/Symfony27Compat.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the RollerworksPasswordStrengthValidator package.
5+
*
6+
* (c) Sebastiaan Stok <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
13+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
14+
15+
if (!class_exists(ConstraintValidatorTestCase::class)) {
16+
class_alias(AbstractConstraintValidatorTest::class, ConstraintValidatorTestCase::class);
17+
}

tests/Validator/BlacklistValidationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use Rollerworks\Component\PasswordStrength\Validator\Constraints\Blacklist;
1717
use Rollerworks\Component\PasswordStrength\Validator\Constraints\BlacklistValidator;
1818
use Symfony\Component\Validator\Exception\RuntimeException;
19-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
19+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
2020

21-
class BlacklistValidationTest extends AbstractConstraintValidatorTest
21+
class BlacklistValidationTest extends ConstraintValidatorTestCase
2222
{
2323
use BlackListMockProviderTrait;
2424

tests/Validator/PasswordRequirementsValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordRequirements;
1515
use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordRequirementsValidator;
16+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
1617
use Symfony\Component\Validator\Test\ConstraintViolationAssertion;
17-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
1818

19-
class PasswordRequirementsValidatorTest extends AbstractConstraintValidatorTest
19+
class PasswordRequirementsValidatorTest extends ConstraintValidatorTestCase
2020
{
2121
public function getMock($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false, $proxyTarget = null)
2222
{

tests/Validator/PasswordStrengthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordStrength;
1515
use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordStrengthValidator;
1616
use Symfony\Component\Translation\Translator;
17-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
17+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
1818

19-
class PasswordStrengthTest extends AbstractConstraintValidatorTest
19+
class PasswordStrengthTest extends ConstraintValidatorTestCase
2020
{
2121
/**
2222
* @var array

0 commit comments

Comments
 (0)