From 6e8318d7880e5dde6bab76b902d14a817cecd757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Tue, 4 Jul 2017 11:01:10 +0200 Subject: [PATCH] Dev --- .travis.yml | 17 +- composer.json | 60 ++----- ruleset.xml | 17 ++ src/DI/Annotation/AnnotationLoader.php | 4 +- .../Annotation/DoctrineAnnotationLoader.php | 2 +- src/DI/Annotation/NetteAnnotationLoader.php | 2 +- src/DI/ApiExtension.php | 25 ++- src/DI/JsonApiExtension.php | 10 ++ src/DI/Loader/ILoader.php | 2 +- src/DI/MiddlewareApiExtension.php | 2 +- src/Http/Request/ApiRequest.php | 31 ---- src/Middlewares/ApiContentNegotiation.php | 21 ++- src/Middlewares/ApiEmitter.php | 2 +- src/Middlewares/ApiMiddleware.php | 74 +------- src/Middlewares/ApiPrefix.php | 56 ------ src/Middlewares/ApiRouter.php | 161 ------------------ .../Negotiation/IRequestNegotiator.php | 2 +- .../Negotiation/IResponseNegotiator.php | 2 +- .../Negotiation/SuffixNegotiator.php | 27 +-- .../Transformer/IInTransformer.php | 19 --- .../Transformer/IOutTransformer.php | 19 --- .../Negotiation/Transformer/ITransformer.php | 8 - .../Transformer/DebugTransformer.php | 2 +- src/Middlewares/Transformer/ITransformer.php | 29 ++++ .../Transformer/JsonTransformer.php | 6 +- src/Router/ApiRouter.php | 12 +- src/Schema/EndpointHandler.php | 2 - src/Schema/EndpointParameter.php | 1 + src/Schema/Serialization/ArrayHydrator.php | 2 +- .../Serialization/ArraySerializator.php | 2 +- src/Schema/Serialization/IHydrator.php | 2 +- src/Schema/Serialization/ISerializator.php | 2 +- .../IValidation.php} | 4 +- .../PathValidation.php} | 5 +- .../RootPathValidation.php} | 5 +- .../Validator/SchemaBuilderValidator.php | 8 +- src/Tracy/Panel/ApiPanel/ApiPanel.php | 2 +- ...andler.php => ContainerServiceHandler.php} | 2 +- .../Schema/Validator/Impl/PathValidator.phpt | 20 +-- 39 files changed, 158 insertions(+), 511 deletions(-) create mode 100644 ruleset.xml delete mode 100644 src/Middlewares/ApiPrefix.php delete mode 100644 src/Middlewares/ApiRouter.php delete mode 100644 src/Middlewares/Negotiation/Transformer/IInTransformer.php delete mode 100644 src/Middlewares/Negotiation/Transformer/IOutTransformer.php delete mode 100644 src/Middlewares/Negotiation/Transformer/ITransformer.php rename src/Middlewares/{Negotiation => }/Transformer/DebugTransformer.php (95%) create mode 100644 src/Middlewares/Transformer/ITransformer.php rename src/Middlewares/{Negotiation => }/Transformer/JsonTransformer.php (88%) rename src/Schema/{Validator/IValidator.php => Validation/IValidation.php} (72%) rename src/Schema/{Validator/Impl/PathValidator.php => Validation/PathValidation.php} (96%) rename src/Schema/{Validator/Impl/RootPathValidator.php => Validation/RootPathValidation.php} (94%) rename src/UI/{ServiceHandler.php => ContainerServiceHandler.php} (96%) diff --git a/.travis.yml b/.travis.yml index ecb4c13..5884af9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,12 @@ php: - 7.0 - 7.1 - hhvm - - hhvm-nightly matrix: fast_finish: true allow_failures: - php: hhvm - - php: hhvm-nightly include: - php: 5.6 @@ -32,24 +30,17 @@ before_script: # Composer - travis_retry composer install --no-interaction # Coverage - - if [[ "$TRAVIS_PHP_VERSION" == "7.0" && "$COMPOSER_FLAG" == "" ]]; then COVERAGE=1; fi - # Phpstan - - if [[ "$TRAVIS_PHP_VERSION" == "7.1" && "$COMPOSER_FLAG" == "" ]]; then PHPSTAN=1; fi + - if [[ "$TRAVIS_PHP_VERSION" == "7.1" && "$COMPOSER_FLAG" == "" ]]; then COVERAGE=1; fi script: # Quality Assurance - - composer run-script qa-linter - - composer run-script qa-codesniffer + - travis_retry composer qa # Nette\Tester - - composer run-script ci + - composer run-script tester # Nette\Tester + CodeCoverage - - if [ "$COVERAGE" != "" ]; then composer run-script ci-coverage; fi - - # PHPSTAN - - if [ "$PHPSTAN" != "" ]; then composer require phpstan/phpstan:^0.6.4; fi - - if [ "$PHPSTAN" != "" ]; then composer run-script qa-phpstan; fi + - if [ "$COVERAGE" != "" ]; then composer tester-coverage; fi after_script: # Coverage (Coveralls) diff --git a/composer.json b/composer.json index 9b5db00..322fbbd 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "authors": [ { "name": "Milan Felix Sulc", - "homepage": "https://jfx.cz" + "homepage": "https://f3l1x.io" }, { "name": "Tlapnet", @@ -24,10 +24,10 @@ "contributte/psr-7": "^0.1.2" }, "require-dev": { - "ninjify/qa": "^0.3.3", + "ninjify/qa": "^0.4.0", "ninjify/nunjuck": "^0.1.4", - "mockery/mockery": "^0.9.8", - "nette/di": "^2.4.6", + "mockery/mockery": "^0.9.9", + "nette/di": "^2.4.7", "doctrine/annotations": "^1.3.1", "nette/reflection": "^2.4.1", "tracy/tracy": "^2.4.6", @@ -52,54 +52,14 @@ }, "scripts": { "qa": [ - "@qa-linter", - "@qa-codesniffer" + "linter src tests", + "codesniffer src tests" ], - "qa-codesniffer": [ - "Ninjify\\Composer\\Script\\CodeSniffer::execute" + "tester": [ + "tester -s -p php --colors 1 -c tests/php-unix.ini tests/cases" ], - "qa-codefixer": [ - "Ninjify\\Composer\\Script\\CodeFixer::execute" - ], - "qa-linter": [ - "Ninjify\\Composer\\Script\\Linter::execute" - ], - "qa-tester": [ - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini" - ], - "qa-tester-info": [ - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini -i" - ], - "qa-coverage": [ - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src" - ], - "qa-phpstan": [ - "phpstan analyze --level 5 src tests" - ], - "ci": [ - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -i", - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php" - ], - "ci-coverage": [ - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src -i", - "tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src" + "tester-coverage": [ + "tester -s -p php --colors 1 -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases" ] - }, - "extra": { - "ninjify": { - "qa": { - "codesniffer": { - "ruleset": "nette", - "folders": ["src", "tests"] - }, - "codefixer": { - "ruleset": "nette", - "folders": ["src", "tests"] - }, - "linter": { - "folders": ["src", "tests"] - } - } - } } } diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 0000000..9fc51a9 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + /tests/tmp + diff --git a/src/DI/Annotation/AnnotationLoader.php b/src/DI/Annotation/AnnotationLoader.php index 3e5186b..c7c4402 100644 --- a/src/DI/Annotation/AnnotationLoader.php +++ b/src/DI/Annotation/AnnotationLoader.php @@ -1,8 +1,8 @@ addDefinition($this->prefix('handler')) ->setClass(IHandler::class) - ->setFactory(ServiceHandler::class); + ->setFactory(ContainerServiceHandler::class); $builder->addDefinition($this->prefix('schema')) ->setClass(ApiSchema::class); @@ -154,8 +153,8 @@ protected function loadAnnotations() protected function validateSchema($builder) { $validator = new SchemaBuilderValidator(); - $validator->add(new RootPathValidator()); - $validator->add(new PathValidator()); + $validator->add(new RootPathValidation()); + $validator->add(new PathValidation()); $validator->validate($builder); } diff --git a/src/DI/JsonApiExtension.php b/src/DI/JsonApiExtension.php index e69de29..4f35129 100644 --- a/src/DI/JsonApiExtension.php +++ b/src/DI/JsonApiExtension.php @@ -0,0 +1,10 @@ +getPsr7()->getQueryParams()[$name]; } - /** - * DATA ******************************************************************** - */ - - /** - * @return bool - */ - public function hasData() - { - return $this->data !== NULL; - } - - /** - * @param mixed $data - * @return static - */ - public function setData($data) - { - $this->data = $data; - - return $this; - } - - /** - * @return mixed - */ - public function getData() - { - return $this->data; - } - } diff --git a/src/Middlewares/ApiContentNegotiation.php b/src/Middlewares/ApiContentNegotiation.php index 42317e2..695b431 100644 --- a/src/Middlewares/ApiContentNegotiation.php +++ b/src/Middlewares/ApiContentNegotiation.php @@ -1,11 +1,11 @@ addNegotiations($negotiators); + $this->parseOptions($options); } /** @@ -102,6 +104,17 @@ public function addNegotiations(array $negotiators) } } + /** + * @param array $options + * @return void + */ + public function parseOption(array $options) + { + if (isset($options['catch'])) { + $this->setCatchException($options['catch']); + } + } + /** * API - INVOKING ********************************************************** */ diff --git a/src/Middlewares/ApiEmitter.php b/src/Middlewares/ApiEmitter.php index e446aa2..153fd9d 100644 --- a/src/Middlewares/ApiEmitter.php +++ b/src/Middlewares/ApiEmitter.php @@ -1,6 +1,6 @@ invokers = $invokers; - } - /** * API - MIDDLEWARE ******************************************************** */ @@ -37,45 +22,20 @@ public function __construct(array $invokers) */ public function __invoke(ServerRequestInterface $psr7Request, ResponseInterface $psr7Response, callable $next) { - // Process this middleware - $apiResponse = $this->invoke($psr7Request, $psr7Response); + // Create API request & response + $apiRequest = $this->createApiRequest($psr7Request, $psr7Response); + $apiResponse = $this->createApiResponse($psr7Request, $psr7Response); - // Pass to next middleware - $psr7Response = $next($psr7Request, $apiResponse->getPsr7()); + /** @var ApiResponse $apiResponse */ + $apiResponse = $next($apiRequest, $apiResponse); - return $psr7Response; + return $apiResponse->getPsr7(); } /** * HELPERS ***************************************************************** */ - /** - * @param ServerRequestInterface $psr7Request - * @param ResponseInterface $psr7Response - * @return ApiResponse - */ - protected function invoke(ServerRequestInterface $psr7Request, ResponseInterface $psr7Response) - { - // Create API request & response - $apiRequest = $this->createApiRequest($psr7Request, $psr7Response); - $apiResponse = $this->createApiResponse($psr7Request, $psr7Response); - - /** @var callable $invoker */ - $invoker = $this->createChain($this->invokers); - - // Pass this API request/response to API invokers - $apiResponse = $invoker( - $apiRequest, - $apiResponse, - function (ApiRequest $request, ApiResponse $response) { - return $response; - } - ); - - return $apiResponse; - } - /** * @param ServerRequestInterface $psr7Request * @param ResponseInterface $psr7Response @@ -96,24 +56,4 @@ protected function createApiResponse(ServerRequestInterface $psr7Request, Respon return (new ApiResponse())->withPsr7($psr7Response); } - /** - * @param callable[] $invokers - * @return callable - */ - protected function createChain(array $invokers) - { - // Last invoker - $next = function (ApiRequest $request, ApiResponse $response) { - return $response; - }; - - while ($invoker = array_pop($invokers)) { - $next = function (ApiRequest $request, ApiResponse $response) use ($invoker, $next) { - return $invoker($request, $response, $next); - }; - } - - return $next; - } - } diff --git a/src/Middlewares/ApiPrefix.php b/src/Middlewares/ApiPrefix.php deleted file mode 100644 index 9a44be7..0000000 --- a/src/Middlewares/ApiPrefix.php +++ /dev/null @@ -1,56 +0,0 @@ -prefix = sprintf('/%s', trim($prefix, '/')); - } - - /** - * API - INVOKING ********************************************************** - */ - - /** - * @param ApiRequest $request - * @param ApiResponse $response - * @param callable $next - * @return ApiResponse - */ - public function __invoke(ApiRequest $request, ApiResponse $response, callable $next) - { - $psr7Request = $request->getPsr7(); - $uri = $psr7Request->getUri(); - - // Does URL path start with given API prefix? - if (strncmp($uri->getPath(), $this->prefix, strlen($this->prefix)) === 0) { - $newPath = str_replace($this->prefix, NULL, $uri->getPath()); - - // Update request with path without prefix - $request = $request->withPsr7( - $psr7Request->withUri( - $psr7Request->getUri()->withPath($newPath) - ) - ); - } - - // Pass to next API middleware - return $next($request, $response); - } - -} diff --git a/src/Middlewares/ApiRouter.php b/src/Middlewares/ApiRouter.php deleted file mode 100644 index dc7c732..0000000 --- a/src/Middlewares/ApiRouter.php +++ /dev/null @@ -1,161 +0,0 @@ -mask = $mask; - } - - /** - * API - INVOKING ********************************************************** - */ - - /** - * @param ApiRequest $request - * @param ApiResponse $response - * @param callable $next - * @return ApiResponse - */ - public function invoke(ApiRequest $request, ApiResponse $response, callable $next) - { - $matched = $this->match($request, $response); - - // Handle matched point (by request) - if ($matched !== NULL) { - // Pass to next invoker - return $next($matched, $response); - } - - // Pass to fallback - return $this->fallback($request, $response); - } - - /** - * HELPERS ***************************************************************** - */ - - /** - * @param ApiRequest $request - * @param ApiResponse $response - * @return ApiRequest|NULL - */ - protected function match(ApiRequest $request, ApiResponse $response) - { - $route = $this->compile(); - $psr7 = $request->getPsr7(); - $path = $psr7->getUri()->getPath(); - - // Try match URL path - $match = Regex::match($path, $route['regex']); - - // We have a match, hallelujah! - if ($match !== NULL) { - $psr7 = $psr7 - ->withAttribute(self::ATTR_MATCHED_PATTERN, $route['pattern']) - ->withAttribute(self::ATTR_MATCHED_REGEX, $route['regex']) - ->withAttribute(self::ATTR_MATCHED_PATH, $path) - ->withAttribute(self::ATTR_MATCHED_ATTRS, $match); - - foreach ($route['variables'] as $variable) { - if (isset($match[$variable])) { - $psr7 = $psr7->withAttribute(sprintf('%s-%s', self::ATTR_MATCHED_ATTR, $variable), $match[$variable]); - } - } - - // API: url attribute - if (isset($match[self::ATTR_VARIABLE_URL])) { - $psr7 = $psr7->withAttribute(ApiMiddleware::ATTR_URL, $match[self::ATTR_VARIABLE_URL]); - } - - // API: format attribute - if (isset($match[self::ATTR_VARIABLE_FORMAT])) { - $psr7 = $psr7->withAttribute(ApiMiddleware::ATTR_FORMAT, $match[self::ATTR_VARIABLE_FORMAT]); - } - - // Replace psr7 request in this api request - $request = $request->withPsr7($psr7); - - return $request; - } - - return NULL; - } - - /** - * @return array - */ - protected function compile() - { - $regex = sprintf('#%s#U', $this->mask); - - // Build route - $route = [ - 'pattern' => $this->mask, - 'regex' => $regex, - 'variables' => [], - ]; - - // Match and compile regex variables - $matched = Regex::matchAll($this->mask, '#{(\?)?([a-zA-Z0-9]+)(?:\:(.*))?}#U'); - if ($matched) { - $variables = []; - foreach ($matched[0] as $n => $variable) { - $optional = !empty($matched[1][$n]); - $name = $matched[2][$n]; - $re = $matched[3][$n] ?: '.+'; - - // Validate multi usage of 1 variable - if (in_array($name, $variables)) throw new InvalidStateException(sprintf('Variable %s is already used', $name)); - $variables[] = $name; - - // Update regex - $regex = str_replace($variable, sprintf('(?P<%s>%s)%s', $name, $re, $optional ? '?' : ''), $regex); - } - - $route['variables'] = $variables; - $route['regex'] = $regex; - } - - return $route; - } - - /** - * @param ApiRequest $request - * @param ApiResponse $response - * @return ApiResponse - */ - protected function fallback(ApiRequest $request, ApiResponse $response) - { - $response->setStatus(404); - $response->setBody('No matched middleware route by given URL'); - - return $response; - } - -} diff --git a/src/Middlewares/Negotiation/IRequestNegotiator.php b/src/Middlewares/Negotiation/IRequestNegotiator.php index e7dbe7c..f073317 100644 --- a/src/Middlewares/Negotiation/IRequestNegotiator.php +++ b/src/Middlewares/Negotiation/IRequestNegotiator.php @@ -1,6 +1,6 @@ transformers[$suffix] = $transformer; } @@ -90,6 +90,8 @@ public function negotiateRequest(ApiRequest $request, ApiResponse $response) ->withAttribute(self::ATTR_SUFFIX, $suffix) ); + // @todo handle incomming request + return $request; } } @@ -136,17 +138,6 @@ public function negotiateResponse(ApiRequest $request, ApiResponse $response) * HELPERS ***************************************************************** */ - /** - * @param IOutTransformer $transformer - * @param ApiRequest $request - * @param ApiResponse $response - * @return ApiResponse - */ - protected function transform(IOutTransformer $transformer, ApiRequest $request, ApiResponse $response) - { - return $transformer->encode($response); - } - /** * Match transformer for the suffix? (.json?) * diff --git a/src/Middlewares/Negotiation/Transformer/IInTransformer.php b/src/Middlewares/Negotiation/Transformer/IInTransformer.php deleted file mode 100644 index 29c9917..0000000 --- a/src/Middlewares/Negotiation/Transformer/IInTransformer.php +++ /dev/null @@ -1,19 +0,0 @@ -getContents(), TRUE); - $request->setData($body); + $request->withPsr7( + $request->getPsr7()->withParsedBody($body) + ); return $request; } diff --git a/src/Router/ApiRouter.php b/src/Router/ApiRouter.php index 9718caf..19ef008 100644 --- a/src/Router/ApiRouter.php +++ b/src/Router/ApiRouter.php @@ -2,7 +2,6 @@ namespace Contributte\Api\Router; -use Contributte\Api\Bridges\Middlewares\ApiMiddleware; use Contributte\Api\Http\Request\ApiRequest; use Contributte\Api\Schema\ApiSchema; use Contributte\Api\Schema\Endpoint; @@ -75,18 +74,11 @@ protected function compareUrl(Endpoint $endpoint, ApiRequest $request) { // Parse url from ApiRequest $psr7 = $request->getPsr7(); - - // If ServerRequestInterface has a right API attribute, - // then use them as URL address (attribute should be filled in routing phase) - if ($psr7->getAttribute(ApiMiddleware::ATTR_URL)) { - $url = $psr7->getAttribute(ApiMiddleware::ATTR_URL); - } else { - $url = $request->getUri()->getPath(); - } + $url = $request->getUri()->getPath(); // Url has always slash at the beginning // and no trailing slash at the end - $url = sprintf('/%s', trim($url, '/')); + $url = '/' . trim($url, '/'); // Try to match against the pattern $match = Regex::match($url, $endpoint->getPattern()); diff --git a/src/Schema/EndpointHandler.php b/src/Schema/EndpointHandler.php index 7916e1c..fa0c687 100644 --- a/src/Schema/EndpointHandler.php +++ b/src/Schema/EndpointHandler.php @@ -5,8 +5,6 @@ final class EndpointHandler { - const TYPE_CONTROLLER = 1; - /** @var string */ private $class; diff --git a/src/Schema/EndpointParameter.php b/src/Schema/EndpointParameter.php index 96ca660..a070b96 100644 --- a/src/Schema/EndpointParameter.php +++ b/src/Schema/EndpointParameter.php @@ -11,6 +11,7 @@ final class EndpointParameter const TYPE_FLOAT = 4; const TYPE_BOOLEAN = 5; const TYPE_DATETIME = 6; + const TYPE_OBJECT = 7; /** @var string */ private $name; diff --git a/src/Schema/Serialization/ArrayHydrator.php b/src/Schema/Serialization/ArrayHydrator.php index 8504c05..f3b1a36 100644 --- a/src/Schema/Serialization/ArrayHydrator.php +++ b/src/Schema/Serialization/ArrayHydrator.php @@ -1,6 +1,6 @@ validators[] = $validator; } diff --git a/src/Tracy/Panel/ApiPanel/ApiPanel.php b/src/Tracy/Panel/ApiPanel/ApiPanel.php index 5de3ba7..b02d478 100644 --- a/src/Tracy/Panel/ApiPanel/ApiPanel.php +++ b/src/Tracy/Panel/ApiPanel/ApiPanel.php @@ -1,6 +1,6 @@ setPath('foobar'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, '@Path "foobar" in "c1::foo()" must starts with "/" (slash).'); }); @@ -34,7 +34,7 @@ test(function () { $c1m1->setPath('/foobar/'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, '@Path "/foobar/" in "c1::foo()" must not ends with "/" (slash).'); }); @@ -53,7 +53,7 @@ test(function () { $c1m2->addMethod('GET'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, 'Duplicate @Path "/foobar" in c1 at methods "foo2()" and "foo1()"'); }); @@ -72,7 +72,7 @@ test(function () { $c1m2->setMethods(['POST', 'PUT']); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, 'Duplicate @Path "/foobar" in c1 at methods "foo2()" and "foo1()"'); }); @@ -91,7 +91,7 @@ test(function () { $c1m2->setMethods(['POST']); try { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); } catch (Exception $e) { Assert::fail('This is fail. Paths+Method are different.'); @@ -108,7 +108,7 @@ test(function () { $c1m1->addMethod('GET'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, '@Path "/{foo$}" in "c1::foo1()" contains illegal characters "$". Allowed characters are only [a-zA-Z0-9-_/{}].'); }); @@ -123,7 +123,7 @@ test(function () { $c1m1->addMethod('GET'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, '@Path "/{%foo}" in "c1::foo1()" contains illegal characters "%". Allowed characters are only [a-zA-Z0-9-_/{}].'); }); @@ -138,7 +138,7 @@ test(function () { $c1m1->addMethod('GET'); Assert::exception(function () use ($builder) { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); }, ValidationException::class, '@Path "/{foo&&&bar}" in "c1::foo1()" contains illegal characters "&&&". Allowed characters are only [a-zA-Z0-9-_/{}].'); }); @@ -152,7 +152,7 @@ test(function () { $c1m1->setPath('/{foo}/{bar}'); $c1m1->addMethod('GET'); try { - $validator = new PathValidator(); + $validator = new PathValidation(); $validator->validate($builder); } catch (Exception $e) { Assert::fail('This is fail. Parameters are OK.');