Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Mar 24, 2022
2 parents a1f77d3 + c8db90a commit ffa2361
Show file tree
Hide file tree
Showing 22 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
->exclude('vendor')
->in(__DIR__);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setUsingCache(false)
->setRules(array(
'@PhpCsFixer' => true,
Expand Down
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

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

## 1.0.5 - 2022/03/24
- Update PHP CS Fixer and corresponding setting file
- Add PHPStan

## 1.0.4 - 2021/07/14
- issue #3 - Choice tag must ignore sequence tag

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
[![License](https://poser.pugx.org/wsdltophp/wsdlhandler/license)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![Latest Stable Version](https://poser.pugx.org/wsdltophp/wsdlhandler/version.png)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![Build Status](https://travis-ci.com/WsdlToPhp/WsdlHandler.svg)](https://travis-ci.com/github/WsdlToPhp/WsdlHandler)
[![TeamCity build status](https://teamcity.mikael-delsol.fr/app/rest/builds/buildType:id:WsdlHandler_Build/statusIcon.svg)](https://github.com/WsdlToPhp/WsdlHandler)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/)
[![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/WsdlHandler/)
[![Total Downloads](https://poser.pugx.org/wsdltophp/wsdlhandler/downloads)](https://packagist.org/packages/wsdltophp/wsdlhandler)
[![StyleCI](https://styleci.io/repos/87977980/shield)](https://styleci.io/repos/87977980)
[![SymfonyInsight](https://insight.symfony.com/projects/3dd23426-0808-4715-9a11-e51dc84cb0b4/mini.svg)](https://insight.symfony.com/projects/3dd23426-0808-4715-9a11-e51dc84cb0b4)
[![SymfonyInsight](https://insight.symfony.com/projects/b3232a2b-83c4-4546-92ae-c3f1357f62e9/mini.svg)](https://insight.symfony.com/projects/b3232a2b-83c4-4546-92ae-c3f1357f62e9)

WsdlHandler uses the [decorator design pattern](https://en.wikipedia.org/wiki/Decorator_pattern) upon [DomHandler](https://github.com/WsdlToPhp/DomHandler).

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"wsdltophp/domhandler": "~2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.0",
"friendsofphp/php-cs-fixer": "~3.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9"
},
"config": {
Expand All @@ -44,7 +45,8 @@
},
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose"
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose",
"phpstan": "vendor/bin/phpstan analyze src --level=2"
},
"support": {
"email": "[email protected]"
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
ignoreErrors:
-
message: "#^Method WsdlToPhp\\\\DomHandler\\\\AbstractDomDocumentHandler\\:\\:getElementByNameAndAttributes\\(\\) invoked with 3 parameters, 2 required\\.$#"
count: 1
path: src/Tag/AbstractTagOperationElement.php

-
message: "#^Method WsdlToPhp\\\\DomHandler\\\\AbstractDomDocumentHandler\\:\\:getElementByNameAndAttributes\\(\\) invoked with 3 parameters, 2 required\\.$#"
count: 1
path: src/Tag/TagPart.php

92 changes: 46 additions & 46 deletions src/AbstractDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,53 @@

abstract class AbstractDocument extends DomDocumentHandler
{
const TAG_ADDRESS = 'address';
const TAG_ALL = 'all';
const TAG_ANNOTATION = 'annotation';
const TAG_ANY = 'any';
const TAG_ANY_ATTRIBUTE = 'anyAttribute';
const TAG_APPINFO = 'appinfo';
const TAG_ATTRIBUTE = 'attribute';
const TAG_ATTRIBUTE_GROUP = 'attributeGroup';
const TAG_BINDING = 'binding';
const TAG_BODY = 'body';
const TAG_CHOICE = 'choice';
const TAG_COMPLEX_CONTENT = 'complexContent';
const TAG_COMPLEX_TYPE = 'complexType';
const TAG_DEFINITIONS = 'definitions';
const TAG_DOCUMENTATION = 'documentation';
const TAG_ELEMENT = 'element';
const TAG_ENUMERATION = 'enumeration';
const TAG_EXTENSION = 'extension';
const TAG_FIELD = 'field';
const TAG_GROUP = 'group';
const TAG_HEADER = 'header';
const TAG_IMPORT = 'import';
const TAG_INCLUDE = 'include';
const TAG_INPUT = 'input';
const TAG_KEY = 'key';
const TAG_KEYREF = 'keyref';
const TAG_LIST = 'list';
const TAG_MEMBER_TYPES = 'memberTypes';
const TAG_MESSAGE = 'message';
const TAG_NOTATION = 'notation';
const TAG_OPERATION = 'operation';
const TAG_OUTPUT = 'output';
const TAG_PART = 'part';
const TAG_PORT = 'port';
const TAG_PORT_TYPE = 'portType';
const TAG_REDEFINE = 'redefine';
const TAG_RESTRICTION = 'restriction';
const TAG_SELECTOR = 'selector';
const TAG_SEQUENCE = 'sequence';
const TAG_SCHEMA = 'schema';
const TAG_SIMPLE_CONTENT = 'simpleContent';
const TAG_SIMPLE_TYPE = 'simpleType';
const TAG_TYPES = 'types';
const TAG_UNION = 'union';
const TAG_UNIQUE = 'unique';
public const TAG_ADDRESS = 'address';
public const TAG_ALL = 'all';
public const TAG_ANNOTATION = 'annotation';
public const TAG_ANY = 'any';
public const TAG_ANY_ATTRIBUTE = 'anyAttribute';
public const TAG_APPINFO = 'appinfo';
public const TAG_ATTRIBUTE = 'attribute';
public const TAG_ATTRIBUTE_GROUP = 'attributeGroup';
public const TAG_BINDING = 'binding';
public const TAG_BODY = 'body';
public const TAG_CHOICE = 'choice';
public const TAG_COMPLEX_CONTENT = 'complexContent';
public const TAG_COMPLEX_TYPE = 'complexType';
public const TAG_DEFINITIONS = 'definitions';
public const TAG_DOCUMENTATION = 'documentation';
public const TAG_ELEMENT = 'element';
public const TAG_ENUMERATION = 'enumeration';
public const TAG_EXTENSION = 'extension';
public const TAG_FIELD = 'field';
public const TAG_GROUP = 'group';
public const TAG_HEADER = 'header';
public const TAG_IMPORT = 'import';
public const TAG_INCLUDE = 'include';
public const TAG_INPUT = 'input';
public const TAG_KEY = 'key';
public const TAG_KEYREF = 'keyref';
public const TAG_LIST = 'list';
public const TAG_MEMBER_TYPES = 'memberTypes';
public const TAG_MESSAGE = 'message';
public const TAG_NOTATION = 'notation';
public const TAG_OPERATION = 'operation';
public const TAG_OUTPUT = 'output';
public const TAG_PART = 'part';
public const TAG_PORT = 'port';
public const TAG_PORT_TYPE = 'portType';
public const TAG_REDEFINE = 'redefine';
public const TAG_RESTRICTION = 'restriction';
public const TAG_SELECTOR = 'selector';
public const TAG_SEQUENCE = 'sequence';
public const TAG_SCHEMA = 'schema';
public const TAG_SIMPLE_CONTENT = 'simpleContent';
public const TAG_SIMPLE_TYPE = 'simpleType';
public const TAG_TYPES = 'types';
public const TAG_UNION = 'union';
public const TAG_UNIQUE = 'unique';

const ATTRIBUTE_TARGET_NAMESPACE = 'targetNamespace';
public const ATTRIBUTE_TARGET_NAMESPACE = 'targetNamespace';

public function getNamespaceUri(string $namespace): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/AbstractTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

abstract class AbstractTag extends ElementHandler
{
const MAX_DEEP = 5;
public const MAX_DEEP = 5;

public function getDomDocumentHandler(): AbstractDocument
{
Expand Down
6 changes: 3 additions & 3 deletions src/Tag/AbstractTagImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

abstract class AbstractTagImport extends Tag
{
const ATTRIBUTE_LOCATION = 'location';
const ATTRIBUTE_SCHEMA_LOCATION = 'schemaLocation';
const ATTRIBUTE_SCHEMA_LOCATION_ = 'schemalocation';
public const ATTRIBUTE_LOCATION = 'location';
public const ATTRIBUTE_SCHEMA_LOCATION = 'schemaLocation';
public const ATTRIBUTE_SCHEMA_LOCATION_ = 'schemalocation';

public function getLocationAttributeValue(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/AbstractTagOperationElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

abstract class AbstractTagOperationElement extends Tag
{
const ATTRIBUTE_MESSAGE = 'message';
public const ATTRIBUTE_MESSAGE = 'message';

public function getParentOperation(): ?TagOperation
{
Expand Down
2 changes: 2 additions & 0 deletions src/Tag/TagAttributeGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function getReferencingElements(): array
'ref' => sprintf('*%s', $this->getAttributeName()),
]);
}

/** @var AbstractTag $attributeGroup */
foreach ($attributeGroups as $attributeGroup) {
$parent = $attributeGroup->getSuitableParent();
/*
Expand Down
8 changes: 4 additions & 4 deletions src/Tag/TagHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class TagHeader extends AbstractTagOperationElement
{
const ATTRIBUTE_PART = 'part';
const REQUIRED_HEADER = 'required';
const OPTIONAL_HEADER = 'optional';
const ATTRIBUTE_REQUIRED = 'wsdl:required';
public const ATTRIBUTE_PART = 'part';
public const REQUIRED_HEADER = 'required';
public const OPTIONAL_HEADER = 'optional';
public const ATTRIBUTE_REQUIRED = 'wsdl:required';

public function getParentInput(): ?TagInput
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/TagList.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TagList extends Tag
{
const ATTRIBUTE_ITEM_TYPE = 'itemType';
public const ATTRIBUTE_ITEM_TYPE = 'itemType';

public function getAttributeItemType(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Tag/TagPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

class TagPart extends Tag
{
const ATTRIBUTE_ELEMENT = 'element';
const ATTRIBUTE_TYPE = 'type';
public const ATTRIBUTE_ELEMENT = 'element';
public const ATTRIBUTE_TYPE = 'type';

/**
* @return null|AttributeHandler|int|string
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/TagRestriction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TagRestriction extends Tag
{
const ATTRIBUTE_BASE = 'base';
public const ATTRIBUTE_BASE = 'base';

public function isEnumeration(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/TagUnion.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TagUnion extends Tag
{
const ATTRIBUTE_MEMBER_TYPES = 'memberTypes';
public const ATTRIBUTE_MEMBER_TYPES = 'memberTypes';

public function getAttributeMemberTypes(): array
{
Expand Down
3 changes: 2 additions & 1 deletion src/Wsdl.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public function getElementsByNameAndAttributes(string $name, array $attributes,
$attributes,
$node,
]);

/** @var Schema $externalSchema */
foreach ($this->getExternalSchemas() as $index => $externalSchema) {
if (0 < ($nodes = $externalSchema->searchTagsByXpath($name, $attributes, $node))->length) {
if (0 < ($nodes = $externalSchema->searchTagsByXpath($name, $attributes, $node))->count()) {
$elements = array_merge($elements, $this->getElementsHandlers($nodes));
}
}
Expand Down
13 changes: 8 additions & 5 deletions tests/Tag/TagAttributeGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,17 @@ public function testGetReferencingElementsMustReturnReferencingElementsFromAttri
];

$testedCount = 0;

/** @var TagAttributeGroup $attributeGroup */
foreach ($attributeGroups as $attributeGroup) {
if ('' !== $attributeGroup->getAttributeName()) {
$elements = $attributeGroup->getReferencingElements();
$this->assertCount($attributeGroupCounts[$attributeGroup->getAttributeName()], $elements, sprintf('Failed with attributeGroup is "%s"', $attributeGroup->getAttributeName()));
$this->assertContainsOnlyInstancesOf(Tag::class, $elements);
++$testedCount;
if ('' === $attributeGroup->getAttributeName()) {
continue;
}

$elements = $attributeGroup->getReferencingElements();
$this->assertCount($attributeGroupCounts[$attributeGroup->getAttributeName()], $elements, sprintf('Failed with attributeGroup is "%s"', $attributeGroup->getAttributeName()));
$this->assertContainsOnlyInstancesOf(Tag::class, $elements);
++$testedCount;
}
$this->assertCount($testedCount, $attributeGroupCounts);
}
Expand Down
1 change: 1 addition & 0 deletions tests/Tag/TagAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final class TagAttributeTest extends AbstractTestCase
public function testGetSuitableParentAsAttributeGroupMustReturnAttributeGroupParent()
{
$schema = self::wsdlWhlInstance();

/** @var TagAttribute $attribute */
$attribute = $schema->getElementByNameAndAttributes(AbstractDocument::TAG_ATTRIBUTE, [
'name' => 'ShortText',
Expand Down
1 change: 1 addition & 0 deletions tests/Tag/TagDocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function testGetSuitableParentMustReturn()
];

$assertCount = 0;

/** @var TagDocumentation $documentation */
foreach ($documentations as $index => $documentation) {
$parent = $documentation->getSuitableParent();
Expand Down
5 changes: 5 additions & 0 deletions tests/Tag/TagHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public function testGetAttributeRequiredMustReturnTrueOrFalse()
$sessionHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'SessionHeader',
]);

/** @var TagHeader $clusterHeader */
$clusterHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'ClusterHeader',
Expand All @@ -132,6 +133,7 @@ public function testGetHeaderTypeMustReturnHeaderType()
$sessionHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'SessionHeader',
]);

/** @var TagHeader $clusterHeader */
$clusterHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'ClusterHeader',
Expand All @@ -158,6 +160,7 @@ public function testGetHeaderNameMustReturnHeaderName()
$sessionHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'SessionHeader',
]);

/** @var TagHeader $clusterHeader */
$clusterHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'ClusterHeader',
Expand All @@ -184,6 +187,7 @@ public function testGetHeaderRequiredMustReturnRequiredOrOptional()
$sessionHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'SessionHeader',
]);

/** @var TagHeader $clusterHeader */
$clusterHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'ClusterHeader',
Expand All @@ -210,6 +214,7 @@ public function testGetAttributeMessageNamespaceMustReturnMessageNamespace()
$sessionHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'SessionHeader',
]);

/** @var TagHeader $clusterHeader */
$clusterHeader = $operation->getChildByNameAndAttributes(AbstractDocument::TAG_HEADER, [
'part' => 'ClusterHeader',
Expand Down
Loading

0 comments on commit ffa2361

Please sign in to comment.