Merge branch '2.8' into 3.2

* 2.8:
  Make .travis.yml more readable
  Fold Travis CI output by component
  Add trhows PHPDoc in Application::run
  [Debug] Set exit status to 255 on error
  [HttpFoundation] Store IANA's RNG files in the repository
  [PropertyInfo] Remove a useless call to count() in SerializerExtractor
  [PropertyInfo] Prevent returning int values in some cases.
  [HttpFoundation] Fix getClientIp @return docblock
  Add @throws phpdoc
  unify PHPUnit config files
This commit is contained in:
Nicolas Grekas 2017-04-19 22:17:50 +02:00
commit fc195dc4f9
17 changed files with 406 additions and 106 deletions

View File

@ -42,63 +42,140 @@ services:
- redis-server
before_install:
- stty cols 120
- mkdir /tmp/slapd
- slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
- PHP=$TRAVIS_PHP_VERSION
# Matrix lines for intermediate PHP versions are skipped for pull requests
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
- if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = redis.so >> $INI_FILE; fi;
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif; fi
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif; fi
- |
# General configuration
stty cols 120
mkdir /tmp/slapd
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
PHP=$TRAVIS_PHP_VERSION
[ -d ~/.composer ] || mkdir ~/.composer
cp .composer/* ~/.composer/
export PHPUNIT=$(readlink -f ./phpunit)
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
# tfold is a helper to create folded reports
tfold () {
title=$1
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
shift
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
bash -xc "$*" 2>&1 &&
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
}
export -f tfold
# php.ini configuration
if [[ $PHP = hhvm* ]]; then
INI=/etc/hhvm/php.ini
else
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
fi
echo date.timezone = Europe/Paris >> $INI
echo memory_limit = -1 >> $INI
echo session.gc_probability = 0 >> $INI
echo opcache.enable_cli = 1 >> $INI
echo hhvm.jit = 0 >> $INI
echo apc.enable_cli = 1 >> $INI
echo extension = ldap.so >> $INI
echo extension = redis.so >> $INI
[[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
# Matrix lines for intermediate PHP versions are skipped for pull requests
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
deps=skip
skip=1
else
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
fi
- |
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj &&
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
fi
- |
# Install extra PHP extensions
if [[ ! $skip && $PHP = 5.* ]]; then
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
tfold ext.memcached pecl install -f memcached-2.1.0 &&
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
elif [[ ! $skip && $PHP = 7.* ]]; then
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
fi
- |
# Load fixtures
if [[ ! $skip ]]; then
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
fi
install:
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
- if [[ ! $skip ]]; then composer update --no-suggest; fi
- |
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
if [[ ! $deps ]]; then
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
elif [[ ! $skip ]]; then
export SYMFONY_DEPRECATIONS_HELPER=weak &&
cp composer.json composer.json.orig &&
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
php .github/build-packages.php HEAD^ $COMPONENTS &&
mv composer.json composer.json.phpunit &&
mv composer.json.orig composer.json
fi
- |
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
git fetch origin $SYMFONY_VERSION &&
git checkout -m FETCH_HEAD &&
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
elif [[ ! $skip ]]; then
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
fi
- |
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
- if [[ ! $skip ]]; then ./phpunit install; fi
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
- |
# phpinfo
if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
- |
run_tests () {
set -e
if [[ $skip ]]; then
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
elif [[ $deps = high ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
elif [[ $deps = low ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
# Test the PhpUnit bridge on PHP 5.3, using the original phpunit script
tfold src/Symfony/Bridge/PhpUnit \
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && $COMPOSER_UP && php phpunit-4.8.phar"
elif [[ $PHP = hhvm* ]]; then
$PHPUNIT --exclude-group benchmark,intl-data
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
if [[ $PHP = ${MIN_PHP%.*} ]]; then
echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"
fi
fi
}
script:
- REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))'
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi
# Test the PhpUnit bridge using the original phpunit script
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar); fi
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && php phpunit-4.8.phar); fi
- (run_tests)

View File

@ -101,6 +101,8 @@ class Application
* @param OutputInterface $output An Output instance
*
* @return int 0 if everything went fine, or an error code
*
* @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
{

View File

@ -203,6 +203,8 @@ class Command
*
* @return int The command exit code
*
* @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
*
* @see setCode()
* @see execute()
*/

View File

