Skip to content

Commit

Permalink
Merge branch 'release/4.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Feb 11, 2022
2 parents 5c8ee49 + 8547452 commit 34e7896
Show file tree
Hide file tree
Showing 26 changed files with 92 additions and 106 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Release and publish

on:
push:
Expand Down Expand Up @@ -68,12 +68,13 @@ jobs:
run: |
mkdir -p ~/.gnupg/
chmod 0700 ~/.gnupg/
export GPG_TTY=$(tty)
echo "$GPG_SIGNING_KEY" > ~/.gnupg/private.key
gpg --import ~/.gnupg/private.key
gpg -u wsdltophp@mikael-delsol.fr --detach-sign --output wsdltophp.phar.asc ./bin/wsdltophp.phar
env:
GPG_SIGNING_KEY: |
${{ secrets.GPG_SIGNING_KEY_893E7553C4D525279BC8C6D9B41E3A1E3748D61F }}
${{ secrets.GPG_SIGNING_KEY }}
- name: Create release
id: create_release
Expand Down
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 4.1.2 - 2022-02-11
- issue #256 - subdirectory not converted in namespaces

## 4.1.1 - 2021-07-14
- issue #257 - choice tag is not fully handled properly
- Improvement for choice tag handling
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![License](https://poser.pugx.org/wsdltophp/packagegenerator/license)](https://packagist.org/packages/wsdltophp/packagegenerator)
[![Latest Stable Version](https://poser.pugx.org/wsdltophp/packagegenerator/version.png)](https://packagist.org/packages/wsdltophp/packagegenerator)
[![Build Status](https://travis-ci.com/WsdlToPhp/PackageGenerator.svg)](https://travis-ci.com/github/WsdlToPhp/PackageGenerator)
[![TeamCity build status](https://teamcity.mikael-delsol.fr/app/rest/builds/buildType:id:PackageGenerator_Build/statusIcon.svg)](https://github.com/WsdlToPhp/PackageGenerator)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/)
[![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PackageGenerator/)
[![Total Downloads](https://poser.pugx.org/wsdltophp/packagegenerator/downloads)](https://packagist.org/packages/wsdltophp/packagegenerator)
Expand Down Expand Up @@ -157,6 +157,7 @@ Developers who helped on this project are listed in the [composer.json](composer
- [Andreas Kintzinger](https://github.com/Phobetor)
- [Hendrik Luup](https://github.com/hluup)
- [Jacob Dreesen](https://github.com/jdreesen)
- [Clifford Vickrey](https://github.com/cliffordvickrey)

## FAQ

Expand Down
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
"name": "Jacob Dreesen",
"email": "jacob.dreesen@gmail.com",
"role": "Contributor"
},
{
"name": "Clifford Vickrey",
"email": "clifforddavidvickrey@gmail.com",
"role": "Contributor"
}
],
"support" : {
Expand All @@ -87,19 +92,21 @@
"ext-mbstring": "*",
"ext-soap": "*",
"composer/composer": "^2.0",
"symfony/console": "^4.0|^5.0",
"symfony/yaml": "^4.0|^5.0",
"symfony/console": "^4.0|^5.0|^6.0",
"symfony/yaml": "^4.0|^5.0|^6.0",
"wsdltophp/packagebase": "^5.0",
"wsdltophp/phpgenerator": "^4.0",
"wsdltophp/wsdlhandler": "^1.0"
},
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose",
"build": "box build --verbose"
"build": "box build --verbose",
"phpstan": "vendor/bin/phpstan analyze src --level=2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^9"
},
"autoload": {
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
ignoreErrors:
- '#Call to an undefined method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+\(\)#'
10 changes: 8 additions & 2 deletions src/Container/AbstractObjectContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,43 @@ public function offsetExists($offset): bool
return !empty($element);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$element = array_slice($this->objects, $offset, 1);

return $this->offsetExists($offset) ? array_shift($element) : null;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new InvalidArgumentException('This method can\'t be used as object are stored with a string as array index', __LINE__);
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
if ($this->offsetExists($offset)) {
unset($this->objects[$this->getObjectKey($this->offsetGet($offset))]);
}
}

#[\ReturnTypeWillChange]
public function current()
{
$current = array_slice($this->objects, $this->offset, 1);

return array_shift($current);
}

#[\ReturnTypeWillChange]
public function next()
{
++$this->offset;
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->offset;
Expand All @@ -67,11 +73,13 @@ public function valid(): bool
return 0 < count(array_slice($this->objects, $this->offset, 1));
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->offset = 0;
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->objects);
Expand Down Expand Up @@ -112,8 +120,6 @@ abstract protected function objectProperty(): string;
/**
* This method is called before the object has been stored.
*
* @param mixed $object
*
* @throws InvalidArgumentException
*/
protected function beforeObjectIsStored(object $object): void
Expand Down
5 changes: 0 additions & 5 deletions src/Container/Model/Struct.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace WsdlToPhp\PackageGenerator\Container\Model;

use InvalidArgumentException;
use WsdlToPhp\PackageGenerator\Model\Struct as Model;

final class Struct extends AbstractModel
Expand Down Expand Up @@ -61,10 +60,6 @@ public function addUnionStruct(string $structName, array $types): self

public function getVirtual(string $value): ?Model
{
if (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf('Value "%s" can\'t be used to get an object from "%s"', is_object($value) ? get_class($value) : var_export($value, true), __CLASS__), __LINE__);
}

$key = $this->getVirtualKey($value);

return array_key_exists($key, $this->virtualObjects) ? $this->virtualObjects[$key] : null;
Expand Down
2 changes: 2 additions & 0 deletions src/File/ClassMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function fillClassConstants(ConstantContainer $constants): void

protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock
{
return null;
}

protected function fillClassProperties(PropertyContainer $properties): void
Expand All @@ -31,6 +32,7 @@ protected function fillClassProperties(PropertyContainer $properties): void

protected function getPropertyAnnotationBlock(PhpProperty $property): ?PhpAnnotationBlock
{
return null;
}

protected function fillClassMethods(): void
Expand Down
2 changes: 2 additions & 0 deletions src/File/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ protected function fillClassConstants(ConstantContainer $constants): void

protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock
{
return null;
}

protected function fillClassProperties(PropertyContainer $properties): void
Expand All @@ -87,6 +88,7 @@ protected function fillClassProperties(PropertyContainer $properties): void

protected function getPropertyAnnotationBlock(PhpProperty $property): ?PhpAnnotationBlock
{
return null;
}

protected function defineUseStatements(): AbstractModelFile
Expand Down
4 changes: 3 additions & 1 deletion src/File/Struct.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function fillClassConstants(ConstantContainer $constants): void

protected function getConstantAnnotationBlock(PhpConstant $constant): ?PhpAnnotationBlock
{
return null;
}

protected function getModelAttributes(): StructAttributeContainer
Expand Down Expand Up @@ -212,7 +213,7 @@ protected function addStructMethodAddToBody(PhpMethod $method, StructAttributeMo
if ($attribute->nameIsClean()) {
$assignment = sprintf('$this->%s[] = $item;', $attribute->getCleanName());
} else {
$assignment = sprintf('$this->%s[] = $this->{\'%s\'}[] = $item;', $attribute->getCleanName(), addslashes($attribute->getName()), $attribute->getCleanName());
$assignment = sprintf('$this->%s[] = $this->{\'%s\'}[] = $item;', $attribute->getCleanName(), addslashes($attribute->getName()));
}

$method
Expand Down Expand Up @@ -601,6 +602,7 @@ protected function addStructPropertiesToAnnotationBlockParams(PhpAnnotationBlock
protected function getStructMethodsAddToAnnotationBlock(PhpMethod $method): PhpAnnotationBlock
{
$methodParameters = $method->getParameters();
/** @var PhpFunctionParameter $firstParameter */
$firstParameter = array_shift($methodParameters);
$attribute = $this->getModel()->getAttribute($firstParameter->getModel()->getName());
$annotationBlock = new PhpAnnotationBlock();
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Generator implements JsonSerializable

protected GeneratorContainers $containers;

protected GeneratorSoapClient $soapClient;
protected ?GeneratorSoapClient $soapClient = null;

public function __construct(GeneratorOptions $options)
{
Expand Down Expand Up @@ -985,7 +985,7 @@ public static function instanceFromSerializedJson(string $json): Generator
$options->setOptionValue($name, $value);
}
// create generator instance with options
$instance = new static($options);
$instance = new self($options);
// load services
foreach ($decodedJson['containers']['services'] as $service) {
$instance->getContainers()->getServices()->add(self::getModelInstanceFromJsonArrayEntry($instance, $service));
Expand Down
9 changes: 1 addition & 8 deletions src/Generator/GeneratorSoapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ public function getSoapClient(): SoapClient

public function getSoapClientStreamContextOptions(): array
{
$options = [];
$soapClient = $this->getSoapClient();

if ($soapClient instanceof SoapClient) {
$options = $soapClient->getStreamContextOptions();
}

return $options;
return $this->getSoapClient()->getStreamContextOptions();
}
}
4 changes: 2 additions & 2 deletions src/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function getNamespace(): string
}

if (!empty($this->getSubDirectory())) {
$namespaces[] = $this->getSubDirectory();
$namespaces[] = str_replace('/', '\\', $this->getSubDirectory());
}

return implode('\\', $namespaces);
Expand Down Expand Up @@ -310,7 +310,7 @@ public static function replacePhpReservedKeyword(string $keyword, ?string $conte

public function getReservedMethodsInstance(): AbstractReservedWord
{
throw new InvalidArgumentException(sprintf('The method %s should be defined in the class %s', __FUNCTION__, get_called_class(), __LINE__));
throw new InvalidArgumentException(sprintf('The method %s should be defined in the class %s', __FUNCTION__, get_called_class()));
}

public function replaceReservedMethod(string $methodName, ?string $context = null): string
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/SoapClient/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function parse(): void
// "Regular" SOAP Style
if (count($infos) < 3) {
$returnType = $infos[0];
if (count($infos) < 3 && false !== mb_strpos($infos[1], '()') && array_key_exists(1, $infos)) {
if (false !== mb_strpos($infos[1], '()') && array_key_exists(1, $infos)) {
$methodName = trim(str_replace('()', '', $infos[1]));
$parameterType = null;
} else {
Expand All @@ -36,7 +36,7 @@ public function parse(): void
if (!empty($returnType) && !empty($methodName)) {
$services->addService($this->getGenerator()->getServiceName($methodName), $methodName, $parameterType, $returnType);
}
} elseif (count($infos) >= 3) {
} else {
/*
* RPC SOAP Style
* Some RPC WS defines the return type as a list of values
Expand Down
2 changes: 1 addition & 1 deletion src/Parser/SoapClient/Structs.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function parseType(string $type): void
$cleanType = self::cleanType($type);
$typeDef = explode(' ', $cleanType);

if (array_key_exists(1, $typeDef) && !empty($typeDef)) {
if (array_key_exists(1, $typeDef)) {
$structName = $typeDef[1];
if (self::UNION_DECLARATION === $typeDef[0]) {
$this->parseUnionStruct($typeDef);
Expand Down
10 changes: 5 additions & 5 deletions src/Parser/Wsdl/AbstractTagImportParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use WsdlToPhp\PackageGenerator\Generator\Utils;
use WsdlToPhp\PackageGenerator\Model\Schema;
use WsdlToPhp\PackageGenerator\Model\Wsdl;
use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument;
use WsdlToPhp\WsdlHandler\AbstractDocument;

abstract class AbstractTagImportParser extends AbstractTagParser
{
Expand Down Expand Up @@ -46,13 +46,13 @@ protected function getTagParser(): ?AbstractTagImportParser
$tagName = null;

switch ($this->parsingTag()) {
case WsdlDocument::TAG_IMPORT:
$tagName = WsdlDocument::TAG_INCLUDE;
case AbstractDocument::TAG_IMPORT:
$tagName = AbstractDocument::TAG_INCLUDE;

break;

case WsdlDocument::TAG_INCLUDE:
$tagName = WsdlDocument::TAG_IMPORT;
case AbstractDocument::TAG_INCLUDE:
$tagName = AbstractDocument::TAG_IMPORT;

break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parser/Wsdl/AbstractTagInputOutputParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function isKnownTypeUnknown(Method $method): bool
$isKnown = !empty($knownType) && self::UNKNOWN !== mb_strtolower($knownType);
} elseif (is_array($knownType)) {
foreach ($knownType as $knownValue) {
$isKnown &= !empty($knownType) && self::UNKNOWN !== mb_strtolower($knownValue);
$isKnown &= self::UNKNOWN !== mb_strtolower($knownValue);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/File/AbstractFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function assertSameFileContent(string $valid, File $file, string $file
unlink($file->getFileName());
}

private static function applyParsers(Generator $generator): Generator
private static function applyParsers(Generator $generator): void
{
$parsers = [
new FunctionsParser($generator),
Expand Down
Loading

0 comments on commit 34e7896

Please sign in to comment.