Skip to content

Commit

Permalink
Merge branch 'release/1.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Sep 15, 2015
2 parents 7398544 + 7a65890 commit be0f114
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

# 1.1.3
- issue #35 - __Construct set methods call and enum value conflict

# 1.1.2
- issue #34 - Name "0001CreateRequest" is invalid, please provide a valid name
- issue #33 - Name "" is invalid, please provide a valid name (operation named 0001CreateRequest)
Expand Down
10 changes: 9 additions & 1 deletion src/DomHandler/AbstractNodeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ private function getHandlers(\Traversable $nodes)
public function getNodeValue()
{
$nodeValue = trim($this->getNode()->nodeValue);
$nodeValue = str_replace(array("\r", "\n", "\t"), array('', '', ' '), $nodeValue);
$nodeValue = str_replace(array(
"\r",
"\n",
"\t",
), array(
'',
'',
' ',
), $nodeValue);
$nodeValue = preg_replace('[\s+]', ' ', $nodeValue);
return $nodeValue;
}
Expand Down
13 changes: 8 additions & 5 deletions src/File/AbstractOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ protected function isParameterTypeAnArray()
protected function getParameterTypeArrayTypes($methodUsage = false)
{
$types = array();
foreach ($this->getMethod()->getParameterType() as $parameterName => $parameterType) {
$type = $methodUsage ? null : self::DEFAULT_TYPE;
if (($model = $this->getGenerator()->getStruct($parameterType)) instanceof StructModel && $model->getIsStruct() && !$model->getIsRestriction()) {
$type = $model->getPackagedName(true);
$parameterTypes = $this->getMethod()->getParameterType();
if (is_array($parameterTypes)) {
foreach ($parameterTypes as $parameterName => $parameterType) {
$type = $methodUsage ? null : self::DEFAULT_TYPE;
if (($model = $this->getGenerator()->getStruct($parameterType)) instanceof StructModel && $model->getIsStruct() && !$model->getIsRestriction()) {
$type = $model->getPackagedName(true);
}
$types[$parameterName] = $type;
}
$types[$parameterName] = $type;
}
return $types;
}
Expand Down
2 changes: 1 addition & 1 deletion src/File/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function writeFile()
'--working-dir' => $this->getGenerator()->getOptionDestination(),
)));
}
return true;
return 1;
}
/**
* @return Composer
Expand Down
2 changes: 1 addition & 1 deletion src/File/StructEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function getEnumMethodValueIsValid()
$method = new PhpMethod(self::METHOD_VALUE_IS_VALID, array(
'value',
), PhpMethod::ACCESS_PUBLIC, false, true);
$method->addChild(sprintf('return in_array($value, self::%s(), true);', self::METHOD_GET_VALID_VALUES));
$method->addChild(sprintf('return ($value === null) || in_array($value, self::%s(), true);', self::METHOD_GET_VALID_VALUES));
return $method;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiAdultOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ApiAdultOption
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiDs_weblog_formats.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ApiDs_weblog_formats
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiHouseStageEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ApiHouseStageEnum
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiPhonebookSortOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ApiPhonebookSortOption
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PhonebookSortOptionApi
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiSourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ApiSourceType
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/generated/ValidApiWebSearchOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ApiWebSearchOption
*/
public static function valueIsValid($value)
{
return in_array($value, self::getValidValues(), true);
return ($value === null) || in_array($value, self::getValidValues(), true);
}
/**
* Return allowed values
Expand Down

0 comments on commit be0f114

Please sign in to comment.