@ -100,6 +100,7 @@ class ErrorHandler
private static $stackedErrors = array();
private static $stackedErrorLevels = array();
private static $toStringException = null;
private static $exitCode = 0;
/**
* Registers the error handler.
@ -511,6 +512,9 @@ class ErrorHandler
*/
public function handleException($exception, array $error = null)
{
if (null === $error) {
self::$exitCode = 255;
}
if (!$exception instanceof \Exception) {
$exception = new FatalThrowableError($exception);
}
@ -589,7 +593,7 @@ class ErrorHandler
return;
}
if (null === $error) {
if ($exit = null === $error) {
$error = error_get_last();
}
@ -613,15 +617,21 @@ class ErrorHandler
} else {
$exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
}
} elseif (!isset($exception)) {
return;
}
try {
$handler->handleException($exception, $error);
if (isset($exception)) {
self::$exitCode = 255;
$handler->handleException($exception, $error);
}
} catch (FatalErrorException $e) {
// Ignore this re-throw
}
if ($exit && self::$exitCode) {
$exitCode = self::$exitCode;
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
}
}
/**

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"

View File

@ -824,7 +824,7 @@ class Request
* ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with
* the "client-ip" key.
*
* @return string The client IP address
* @return string|null The client IP address
*
* @see getClientIps()
* @see http://en.wikipedia.org/wiki/X-Forwarded-For

View File

@ -931,7 +931,7 @@ class ResponseTest extends ResponseTestCase
)));
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) {
if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
self::fail('Invalid IANA\'s HTTP status code list.');
}

View File

@ -0,0 +1,31 @@
<?xml version='1.0'?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.iana.org/assignments">
<include href="iana-registry.rng"/>
<start>
<element name="registry">
<ref name="registryMeta"/>
<element name="registry">
<ref name="registryMeta"/>
<zeroOrMore>
<element name="record">
<optional>
<attribute name="date"><ref name="genericDate"/></attribute>
</optional>
<optional>
<attribute name="updated"><ref name="genericDate"/></attribute>
</optional>
<element name="value"><ref name="genericRange"/></element>
<element name="description"><text/></element>
<ref name="references"/>
</element>
</zeroOrMore>
</element>
<ref name="people"/>
</element>
</start>
</grammar>

View File

@ -0,0 +1,198 @@
<?xml version='1.0'?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.iana.org/assignments">
<define name="registryMeta">
<interleave>
<attribute name="id"><data type="ID"/></attribute>
<optional><element name="title"><ref name="text_with_references"/></element></optional>
<optional><element name="created"><ref name="genericDate"/></element></optional>
<optional><element name="updated"><data type="date"/></element></optional>
<optional><element name="registration_rule"><ref
name="text_with_references"/></element></optional>
<optional><element name="expert"><text/></element></optional>
<optional><element name="description"><ref name="text_with_references"/></element></optional>
<zeroOrMore><element name="note"><ref name="text_with_references"/></element></zeroOrMore>
<ref name="references"/>
<optional><element name="hide"><empty/></element></optional>
<zeroOrMore><element name="category"><text/></element></zeroOrMore>
<zeroOrMore><ref name="range"/></zeroOrMore>
<optional><ref name="file"/></optional>
</interleave>
</define>
<define name="range">
<element name="range">
<interleave>
<element name="value"><text/></element>
<optional><element name="hex"><text/></element></optional>
<element name="registration_rule"><ref name="text_with_references"/></element>
<optional><element name="note"><ref name="text_with_references"/></element></optional>
<optional><ref name="xref"/></optional>
</interleave>
</element>
</define>
<define name="people">
<element name="people">
<zeroOrMore>
<element name="person">
<attribute name="id"><data type="ID"/></attribute>
<optional><element name="name"><text/></element></optional>
<optional><element name="org"><text/></element></optional>
<zeroOrMore><element name="uri"><data type="anyURI"/></element></zeroOrMore>
<optional><element name="updated"><ref name="genericDate"/></element></optional>
</element>
</zeroOrMore>
</element>
</define>
<define name="xref">
<element name="xref">
<optional>
<attribute name="lastupdated"><ref name="genericDate"/></attribute>
</optional>
<choice>
<group>
<attribute name="type"><value>uri</value></attribute>
<attribute name="data"><data type="anyURI"/></attribute>
</group>
<group>
<attribute name="type"><value>rfc</value></attribute>
<attribute name="data">
<data type="string">
<param name="pattern">(rfc|bcp|std)\d+</param>
</data>
</attribute>
</group>
<group>
<attribute name="type"><value>rfc-errata</value></attribute>
<attribute name="data"><data type="positiveInteger"/></attribute>
</group>
<group>
<attribute name="type"><value>draft</value></attribute>
<attribute name="data">
<data type="string">
<param name="pattern">(draft|RFC)(-[a-zA-Z0-9]+)+</param>
</data>
</attribute>
</group>
<group>
<attribute name="type"><value>registry</value></attribute>
<attribute name="data"><data type="NCName"/></attribute>
</group>
<group>
<attribute name="type"><value>person</value></attribute>
<attribute name="data"><data type="NCName"/></attribute>
</group>
<group>
<attribute name="type"><value>text</value></attribute>
</group>
<group>
<attribute name="type"><value>note</value></attribute>
<attribute name="data"><data type="positiveInteger"/></attribute>
</group>
<group>
<attribute name="type"><value>unicode</value></attribute>
<attribute name="data">
<data type="string">
<param name="pattern">ucd\d+\.\d+\.\d+</param>
</data>
</attribute>
</group>
</choice>
<text/>
</element>
</define>
<define name="references">
<zeroOrMore>
<ref name="xref"/>
</zeroOrMore>
</define>
<define name="text_with_references">
<interleave>
<zeroOrMore>
<text/>
<optional><ref name="xref"/></optional>
</zeroOrMore>
</interleave>
</define>
<define name="richText">
<zeroOrMore>
<choice>
<interleave>
<ref name="text_with_references"/>
<optional><element name="br"><empty/></element></optional>
</interleave>
<element name="paragraph">
<interleave>
<ref name="text_with_references"/>
<optional><element name="br"><empty/></element></optional>
</interleave>
</element>
<element name="artwork"><text/></element>
</choice>
</zeroOrMore>
</define>
<define name="genericRange">
<data type="string">
<param name="pattern">(\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))?</param>
</data>
</define>
<define name="genericDate">
<choice>
<data type="date"/>
<data type="gYearMonth"/>
</choice>
</define>
<define name="hex32">
<data type="string">
<param name="pattern">0x[0-9]{8}</param>
</data>
</define>
<define name="binary">
<data type="string">
<param name="pattern">[0-1]+</param>
</data>
</define>
<define name="footnotes">
<zeroOrMore>
<element name="footnote">
<attribute name="anchor"><data type="positiveInteger"/></attribute>
<interleave>
<zeroOrMore>
<text/>
<optional><ref name="xref"/></optional>
</zeroOrMore>
</interleave>
</element>
</zeroOrMore>
</define>
<define name="file">
<element name="file">
<attribute name="type">
<choice>
<value>legacy</value>
<value>mib</value>
<value>template</value>
<value>json</value>
</choice>
</attribute>
<optional>
<attribute name="name"/>
</optional>
<data type="anyURI"/>
</element>
</define>
</grammar>

View File

@ -68,7 +68,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
$properties = array();
foreach ($reflectionProperties as $reflectionProperty) {
if ($reflectionProperty->isPublic()) {
$properties[$reflectionProperty->name] = true;
$properties[$reflectionProperty->name] = $reflectionProperty->name;
}
}
@ -84,10 +84,10 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) {
$propertyName = lcfirst($propertyName);
}
$properties[$propertyName] = true;
$properties[$propertyName] = $propertyName;
}
return array_keys($properties);
return array_values($properties);
}
/**

View File

@ -48,7 +48,7 @@ class SerializerExtractor implements PropertyListExtractorInterface
$serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class);
foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
if (count(array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) > 0) {
if (array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) {
$properties[] = $serializerAttributeMetadata->getName();
}
}

View File

@ -33,7 +33,7 @@ class ReflectionExtractorTest extends TestCase
public function testGetProperties()
{
$this->assertEquals(
$this->assertSame(
array(
'bal',
'parent',
@ -50,6 +50,7 @@ class ReflectionExtractorTest extends TestCase
'a',
'DOB',
'Id',
'123',
'c',
'd',
'e',

View File

@ -116,4 +116,8 @@ class Dummy extends ParentDummy
public function getId()
{
}
public function get123()
{
}
}

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"