Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 97d9ae1

Browse files
committedJun 21, 2016
Merge branch 'feature/gh-pages-setup' into develop
Forward port #66
2 parents 26aaa26 + d8bbab0 commit 97d9ae1

10 files changed

+114
-99
lines changed
 

‎.coveralls.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
coverage_clover: clover.xml
22
json_path: coveralls-upload.json
3-
src_dir: src

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ nbproject
99

1010
doc/html/
1111
tmp/
12+
zf-mkdoc-theme/
1213
clover.xml
1314
composer.lock
1415
coveralls-upload.json

‎.travis.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,35 @@ language: php
44

55
branches:
66
except:
7-
- /^release-.*$/
7+
- /^release-\d+\.\d+\.\d+.*$/
88
- /^ghgfk-.*$/
99

1010
cache:
1111
directories:
1212
- $HOME/.composer/cache
13+
- $HOME/.local
14+
- zf-mkdoc-theme
1315

1416
env:
1517
global:
1618
- TESTS_ZEND_CODE_ANNOTATION_DOCTRINE_SUPPORT=true
19+
- SITE_URL=https://docs.zendframework.com/zend-code
20+
- GH_USER_NAME="Matthew Weier O'Phinney"
21+
- GH_USER_EMAIL=matthew@weierophinney.net
22+
- GH_REF=github.com/zendframework/zend-code.git
23+
- secure: "qgUppUW+xiQunsc07EvrYK7q9j4ewsYzN2ggxxFGaF694gkZ5V29Tb9W2qCkKEdMo6vE+X65P/lOoJceyavPm39/Ka/0V461qIiYX2ZcBVFI/eeVnpwLmU/E5YHn6fFNbiwFX0o4cJdVyTrSspMTXSuiQy+9bLSevDYmbpknR476nmsF8FRGdG6GMFx0XklF1QkoERSfy+FGlqp3VYOJZ2MH7eLhXQyGBKv471kyfmyyInUMVoDN9R8mjJ4Sxyt2qaQ5661DuWRXLaWEBaNOvfZ4++jJFipPLyqIEcE2GqTl9LH3suIBd0NAfHGgdakMJuBZfW3WA/OQ208qm+++qajnI30cxKiGkFoAR2plK9P5+09JAzbivglpEIEtq9a58/I1ahjy9+4sqJYyfxUC07o+REUleJl/ojO6QQ3JI/UUBbPSa3d78Sw9i8LUmLimiYEYQK9zwO1ZdKwJYCKaiYdYS8H0IwGci9t+MqlrllMG5M6f2HRkF1Ph05sWah8QwsGrJ7yiSiILaDHn7wFNvUiN3uw09W9AotQ0AEBzdM6U6CngDPVWKHI9L1d7+txuOLwGt6j8NKHWlgA1P9rMkeMGn2+46b5AlCkUxg6cVCA8ZLpr3a5WLK2F7qTHACtP9tckEb4G3vQjM79f6Nlpewcuc7p7uHWK5Y4UkojRN+U="
1724

1825
matrix:
1926
fast_finish: true
2027
include:
2128
- php: 5.5
2229
env:
2330
- EXECUTE_CS_CHECK=true
24-
- EXECUTE_DOC_CHECK=true
2531
- php: 5.6
2632
env:
2733
- EXECUTE_TEST_COVERALLS=true
34+
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
35+
- PATH="$HOME/.local/bin:$PATH"
2836
- php: 7
2937
- php: hhvm
3038
allow_failures:
@@ -37,7 +45,6 @@ notifications:
3745
before_install:
3846
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
3947
- composer self-update
40-
- if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then composer require --dev --no-update phly/bookdown2mkdocs ; fi
4148
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
4249

4350
install:
@@ -50,7 +57,10 @@ script:
5057
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
5158
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
5259
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi
53-
- if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then make mkdocs ; diff mkdocs.yml mkdocs.yml.orig ; return $? ; fi
60+
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi
61+
62+
after_success:
63+
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi
5464

5565
after_script:
5666
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi

‎CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ All notable changes to this project will be documented in this file, in reverse
2424

