From 9bb1a7d2993d6de0e0bc323c84f2d036f6b2beef Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Fri, 4 Dec 2015 15:35:44 +0100 Subject: [PATCH 1/5] update for php 7 --- .travis.yml | 3 ++- README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b186b32..e8c230f 100755 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ php: - 5.4 - 5.5 - 5.6 + - 7 before_install: - composer self-update @@ -19,4 +20,4 @@ script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover \ No newline at end of file + - php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/README.md b/README.md index 62ad3aa..dbdb1a5 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # WsdlToPhp Php Generator, a Real PHP source code generator [![Latest Stable Version](https://poser.pugx.org/wsdltophp/phpgenerator/version.png)](https://packagist.org/packages/wsdltophp/phpgenerator) [![Build Status](https://api.travis-ci.org/WsdlToPhp/PhpGenerator.svg)](https://travis-ci.org/WsdlToPhp/PhpGenerator) +[![PHP 7 ready](http://php7ready.timesplinter.ch/WsdlToPhp/PhpGenerator/badge.svg)](https://travis-ci.org/WsdlToPhp/PhpGenerator) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/) [![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/) [![Dependency Status](https://www.versioneye.com/user/projects/5571b32b6634650018000011/badge.svg)](https://www.versioneye.com/user/projects/5571b32b6634650018000011) @@ -21,4 +22,4 @@ You can run the unit tests with the following command: $ cd /path/to/src/WsdlToPhp/PhpGenerator/ $ composer install $ phpunit -``` \ No newline at end of file +``` From c4075468fd6b0c783c5f706d551ab3806a1f54f9 Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Wed, 24 Feb 2016 23:09:59 +0100 Subject: [PATCH 2/5] issue #4 - use official regular expression to validate name see http://php.net/manual/en/language.variables.basics.php --- src/Element/AbstractElement.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Element/AbstractElement.php b/src/Element/AbstractElement.php index b379555..1c96b01 100755 --- a/src/Element/AbstractElement.php +++ b/src/Element/AbstractElement.php @@ -51,11 +51,11 @@ public function getName() */ public static function nameIsValid($name, $allowBackslash = false) { - $pattern = '/^[a-zA-Z_][a-zA-Z0-9_]*$/D'; + $pattern = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/'; if ($allowBackslash === true) { - $pattern = '/^[a-zA-Z_\\\][a-zA-Z0-9_\\\]*$/D'; + $pattern = '/[a-zA-Z_\x7f-\xff\\\][a-zA-Z0-9_\x7f-\xff\\\]*/'; } - return preg_match($pattern, $name) === 1; + return preg_match($pattern, $name); } /** * @param mixed $string From ca0b0707ff906f4647a596ffb4883f0d6f805aed Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Wed, 24 Feb 2016 23:10:37 +0100 Subject: [PATCH 3/5] issue #4 - update unit tests --- tests/Element/PhpAnnotationBlockTest.php | 2 +- tests/Element/PhpClassTest.php | 6 ------ tests/Element/PhpFunctionParameterTest.php | 4 ++-- tests/Element/PhpFunctionTest.php | 3 --- tests/Element/PhpVariableTest.php | 13 +++++++++++++ 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/Element/PhpAnnotationBlockTest.php b/tests/Element/PhpAnnotationBlockTest.php index 0b710b7..164a5ff 100755 --- a/tests/Element/PhpAnnotationBlockTest.php +++ b/tests/Element/PhpAnnotationBlockTest.php @@ -153,7 +153,7 @@ public function testAddChildContentOk() */ public function testGetConstructWithException() { - $annotationBlock = new PhpAnnotationBlock(array( + new PhpAnnotationBlock(array( new PhpFunction('Bar'), )); } diff --git a/tests/Element/PhpClassTest.php b/tests/Element/PhpClassTest.php index 4afa9eb..2eaa297 100755 --- a/tests/Element/PhpClassTest.php +++ b/tests/Element/PhpClassTest.php @@ -137,9 +137,6 @@ public function testSetAbstract() $class->setAbstract(1); } - /** - * @expectedException InvalidArgumentException - */ public function testSetExtends() { $class = new PhpClass('Foo'); @@ -147,9 +144,6 @@ public function testSetExtends() $class->setExtends('Partagé'); } - /** - * @expectedException InvalidArgumentException - */ public function testSetInterfaces() { $class = new PhpClass('Foo'); diff --git a/tests/Element/PhpFunctionParameterTest.php b/tests/Element/PhpFunctionParameterTest.php index 3b92c59..75b88f6 100755 --- a/tests/Element/PhpFunctionParameterTest.php +++ b/tests/Element/PhpFunctionParameterTest.php @@ -30,9 +30,9 @@ public function testTypeIsValid() $this->assertTrue(PhpFunctionParameter::typeIsValid('string')); } - public function testTypeIsValidFalse() + public function testTypeIsValidAccentuated() { - $this->assertFalse(PhpFunctionParameter::typeIsValid('Partagé')); + $this->assertTrue(PhpFunctionParameter::typeIsValid('Partagé')); } public function testSetTypeForDeclaration() diff --git a/tests/Element/PhpFunctionTest.php b/tests/Element/PhpFunctionTest.php index d3afc40..3bb6a6a 100755 --- a/tests/Element/PhpFunctionTest.php +++ b/tests/Element/PhpFunctionTest.php @@ -50,9 +50,6 @@ public function testSetParameters() )); } - /** - * @expectedException InvalidArgumentException - */ public function testSetName() { $function = new PhpFunction('foo', array()); diff --git a/tests/Element/PhpVariableTest.php b/tests/Element/PhpVariableTest.php index a152f97..273abcc 100755 --- a/tests/Element/PhpVariableTest.php +++ b/tests/Element/PhpVariableTest.php @@ -110,4 +110,17 @@ public function testToStringFloatValue() $this->assertSame('$foo = 0.4;', $variable->toString()); } + + public function testCyrillic() + { + $variable = new PhpVariable('КонтактнаяИнформация', 0.4); + + $this->assertSame('$КонтактнаяИнформация = 0.4;', $variable->toString()); + } + + public function testé() + { + $é = 4; + $this->assertEquals(4, $é); + } } From 2264cd19103598f2ca07c2a225f6874683eab93c Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Wed, 24 Feb 2016 23:17:56 +0100 Subject: [PATCH 4/5] issue #4 - update PHP CS fixer settings --- .php_cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php_cs b/.php_cs index bc65432..1559c2c 100755 --- a/.php_cs +++ b/.php_cs @@ -2,7 +2,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create() ->exclude('vendor') - ->exclude('Tests/resources') + ->exclude('tests') ->in(__DIR__); return Symfony\CS\Config\Config::create() From d449f347d4d1505775c4498a51bb95391f02d132 Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Wed, 24 Feb 2016 23:23:36 +0100 Subject: [PATCH 5/5] fixes #4 - update changelog --- CHANGELOG.md | 60 +++++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bfbe83..b0f3c6b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,72 +1,57 @@ -CHANGELOG -========= +# CHANGELOG -1.0.0 ---------- +## 1.0.1 +- issue #4 - Cyrillic alphabet is not handled well + +## 1.0.0 - First major release -1.0.0RC01 ---------- +## 1.0.0RC01 - Major: update source code structure, put Component and Element fodlers under ```src``` fodler, update composer and phpunit accordingly -0.0.16 ------ +## 0.0.16 - Minor: correct annotation -0.0.15 ------ +## 0.0.15 - Issue #3: fix constant declaration for specific value containing ( -0.0.14 ------ +## 0.0.14 - Improvement: make annotation splitting more clever using word wrap in order to keep -0.0.13 ------ +## 0.0.13 - Issue #2 : allow backslash for function/method parameter type -0.0.12 ------ +## 0.0.12 - Refactoring : Use statements and Namespace are contained by a file not a class as each element should only knows what it contains not what that is around itself. -0.0.11 ------ +## 0.0.11 - Issue : allow backslash within class name for namespace -0.0.10 ------ +## 0.0.10 - Allow to provide annotation max length to use -0.0.9 ------ +## 0.0.9 - Fix issue : within a class, the additonal multi lines are not indented correcly -0.0.8 ------ +## 0.0.8 - Fix issue: workaround for known var_export issue with float value -0.0.7 ------ +## 0.0.7 - Fix issue: if variable has 'news' as value, the variable is generated with news instead of 'news' -0.0.6 ------ +## 0.0.6 - Improvement: improve lisiblity and extensibility for PhpVariable and PhpFunctionParameter -0.0.5 ------ +## 0.0.5 - Fix issue: function parameter type is not tooken into account -0.0.4 ------ +## 0.0.4 - Fix issue regarding property/variable that has no value but always has a null value assigned with an assignment sign -0.0.3 ------ +## 0.0.3 - Apply PSR-2 rule: All PHP files MUST end with a single blank line. -0.0.2 ------ +## 0.0.2 - Code coverage improved - Several methods have been refactored to minimize them and consolidate them - Component/PhpInterface has been added @@ -74,6 +59,5 @@ CHANGELOG - Component/PhpClass has been cleaned - Component/AbstractComponent has been enhanced -0.0.1 ------ +## 0.0.1 - Initial version