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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Merging develop to master in preparation for 2.4.0rc1.
  • Loading branch information
weierophinney committed Mar 19, 2015
2 parents 95ca321 + 7803d6e commit 0d24ccc
Show file tree
Hide file tree
Showing 893 changed files with 28,281 additions and 7,950 deletions.
28 changes: 21 additions & 7 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,32 @@ $config = Symfony\CS\Config\Config::create();
$config->level(null);
$config->fixers(
array(
'braces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'function_call_space',
'function_declaration',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'trailing_spaces',
'short_tag',
'visibility',
'lowercase_keywords',
'parenthesis',
'multiple_use',
'method_argument_space',
'object_operator',
'php_closing_tag',
'braces',
'function_declaration',
'psr0',
'elseif',
'eof_ending',
'remove_lines_between_uses',
'short_tag',
'standardize_not_equal',
'trailing_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
)
);
$config->finder($finder);
Expand Down
22 changes: 16 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,35 @@ php:
- 5.5
- 5.6
- hhvm
- hhvm-nightly

install:
- sudo apt-get install parallel
- composer install --dev --prefer-source
- if [[ $TRAVIS_PHP_VERSION != '5.6' && $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != 'hhvm-nightly' ]]; then phpenv config-rm xdebug.ini; fi
- IS_HHVM=`echo $TRAVIS_PHP_VERSION | grep "hhvm" | wc -l`
- sudo apt-get install parallel libpcre3-dev
- test $IS_HHVM == "1" || echo "" | pecl install apcu-beta
- test $IS_HHVM == "1" || phpenv config-add tests/travis.php.ini
- composer install --no-interaction --prefer-source

before_script:
- php --version
- sudo /etc/init.d/memcached start
- sudo start redis-server
- mkdir -p build/coverage
- cp tests/TestConfiguration.php.travis tests/TestConfiguration.php

