Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update composer requirements: php 7.1, symfony 4.0, phpunit 7.1 * Create constraints form and entity readers * Remove constraints builders, use factories instead * Move unit tests into Tests/ * Rename ParsleyAssert\Type => ParsleyAssert\Email * Move classes * Rework bundle configuration * Better support for Type constraints * Avoid skipped tests * Update ci config
- Loading branch information
Showing
109 changed files
with
3,695 additions
and
3,048 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/build/ | ||
/vendor/ | ||
composer.lock | ||
/composer.lock | ||
/phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
checks: | ||
php: true | ||
|
||
filter: | ||
excluded_paths: | ||
- vendor/* | ||
excluded_paths: | ||
- 'Resources/' | ||
- 'Tests/' | ||
dependency_paths: | ||
- 'vendor/' | ||
|
||
build: | ||
nodes: | ||
analysis: | ||
tests: | ||
override: | ||
- php-scrutinizer-run | ||
- phpcs-run --extensions=php --standard=PSR2 --ignore=Resources/*,vendor/* . | ||
|
||
build_failure_conditions: | ||
- 'project.metric("scrutinizer.quality", < 9)' | ||
- 'project.metric("scrutinizer.test_coverage", < 1)' | ||
|
||
checks: | ||
php: | ||
code_rating: true | ||
|
||
tools: | ||
external_code_coverage: | ||
timeout: 500 | ||
external_code_coverage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace JBen87\ParsleyBundle\Constraint\Constraints; | ||
|
||
class Email extends Type | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getType(): string | ||
{ | ||
return static::TYPES['email']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace JBen87\ParsleyBundle\Constraint\Constraints; | ||
|
||
use JBen87\ParsleyBundle\Constraint\Constraint; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class GreaterThan extends Constraint | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @param array $options | ||
*/ | ||
public function __construct(array $options = []) | ||
{ | ||
parent::__construct($options); | ||
|
||
$this->value = $options['value']; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getAttribute(): string | ||
{ | ||
return 'data-parsley-gt'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getValue(): string | ||
{ | ||
return (string) $this->value; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver | ||
->setRequired(['value']) | ||
->setAllowedTypes('value', ['int']) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace JBen87\ParsleyBundle\Constraint\Constraints; | ||
|
||
use JBen87\ParsleyBundle\Constraint\Constraint; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class Length extends Constraint | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private $min; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $max; | ||
|
||
/** | ||
* @param array $options | ||
*/ | ||
public function __construct(array $options = []) | ||
{ | ||
parent::__construct($options); | ||
|
||
$this->min = $options['min']; | ||
$this->max = $options['max']; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getAttribute(): string | ||
{ | ||
return 'data-parsley-length'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getValue(): string | ||
{ | ||
return sprintf('[%d, %d]', $this->min, $this->max); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver | ||
->setRequired(['min', 'max']) | ||
->setAllowedTypes('min', ['int']) | ||
->setAllowedTypes('max', ['int']) | ||
; | ||
} | ||
} |
Oops, something went wrong.