2525
### Added
2626

27-
- Nothing.
27+
- [#66](https://github.com/zendframework/zend-code/pull/66) publishes the
28+
documentation to https://docs.zendframework.com/zend-code/.
2829

2930
### Deprecated
3031

‎doc/book/generator/examples.md

+76-76
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ use Zend\Code\Generator\ClassGenerator;
99
use Zend\Code\Generator\DocBlockGenerator;
1010

1111
$foo = new ClassGenerator();
12-
$docblock = DocBlockGenerator::fromArray(array(
12+
$docblock = DocBlockGenerator::fromArray([
1313
'shortDescription' => 'Sample generated class',
1414
'longDescription' => 'This is a class generated with Zend\Code\Generator.',
15-
'tags' => array(
16-
array(
15+
'tags' => [
16+
[
1717
'name' => 'version',
1818
'description' => '$Rev:$',
19-
),
20-
array(
19+
],
20+
[
2121
'name' => 'license',
2222
'description' => 'New BSD',
23-
),
24-
),
25-
));
23+
],
24+
],
25+
]);
2626
$foo->setName('Foo')
2727
->setDocblock($docblock);
2828
echo $foo->generate();
@@ -56,29 +56,29 @@ use Zend\Code\Generator\DocBlockGenerator;
5656
use Zend\Code\Generator\PropertyGenerator;
5757

5858
$foo = new ClassGenerator();
59-
$docblock = DocBlockGenerator::fromArray(array(
59+
$docblock = DocBlockGenerator::fromArray([
6060
'shortDescription' => 'Sample generated class',
6161
'longDescription' => 'This is a class generated with Zend\Code\Generator.',
62-
'tags' => array(
63-
array(
62+
'tags' => [
63+
[
6464
'name' => 'version',
6565
'description' => '$Rev:$',
66-
),
67-
array(
66+
],
67+
[
6868
'name' => 'license',
6969
'description' => 'New BSD',
70-
),
71-
),
72-
));
70+
],
71+
],
72+
]);
7373
$foo->setName('Foo')
7474
->setDocblock($docblock)
75-
->addProperties(array(
76-
array('_bar', 'baz', PropertyGenerator::FLAG_PROTECTED),
77-
array('baz', 'bat', PropertyGenerator::FLAG_PUBLIC)
78-
))
79-
->addConstants(array(
80-
array('bat', 'foobarbazbat')
81-
));
75+
->addProperties([
76+
['_bar', 'baz', PropertyGenerator::FLAG_PROTECTED],
77+
['baz', 'bat', PropertyGenerator::FLAG_PUBLIC]
78+
])
79+
->addConstants([
80+
['bat', 'foobarbazbat']
81+
]);
8282
echo $foo->generate();
8383
```
8484

@@ -120,66 +120,66 @@ use Zend\Code\Generator\MethodGenerator;
120120
use Zend\Code\Generator\PropertyGenerator;
121121

122122
$foo = new ClassGenerator();
123-
$docblock = DocBlockGenerator::fromArray(array(
123+
$docblock = DocBlockGenerator::fromArray([
124124
'shortDescription' => 'Sample generated class',
125125
'longDescription' => 'This is a class generated with Zend\Code\Generator.',
126-
'tags' => array(
127-
array(
126+
'tags' => [
127+
[
128128
'name' => 'version',
129129
'description' => '$Rev:$',
130-
),
131-
array(
130+
],
131+
[
132132
'name' => 'license',
133133
'description' => 'New BSD',
134-
),
135-
),
136-
));
134+
],
135+
],
136+
]);
137137
$foo->setName('Foo')
138138
->setDocblock($docblock)
139-
->addProperties(array(
140-
array('_bar', 'baz', PropertyGenerator::FLAG_PROTECTED),
141-
array('baz', 'bat', PropertyGenerator::FLAG_PUBLIC)
142-
))
143-
->addConstants(array(
144-
array('bat', 'foobarbazbat', PropertyGenerator::FLAG_CONSTANT)
145-
))
146-
->addMethods(array(
139+
->addProperties([
140+
['_bar', 'baz', PropertyGenerator::FLAG_PROTECTED],
141+
['baz', 'bat', PropertyGenerator::FLAG_PUBLIC]
142+
])
143+
->addConstants([
144+
['bat', 'foobarbazbat', PropertyGenerator::FLAG_CONSTANT]
145+
])
146+
->addMethods([
147147
// Method passed as array
148-
MethodGenerator::fromArray(array(
148+
MethodGenerator::fromArray([
149149
'name' => 'setBar',
150-
'parameters' => array('bar'),
150+
'parameters' => ['bar'],
151151
'body' => '$this->_bar = $bar;' . "\n" . 'return $this;',
152-
'docblock' => DocBlockGenerator::fromArray(array(
152+
'docblock' => DocBlockGenerator::fromArray([
153153
'shortDescription' => 'Set the bar property',
154154
'longDescription' => null,
155-
'tags' => array(
156-
new Tag\ParamTag(array(
155+
'tags' => [
156+
new Tag\ParamTag([
157157
'paramName' => 'bar',
158158
'datatype' => 'string'
159-
)),
160-
new Tag\ReturnTag(array(
159+
]),
160+
new Tag\ReturnTag([
161161
'datatype' => 'string',
162-
)),
163-
),
164-
)),
165-
)),
162+
]),
163+
],
164+
]),
165+
]),
166166
// Method passed as concrete instance
167167
new MethodGenerator(
168168
'getBar',
169-
array(),
169+
[],
170170
MethodGenerator::FLAG_PUBLIC,
171171
'return $this->_bar;',
172-
DocBlockGenerator::fromArray(array(
172+
DocBlockGenerator::fromArray([
173173
'shortDescription' => 'Retrieve the bar property',
174174
'longDescription' => null,
175-
'tags' => array(
176-
new Tag\ReturnTag(array(
175+
'tags' => [
176+
new Tag\ReturnTag([
177177
'datatype' => 'string|null',
178-
)),
179-
),
180-
))
178+
]),
179+
],
180+
])
181181
),
182-
));
182+
]);
183183

184184
echo $foo->generate();
185185
```
@@ -242,20 +242,20 @@ previous example.
242242
use Zend\Code\Generator\DocBlockGenerator;
243243
use Zend\Code\Generator\FileGenerator;
244244

245-
$file = FileGenerator::fromArray(array(
246-
'classes' => array($foo),
247-
'docblock' => DocBlockGenerator::fromArray(array(
245+
$file = FileGenerator::fromArray([
246+
'classes' => [$foo],
247+
'docblock' => DocBlockGenerator::fromArray([
248248
'shortDescription' => 'Foo class file',
249249
'longDescription' => null,
250-
'tags' => array(
251-
array(
250+
'tags' => [
251+
[
252252
'name' => 'license',
253253
'description' => 'New BSD',
254-
),
255-
),
256-
)),
254+
],
255+
],
256+
]),
257257
'body' => 'define(\'APPLICATION_ENV\', \'testing\');',
258-
));
258+
]);
259259
```
260260

261261
Calling `generate()` will generate the code -- but not write it to a file. You will need to capture
@@ -351,22 +351,22 @@ $generator = ClassGenerator::fromReflection(
351351
);
352352
$generator->addMethod(
353353
'setBaz',
354-
array('baz'),
354+
['baz'],
355355
MethodGenerator::FLAG_PUBLIC,
356356
'$this->_baz = $baz;' . "\n" . 'return $this;',
357-
DocBlockGenerator::fromArray(array(
357+
DocBlockGenerator::fromArray([
358358
'shortDescription' => 'Set the baz property',
359359
'longDescription' => null,
360-
'tags' => array(
361-
new Tag\ParamTag(array(
360+
'tags' => [
361+
new Tag\ParamTag([
362362
'paramName' => 'baz',
363363
'datatype' => 'string'
364-
)),
365-
new Tag\ReturnTag(array(
364+
]),
365+
new Tag\ReturnTag([
366366
'datatype' => 'string',
367-
)),
368-
),
369-
))
367+
]),
368+
],
369+
])
370370
);
371371
$code = $generator->generate();
372372
```

‎doc/book/generator/reference.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ that should appear before generated content. Its *API* is as follows:
2424
abstract class Zend\Code\Generator\AbstractGenerator
2525
implements Zend\Code\Generator\GeneratorInterface
2626
{
27-
public function __construct(Array|Traversable $options = array())
27+
public function __construct(Array|Traversable $options = [])
2828
public function setOptions(Array $options)
2929
public function setSourceContent($sourceContent)
3030
public function getSourceContent()
@@ -361,7 +361,7 @@ $parameter->setDefaultValue(
361361
new Zend\Code\Generator\ValueGenerator("null")
362362
);
363363
$parameter->setDefaultValue(
364-
new Zend\Code\Generator\ValueGenerator("array('foo', 'bar')")
364+
new Zend\Code\Generator\ValueGenerator("['foo', 'bar']")
365365
);
366366
```
367367

‎doc/book/index.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div class="container">
2+
<div class="jumbotron">
3+
<h1>zend-code</h1>
4+
5+
<p>Extensions to the PHP Reflection API, static code scanning, and code generation.</p>
6+
7+
<pre><code class="language-bash">$ composer require zendframework/zend-code</code></pre>
8+
</div>
9+
</div>
10+

‎doc/book/migration.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (in_array($type, ['string', 'int', 'float', 'bool'])) {
2727
$generator->setType($type);
2828
```
2929

30-
## `Zend\Code\Reflection\ParameterReflection#getType()` changes
30+
## `ParameterReflection::getType()` changes
3131

3232
PHP 7 introduced [`ReflectionParameter#getType()`](http://php.net/manual/en/reflectionparameter.gettype.php).
3333

@@ -37,7 +37,7 @@ was renamed to `Zend\Code\Reflection\ParameterReflection#detectType()`.
3737
If you relied on `Zend\Code\Reflection\ParameterReflection#getType()`, you can
3838
simply replace the method calls in your code.
3939

40-
## DocBlock types ignored by `Zend\Code\Generator\ParameterGenerator::fromReflection()`
40+
## DocBlock types ignored by `ParameterGenerator::fromReflection()`
4141

4242
As a direct consequence of the previous change, calls to
4343
`Zend\Code\Generator\ParameterGenerator::fromReflection()` will not mirror the
@@ -116,13 +116,13 @@ In version 3.x, it produces `public function foo(\baz $bar) : \tab {}`.
116116
In order to avoid migration problems, be sure to always pass fully qualified class
117117
names to `Zend\Code\Generator\MethodGenerator` and `Zend\Code\Generator\ParameterGenerator`.
118118

119-
## `Zend\Code\Generator\ParameterGenerator::$simple` was removed
119+
## `ParameterGenerator::$simple` was removed
120120

121121
If you extended `Zend\Code\Generator\ParameterGenerator`, be sure to check if you
122122
are accessing the protected static variable `$simple`: it was removed, and you should
123123
adapt your code by either copying it into your class or avoiding its usage.
124124

125-
## `Zend\Code\Generator\ParameterGenerator::$type` has changed
125+
## `ParameterGenerator::$type` has changed
126126

127127
If you extended `Zend\Code\Generator\ParameterGenerator`, be sure to check if you
128128
are accessing the protected variable `$type`: its type has changed.

‎doc/bookdown.json

-9
This file was deleted.

‎mkdocs.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ docs_dir: doc/book
22
site_dir: doc/html
33
pages:
44
- index.md
5-
- { 'zend-code Generator Component': [{ Intro: generator/intro.md }, { Examples: generator/examples.md }, { Reference: generator/reference.md }] }
6-
- { 'Migration from v2 to v3': migration.md }
5+
- "Code Generation":
6+
- Intro: generator/intro.md
7+
- Examples: generator/examples.md
8+
- Reference: generator/reference.md
9+
- Migration: migration.md
710
site_name: zend-code
811
site_description: 'zend-code: Tools for reflecting, scanning, and generating PHP code'
912
repo_url: 'https://github.com/zendframework/zend-code'

0 commit comments

Comments
 (0)
This repository has been archived.