script:
# Run tests for the various components in parallel
- ls -d tests/ZendTest/* | grep -v 'tests/ZendTest/_files' | grep -v 'tests/ZendTest/AllTests' | parallel --gnu -P 0 'echo "Running {} tests"; php -d zend.enable_gc=0 ./vendor/bin/phpunit -c tests/phpunit.xml.dist --coverage-php build/coverage/coverage-{/.}.cov {};' || exit 1
- if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then ls -d tests/ZendTest/* | grep -v 'tests/ZendTest/_files' | grep -v 'tests/ZendTest/AllTests' | parallel --gnu -P 0 'echo "Running {} tests"; php ./vendor/bin/phpunit -c tests/phpunit.xml.dist --coverage-php build/coverage/coverage-{/.}.cov {};' || exit 1; fi
- if [[ $TRAVIS_PHP_VERSION != '5.6' ]]; then ls -d tests/ZendTest/* | grep -v 'tests/ZendTest/_files' | grep -v 'tests/ZendTest/AllTests' | parallel --gnu -P 0 'echo "Running {} tests"; php ./vendor/bin/phpunit -c tests/phpunit.xml.dist {};' || exit 1; fi

# Run coding standard checks in parallel
- ls -d library/Zend/* tests/ZendTest/* bin | parallel --gnu -P 0 'echo "Running {} CS checks"; php -d zend.enable_gc=0 ./vendor/bin/php-cs-fixer fix {} -v --dry-run --config-file=.php_cs;' || exit 1
- if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then ls -d library/Zend/* tests/ZendTest/* bin | parallel --gnu -P 0 'echo "Running {} CS checks"; php ./vendor/bin/php-cs-fixer fix {} -v --diff --dry-run --config-file=.php_cs;' || exit 1; fi

after_script:
# Merges the individual clover reports of each component into a single clover.xml
- php vendor/bin/phpcov.php --merge --clover build/logs/clover.xml --whitelist library build/coverage
- php vendor/bin/coveralls
- if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then php vendor/bin/phpcov merge --clover build/logs/clover.xml build/coverage; fi
- if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then php vendor/bin/coveralls; fi

notifications:
irc: "irc.freenode.org#zftalk.dev"
Expand All @@ -35,3 +44,4 @@ matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: hhvm-nightly
46 changes: 22 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@
If you wish to contribute to Zend Framework, please be sure to
read/subscribe to the following resources:

- Coding Standards:
http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards
- ZF Git Guide:
[README-GIT.md](README-GIT.md)
- Contributor's Guide:
http://framework.zend.com/participate/contributor-guide
- [Coding Standards](http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards)
- [ZF Git Guide](README-GIT.md)
- [Contributor's Guide](http://framework.zend.com/participate/contributor-guide)
- ZF Contributor's mailing list:
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
Subscribe: zf-contributors-subscribe@lists.zend.com
- ZF Contributor's IRC channel:
#zftalk.dev on Freenode.net

If you are working on new features, or refactoring an existing
component, please create a proposal. You can do this in on the RFC's
page, http://framework.zend.com/wiki/display/ZFDEV2/RFC%27s.
component, please [create a proposal](https://github.com/zendframework/zf2/issues/new).

## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in Zend Framework, please report it to us at [zf-security@zend.com](mailto:zf-security@zend.com). We will work with you to verify the vulnerability and patch it.
If you have encountered a potential security vulnerability in Zend Framework, please **DO NOT** report it on the public
issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead.
We will work with you to verify the vulnerability and patch it as soon as possible.

When reporting issues, please provide the following information:

Expand All @@ -39,32 +37,32 @@ For sensitive email communications, please use [our PGP key](http://framework.ze

To run tests:

- Make sure you have a recent version of PHPUnit installed; 3.7.0
minimally.
- Enter the `tests/` subdirectory.
- Execute PHPUnit, providing a path to a component directory for which
you wish to run tests, or a specific test class file.
- Clone the zf2 repository (or download it, if you do not have GIT installed):

```sh
% phpunit ZendTest/Http
% phpunit ZendTest/Http/Header/EtagTest.php
% git clone git@github.com:zendframework/zf2.git
% cd
```

- You may also provide the `--group` switch; in such cases, provide the
top-level component name:
- Install dependencies via composer:

```sh
% phpunit --group Zend_Http
% curl -sS https://getcomposer.org/installer | php --
% ./composer.phar install
```

This will likely lead to errors, so it's usually best to specify a
specific component in which to run test:
If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/

- Run the tests via `phpunit` and the provided PHPUnit config, like in this example:

```sh
% phpunit --group ZF-XYZ Zend/Http
% ./../vendor/bin/phpunit -c tests/phpunit.xml.dist tests/ZendTest/Http
% ./../vendor/bin/phpunit -c tests/phpunit.xml.dist tests/ZendTest/Http/Header/EtagTest.php
```
- Alternately, use the `run-tests.php` script. This can be executed with no
arguments to run all tests:

Note that the entire test suite is not designed to be run in a single pass.
Run tests for the single components instead. You can do it by using the `run-tests.php` utility provided
with the repository:

```sh
% php run-tests.php
Expand Down
4 changes: 2 additions & 2 deletions README-GIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ repository.
### Pre-Commit Hook (Optional)

The ZF2 Travis-CI will confirm that code style standards are met
by using ```php-cs-fixer``` (https://github.com/fabpot/PHP-CS-Fixer) during its build runs.
by using ```php-cs-fixer``` (https://github.com/FriendsOfPHP/PHP-CS-Fixer) during its build runs.

To reduce the number of red Travis-CI builds, the following Git pre-commit hook
can help catch code style issues before committing. Save it as
Expand All @@ -89,7 +89,7 @@ can help catch code style issues before committing. Save it as
* This pre-commit hooks will check for PHP errors (lint), and make sure the
* code is PSR-2 compliant.
*
* Dependency: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
* Dependency: PHP-CS-Fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer)
*
* @author Mardix http://github.com/mardix
* @author Matthew Weier O'Phinney http://mwop.net/
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Logo](https://raw.githubusercontent.com/zendframework/zf2/234b554f2ca202095aea32e4fa557553f8849664/resources/ZendFramework-logo.png)

# Welcome to the *Zend Framework 2.3* Release!
# Welcome to the *Zend Framework 2.4* Release!

Master:
[![Build Status](https://secure.travis-ci.org/zendframework/zf2.svg?branch=master)](http://travis-ci.org/zendframework/zf2)
Expand All @@ -11,16 +11,20 @@ Develop:

## RELEASE INFORMATION

*Zend Framework 2.3.7*
*Zend Framework 2.4.0dev*

This is the seventh maintenance release for the version 2.3 series.
This is the fourth minor (feature) release for the version 2 series.

12 Mar 2015
DD MMM YYY

### UPDATES IN 2.3.7
### UPDATES IN 2.4.0

- This release reverts [#7255](https://github.com/zendframework/zf2/pull/7255),
as it introduced a BC break against `Zend\Mvc\Controller\AbstractRestfulController`.
- [#6154](https://github.com/zendframework/zf2/pull/6154) updates
`Zend\InputFilter\BaseInputFilter::isValid()` to accept an optional `$context`
parameter; if used, this value will be passed to all composed inputs as
context, instead of the value provided to `setData()`. For classes overriding
the `isValid()` method of an InputFilter, you will need to add
`$context = null` as an argument.

Please see [CHANGELOG.md](CHANGELOG.md).

Expand Down
100 changes: 58 additions & 42 deletions bin/templatemap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
* --help|-h Get usage message
* --library|-l [ <string> ] Library to parse; if none provided, assumes
* current directory
* --view|-v [ <string> ] View path to parse; if none provided, assumes
* view as template directory
* --extensions|-e [ <string> ] List of accepted file extensions (regex alternation
* without parenthesis); default: *
* --output|-o [ <string> ] Where to write map file; if not provided,
* assumes "template_map.php" in library directory
* --append|-a Append to map file if it exists
Expand Down Expand Up @@ -47,12 +51,13 @@
$loader->register();

$rules = array(
'help|h' => 'Get usage message',
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
'view|v-s' => 'View path to parse; if none provided, assumes view as template directory',
'output|o-s' => 'Where to write map file; if not provided, assumes "template_map.php" in library directory',
'append|a' => 'Append to map file if it exists',
'overwrite|w' => 'Whether or not to overwrite existing map file',
'help|h' => 'Get usage message',
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
'view|v-s' => 'View path to parse; if none provided, assumes view as template directory',
'extensions|e-s' => 'List of accepted file extensions (regex alternation: *html, phtml|tpl); default: *',
'output|o-s' => 'Where to write map file; if not provided, assumes "template_map.php" in library directory',
'append|a' => 'Append to map file if it exists',
'overwrite|w' => 'Whether or not to overwrite existing map file',
);

try {
Expand All @@ -68,6 +73,18 @@
exit(0);
}

$fileExtensions = '*';
if (isset($opts->e) && $opts->e != '*') {
if (!preg_match('/^(\*?[[:alnum:]]\*?+\|?)+$/', $opts->e)) {
echo 'Invalid extensions list specified. Expecting wildcard or alternation: *, *html, phtml|tpl' . PHP_EOL
. PHP_EOL;
echo $opts->getUsageMessage();
exit(2);
}
$fileExtensions = '(' . $opts->e . ')';
}
$fileExtensions = str_replace('*', '.*', $fileExtensions);

$relativePathForMap = '';
if (isset($opts->l)) {
if (!is_dir($opts->l)) {
Expand Down Expand Up @@ -170,7 +187,8 @@
// template name => filename, where the filename is relative to the view path
$map = new stdClass;
foreach ($l as $file) {
if (!$file->isFile()) {
/* @var $file SplFileInfo */
if (!$file->isFile() || !preg_match('/^' . $fileExtensions . '$/', $file->getExtension())) {
continue;
}
$filename = str_replace($libraryPath . '/', '', str_replace(DIRECTORY_SEPARATOR, '/', $file->getPath()) . '/' . $file->getFilename());
Expand All @@ -182,59 +200,57 @@
$map->{$mapName} = $filename;
}

