Commit f04f0a06 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Merge branch '0.1.x'

Showing with 31 additions and 15 deletions
+31 -15
...@@ -11,7 +11,6 @@ install-vendors: ...@@ -11,7 +11,6 @@ install-vendors:
variables: variables:
COMPOSER_NO_INTERACTION: "1" COMPOSER_NO_INTERACTION: "1"
script: script:
- phpenmod iconv
- composer validate - composer validate
- composer install -n --prefer-dist --no-suggest --no-progress --no-scripts --ignore-platform-reqs - composer install -n --prefer-dist --no-suggest --no-progress --no-scripts --ignore-platform-reqs
cache: cache:
...@@ -44,6 +43,7 @@ php-cs-fixer: ...@@ -44,6 +43,7 @@ php-cs-fixer:
phpcpd: phpcpd:
<<: *test <<: *test
script: vendor/bin/phpcpd --fuzzy src tests script: vendor/bin/phpcpd --fuzzy src tests
allow_failure: true
phpunit: phpunit:
<<: *test <<: *test
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {
"php": "^7.1", "php": "^7.1",
"ext-json": "*",
"ext-zip": "*",
"api-platform/core": "^2.2", "api-platform/core": "^2.2",
"doctrine/cache": "^1.8", "doctrine/cache": "^1.8",
"doctrine/inflector": "^1.3", "doctrine/inflector": "^1.3",
......
...@@ -47,9 +47,6 @@ class PropertyMetadataFactory ...@@ -47,9 +47,6 @@ class PropertyMetadataFactory
/** @var ClassName */ /** @var ClassName */
private $resource; private $resource;
/** @var bool */
private $normalization;
/** @var string */ /** @var string */
private $mode; private $mode;
...@@ -89,9 +86,11 @@ class PropertyMetadataFactory ...@@ -89,9 +86,11 @@ class PropertyMetadataFactory
} }
/** /**
* @param ClassName $class * @param ClassName $class
* @param string $propertyName * @param string $propertyName
* @param APIPropertyMetadata $propertyMeta *
* @throws ResourceClassNotFoundException
* @throws \ApiPlatform\Core\Exception\PropertyNotFoundException
* *
* @return PropertyMetadata * @return PropertyMetadata
*/ */
......
...@@ -168,6 +168,8 @@ final class ClassInfo implements ClassName ...@@ -168,6 +168,8 @@ final class ClassInfo implements ClassName
/** /**
* @param ClassInfo $child * @param ClassInfo $child
*
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/ */
private function addChild(ClassInfo $child): void private function addChild(ClassInfo $child): void
{ {
...@@ -359,6 +361,7 @@ final class ClassInfo implements ClassName ...@@ -359,6 +361,7 @@ final class ClassInfo implements ClassName
* Get properties. * Get properties.
* *
* @return HasName[] * @return HasName[]
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/ */
private function getAllConcreteProperties(): array private function getAllConcreteProperties(): array
{ {
......
...@@ -121,7 +121,7 @@ final class PHPClass implements ClassName ...@@ -121,7 +121,7 @@ final class PHPClass implements ClassName
if (!preg_match('/^\\\\?((?:\w+\\\\)*)(\w+)$/i', $name, $groups)) { if (!preg_match('/^\\\\?((?:\w+\\\\)*)(\w+)$/i', $name, $groups)) {
throw new InvalidArgumentException("Invalid PHP class name: $name"); throw new InvalidArgumentException("Invalid PHP class name: $name");
} }
[, $namespace, $baseName] = $groups; list(, $namespace, $baseName) = $groups;
$instances[$name] = new self($namespace, $baseName); $instances[$name] = new self($namespace, $baseName);
} }
......
<?php declare(strict_types=1); <?php declare(strict_types=1);
/** /*
* irstea/ng-model-generator-bundle generates Typescript interfaces for Angular using api-platform metadata.
* Copyright (C) 2018 IRSTEA * Copyright (C) 2018 IRSTEA
* All rights reserved. *
* @copyright 2018 IRSTEA * This program is free software: you can redistribute it and/or modify it under
* @author guillaume.perreal * the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License and the GNU
* Lesser General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/ */
namespace Irstea\NgModelGeneratorBundle\Tests\Iterators; namespace Irstea\NgModelGeneratorBundle\Tests\Iterators;
...@@ -12,7 +23,7 @@ use Irstea\NgModelGeneratorBundle\Iterators\UniqueFilter; ...@@ -12,7 +23,7 @@ use Irstea\NgModelGeneratorBundle\Iterators\UniqueFilter;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Class UniqueFilterTest * Class UniqueFilterTest.
*/ */
class UniqueFilterTest extends TestCase class UniqueFilterTest extends TestCase
{ {
...@@ -26,7 +37,8 @@ class UniqueFilterTest extends TestCase ...@@ -26,7 +37,8 @@ class UniqueFilterTest extends TestCase
$this->tested = new UniqueFilter(); $this->tested = new UniqueFilter();
} }
public function testKeepUniqueValues() { public function testKeepUniqueValues()
{
$input = [4, 5, null, new \stdClass(), new \stdClass()]; $input = [4, 5, null, new \stdClass(), new \stdClass()];
self::assertEquals($input, array_filter($input, $this->tested)); self::assertEquals($input, array_filter($input, $this->tested));
} }
...@@ -41,7 +53,7 @@ class UniqueFilterTest extends TestCase ...@@ -41,7 +53,7 @@ class UniqueFilterTest extends TestCase
self::assertEquals(count($expected), count($actual)); self::assertEquals(count($expected), count($actual));
foreach($expected as $i => $value) { foreach ($expected as $i => $value) {
self::assertSame($value, $actual[$i]); self::assertSame($value, $actual[$i]);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment