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

Merge branch '0.1.x'

parents 79f67e82 73b914a3
......@@ -11,7 +11,6 @@ install-vendors:
variables:
COMPOSER_NO_INTERACTION: "1"
script:
- phpenmod iconv
- composer validate
- composer install -n --prefer-dist --no-suggest --no-progress --no-scripts --ignore-platform-reqs
cache:
......@@ -44,6 +43,7 @@ php-cs-fixer:
phpcpd:
<<: *test
script: vendor/bin/phpcpd --fuzzy src tests
allow_failure: true
phpunit:
<<: *test
......
......@@ -17,6 +17,8 @@
"minimum-stability": "stable",
"require": {
"php": "^7.1",
"ext-json": "*",
"ext-zip": "*",
"api-platform/core": "^2.2",
"doctrine/cache": "^1.8",
"doctrine/inflector": "^1.3",
......
......@@ -47,9 +47,6 @@ class PropertyMetadataFactory
/** @var ClassName */
private $resource;
/** @var bool */
private $normalization;
/** @var string */
private $mode;
......@@ -91,7 +88,9 @@ class PropertyMetadataFactory
/**
* @param ClassName $class
* @param string $propertyName
* @param APIPropertyMetadata $propertyMeta
*
* @throws ResourceClassNotFoundException
* @throws \ApiPlatform\Core\Exception\PropertyNotFoundException
*
* @return PropertyMetadata
*/
......
......@@ -168,6 +168,8 @@ final class ClassInfo implements ClassName
/**
* @param ClassInfo $child
*
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/
private function addChild(ClassInfo $child): void
{
......@@ -359,6 +361,7 @@ final class ClassInfo implements ClassName
* Get properties.
*
* @return HasName[]
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/
private function getAllConcreteProperties(): array
{
......
......@@ -121,7 +121,7 @@ final class PHPClass implements ClassName
if (!preg_match('/^\\\\?((?:\w+\\\\)*)(\w+)$/i', $name, $groups)) {
throw new InvalidArgumentException("Invalid PHP class name: $name");
}
[, $namespace, $baseName] = $groups;
list(, $namespace, $baseName) = $groups;
$instances[$name] = new self($namespace, $baseName);
}
......
<?php declare(strict_types=1);
/**
/*
* irstea/ng-model-generator-bundle generates Typescript interfaces for Angular using api-platform metadata.
* Copyright (C) 2018 IRSTEA
* All rights reserved.
* @copyright 2018 IRSTEA
* @author guillaume.perreal
*
* This program is free software: you can redistribute it and/or modify it under
* 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;
......@@ -12,7 +23,7 @@ use Irstea\NgModelGeneratorBundle\Iterators\UniqueFilter;
use PHPUnit\Framework\TestCase;
/**
* Class UniqueFilterTest
* Class UniqueFilterTest.
*/
class UniqueFilterTest extends TestCase
{
......@@ -26,7 +37,8 @@ class UniqueFilterTest extends TestCase
$this->tested = new UniqueFilter();
}
public function testKeepUniqueValues() {
public function testKeepUniqueValues()
{
$input = [4, 5, null, new \stdClass(), new \stdClass()];
self::assertEquals($input, array_filter($input, $this->tested));
}
......@@ -41,7 +53,7 @@ class UniqueFilterTest extends TestCase
self::assertEquals(count($expected), count($actual));
foreach($expected as $i => $value) {
foreach ($expected as $i => $value) {
self::assertSame($value, $actual[$i]);
}
}
......
Markdown is supported
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