if ($appending) {
$content = var_export((array) $map, true) . ';';

// Prefix with __DIR__; modify the generated content
$content = preg_replace("#(=> ')#", "=> __DIR__ . '/", $content);

// Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op
$content = str_replace("\\'", "'", $content);
// Create a file with the map.

// Convert to an array and remove the first "array("
$content = explode("\n", $content);
array_shift($content);

// Load existing map file and remove the closing "bracket ");" from it
$existing = file($output, FILE_IGNORE_NEW_LINES);
array_pop($existing);

// Merge
$content = implode("\n", array_merge($existing, $content));
if ($appending && file_exists($output) && is_array(include $output)) {
// Append mode and the output file already exists: retrieve its
// content and merges with the new map
// Remove the last line as it is the end of the array, and we want to
// append our new templates
$content = file($output, FILE_IGNORE_NEW_LINES);
array_pop($content);
$content = implode(PHP_EOL, $content) . PHP_EOL;
} else {
// Create a file with the map.
// Write mode or the file does not exists: create a new file
// Stupid syntax highlighters make separating < from PHP declaration necessary
$content = '<' . "?php\n"
. "// Generated by ZF2's ./bin/templatemap_generator.php\n"
. 'return ' . var_export((array) $map, true) . ';';
$content = '<' . "?php" . PHP_EOL
. '// Generated by ZF2\'s ./bin/templatemap_generator.php' . PHP_EOL
. 'return array(' . PHP_EOL;
}

// Prefix with __DIR__; modify the generated content
$content = preg_replace("#(=> ')#", "=> __DIR__ . '/", $content);
// Process the template map as a string before inserting it to the output file

// Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op
$content = str_replace("\\'", "'", $content);
}
$mapExport = var_export((array) $map, true);

// Prefix with __DIR__
$mapExport = preg_replace("#(=> ')#", "=> __DIR__ . '/", $mapExport);

// Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op
$mapExport = str_replace("\\'", "'", $mapExport);

// Remove unnecessary double-backslashes
$content = str_replace('\\\\', '\\', $content);
$mapExport = str_replace('\\\\', '\\', $mapExport);

// Exchange "array (" width "array("
$content = str_replace('array (', 'array(', $content);
// Remove "array ("
$mapExport = str_replace('array (', '', $mapExport);

// Align "=>" operators to match coding standard
preg_match_all('(\n\s+([^=]+)=>)', $content, $matches, PREG_SET_ORDER);
preg_match_all('(\n\s+([^=]+)=>)', $mapExport, $matches, PREG_SET_ORDER);
$maxWidth = 0;

foreach ($matches as $match) {
$maxWidth = max($maxWidth, strlen($match[1]));
}

$content = preg_replace_callback('(\n\s+([^=]+)=>)', function ($matches) use ($maxWidth) {
$mapExport = preg_replace_callback('(\n\s+([^=]+)=>)', function ($matches) use ($maxWidth) {
return PHP_EOL . ' ' . $matches[1] . str_repeat(' ', $maxWidth - strlen($matches[1])) . '=>';
}, $content);
}, $mapExport);

// Trim the content
$mapExport = trim($mapExport, "\n");

// Make the file end by EOL
$content = rtrim($content, "\n") . "\n";
// Append the map to the file, close the array and write a new line
$content .= $mapExport . ';' . PHP_EOL;

// Write the contents to disk
file_put_contents($output, $content);
Expand Down
Loading

0 comments on commit 0d24ccc

Please sign in to comment.