Commit 04e4f03c authored by alexpott's avatar alexpott

Issue #2325779 by astrocling | not_chx: Upgrade to Doctrine v1.2.0.

parent bd8cb79b
......@@ -4,20 +4,20 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "8afb97667c2791fec2fb1fc43853da24",
"hash": "7d34fdcf5f05caf22258954b560e70f6",
"packages": [
{
"name": "doctrine/annotations",
"version": "dev-master",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3"
"reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd",
"reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd",
"shasum": ""
},
"require": {
......@@ -25,12 +25,13 @@
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*"
"doctrine/cache": "1.*",
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.3.x-dev"
}
},
"autoload": {
......@@ -65,7 +66,7 @@
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "http://jmsyst.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
......@@ -76,7 +77,7 @@
"docblock",
"parser"
],
"time": "2013-11-19 05:59:59"
"time": "2014-07-06 15:52:21"
},
{
"name": "doctrine/cache",
......@@ -2493,7 +2494,6 @@
"stability-flags": {
"symfony/yaml": 20,
"doctrine/common": 20,
"doctrine/annotations": 20,
"kriswallsmith/assetic": 15,
"phpunit/phpunit-mock-objects": 20
},
......
......@@ -711,80 +711,6 @@
"spl"
]
},
{
"name": "doctrine/annotations",
"version": "dev-master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*"
},
"time": "2013-11-19 05:59:59",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": "Creator"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": "http://www.instaclick.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
]
},
{
"name": "twig/twig",
"version": "v1.15.0",
......@@ -2564,5 +2490,80 @@
"keywords": [
"stack"
]
},
{
"name": "doctrine/annotations",
"version": "v1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd",
"reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpunit/phpunit": "4.*"
},
"time": "2014-07-06 15:52:21",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": "Creator"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": "http://www.instaclick.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
]
}
]
vendor/
composer.lock
composer.phar
......@@ -4,7 +4,8 @@ php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
before_script:
- composer --prefer-source --dev install
- phpunit
Copyright (c) 2006-2013 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -2,10 +2,18 @@
[![Build Status](https://travis-ci.org/doctrine/annotations.png?branch=master)](https://travis-ci.org/doctrine/annotations)
Docblock Annotations Parser library (extracted from Doctrine Common).
Docblock Annotations Parser library (extracted from [Doctrine Common](https://github.com/doctrine/common)).
## Changelog
### v1.2.0
* HHVM support
* Allowing dangling comma in annotations
* Excluded annotations are no longer autoloaded
* Importing namespaces also in traits
* Added support for `::class` 5.5-style constant, works also in 5.3 and 5.4
### v1.1
* Add Exception when ZendOptimizer+ or Opcache is configured to drop comments
* Add Exception when ZendOptimizer+ or Opcache is configured to drop comments
......@@ -17,14 +17,15 @@
"doctrine/lexer": "1.*"
},
"require-dev": {
"doctrine/cache": "1.*"
"doctrine/cache": "1.*",
"phpunit/phpunit": "4.*"
},
"autoload": {
"psr-0": { "Doctrine\\Common\\Annotations\\": "lib/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.3.x-dev"
}
}
}
......@@ -20,12 +20,12 @@
namespace Doctrine\Common\Annotations;
/**
* Annotations class
* Annotations class.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class Annotation
{
......@@ -37,9 +37,9 @@ class Annotation
public $value;
/**
* Constructor
* Constructor.
*
* @param array $data Key-value for properties to be defined in this class
* @param array $data Key-value for properties to be defined in this class.
*/
public final function __construct(array $data)
{
......@@ -51,7 +51,7 @@ class Annotation
/**
* Error handler for unknown property accessor in Annotation class.
*
* @param string $name Unknown property name
* @param string $name Unknown property name.
*
* @throws \BadMethodCallException
*/
......@@ -65,8 +65,8 @@ public function __get($name)
/**
* Error handler for unknown property mutator in Annotation class.
*
* @param string $name Unkown property name
* @param mixed $value Property value
* @param string $name Unknown property name.
* @param mixed $value Property value.
*
* @throws \BadMethodCallException
*/
......
......@@ -48,7 +48,7 @@ final class Enum
public $literal;
/**
* Annotation construct
* Annotation constructor.
*
* @param array $values
*
......@@ -81,5 +81,4 @@ public function __construct(array $values)
$this->value = $values['value'];
$this->literal = $values['literal'];
}
}
\ No newline at end of file
}
......@@ -34,7 +34,7 @@ final class IgnoreAnnotation
public $names;
/**
* Constructor
* Constructor.
*
* @param array $values
*
......
......@@ -40,11 +40,11 @@ final class Target
* @var array
*/
private static $map = array(
'ALL' => self::TARGET_ALL,
'CLASS' => self::TARGET_CLASS,
'METHOD' => self::TARGET_METHOD,
'PROPERTY' => self::TARGET_PROPERTY,
'ANNOTATION' => self::TARGET_ANNOTATION,
'ALL' => self::TARGET_ALL,
'CLASS' => self::TARGET_CLASS,
'METHOD' => self::TARGET_METHOD,
'PROPERTY' => self::TARGET_PROPERTY,
'ANNOTATION' => self::TARGET_ANNOTATION,
);
/**
......@@ -67,7 +67,7 @@ final class Target
public $literal;
/**
* Annotation construct
* Annotation constructor.
*
* @param array $values
*
......@@ -97,7 +97,7 @@ public function __construct(array $values)
$literal, implode(', ', array_keys(self::$map)))
);
}
$bitmask += self::$map[$literal];
$bitmask |= self::$map[$literal];
}
$this->targets = $bitmask;
......
......@@ -22,11 +22,11 @@
/**
* Description of AnnotationException
*
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class AnnotationException extends \Exception
{
......@@ -34,6 +34,7 @@ class AnnotationException extends \Exception
* Creates a new AnnotationException describing a Syntax error.
*
* @param string $message Exception message
*
* @return AnnotationException
*/
public static function syntaxError($message)
......@@ -45,6 +46,7 @@ public static function syntaxError($message)
* Creates a new AnnotationException describing a Semantical error.
*
* @param string $message Exception message
*
* @return AnnotationException
*/
public static function semanticalError($message)
......@@ -53,54 +55,75 @@ public static function semanticalError($message)
}
/**
* Creates a new AnnotationException describing a constant semantical error.
* Creates a new AnnotationException describing an error which occurred during
* the creation of the annotation.
*
* @since 2.2
*
* @param string $message
*
* @since 2.3
* @param string $identifier
* @param string $context
* @return AnnotationException
*/
public static function semanticalErrorConstants($identifier, $context = null)
public static function creationError($message)
{
return self::semanticalError(sprintf(
"Couldn't find constant %s%s", $identifier,
$context ? ", $context." : "."
));
return new self('[Creation Error] ' . $message);
}
/**
* Creates a new AnnotationException describing an error which occurred during
* the creation of the annotation.
* Creates a new AnnotationException describing a type error.
*
* @since 1.1
*
* @since 2.2
* @param string $message
*
* @return AnnotationException
*/
public static function creationError($message)
public static function typeError($message)
{
return new self('[Creation Error] ' . $message);
return new self('[Type Error] ' . $message);
}
/**
* Creates a new AnnotationException describing a constant semantical error.
*
* @since 2.3
*
* @param string $identifier
* @param string $context
*
* @return AnnotationException
*/
public static function semanticalErrorConstants($identifier, $context = null)
{
return self::semanticalError(sprintf(
"Couldn't find constant %s%s.",
$identifier,
$context ? ', ' . $context : ''
));
}
/**
* Creates a new AnnotationException describing an type error of an attribute.
*
* @since 2.2
*
* @param string $attributeName
* @param string $annotationName
* @param string $context
* @param string $expected
* @param mixed $actual
* @param mixed $actual
*
* @return AnnotationException
*/
public static function typeError($attributeName, $annotationName, $context, $expected, $actual)
public static function attributeTypeError($attributeName, $annotationName, $context, $expected, $actual)
{
return new self(sprintf(
'[Type Error] Attribute "%s" of @%s declared on %s expects %s, but got %s.',
return self::typeError(sprintf(
'Attribute "%s" of @%s declared on %s expects %s, but got %s.',
$attributeName,
$annotationName,
$context,
$expected,
is_object($actual) ? 'an instance of '.get_class($actual) : gettype($actual)
is_object($actual) ? 'an instance of ' . get_class($actual) : gettype($actual)
));
}
......@@ -108,16 +131,18 @@ public static function typeError($attributeName, $annotationName, $context, $exp
* Creates a new AnnotationException describing an required error of an attribute.
*
* @since 2.2
*
* @param string $attributeName
* @param string $annotationName
* @param string $context
* @param string $expected
*
* @return AnnotationException
*/
public static function requiredError($attributeName, $annotationName, $context, $expected)
{
return new self(sprintf(
'[Type Error] Attribute "%s" of @%s declared on %s expects %s. This value should not be null.',
return self::typeError(sprintf(
'Attribute "%s" of @%s declared on %s expects %s. This value should not be null.',
$attributeName,
$annotationName,
$context,
......@@ -129,16 +154,18 @@ public static function requiredError($attributeName, $annotationName, $context,
* Creates a new AnnotationException describing a invalid enummerator.
*
* @since 2.4
*
* @param string $attributeName
* @param string $annotationName
* @param string $context
* @param array $available
* @param mixed $given
*
* @return AnnotationException
*/
public static function enumeratorError($attributeName, $annotationName, $context, $available, $given)
{
throw new self(sprintf(
return new self(sprintf(
'[Enum Error] Attribute "%s" of @%s declared on %s accept only [%s], but got %s.',
$attributeName,
$annotationName,
......@@ -153,6 +180,8 @@ public static function enumeratorError($attributeName, $annotationName, $context
*/
public static function optimizerPlusSaveComments()
{
throw new self("You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1.");
return new self(
"You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1."
);
}
}
......@@ -20,7 +20,7 @@
namespace Doctrine\Common\Annotations;
/**
* AnnotationRegistry
* AnnotationRegistry.
*/
final class AnnotationRegistry
{
......@@ -43,6 +43,9 @@ final class AnnotationRegistry
*/
static private $loaders = array();
/**
* @return void
*/
static public function reset()
{
self::$autoloadNamespaces = array();
......@@ -50,9 +53,11 @@ static public function reset()
}
/**
* Register file
* Registers file.
*
* @param string $file
*
* @return void
*/
static public function registerFile($file)
{
......@@ -60,12 +65,14 @@ static public function registerFile($file)
}
/**
* Add a namespace with one or many directories to look for files or null for the include path.
* Adds a namespace with one or many directories to look for files or null for the include path.
*
* Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
*
* @param string $namespace
* @param string $namespace
* @param string|array|null $dirs
*
* @return void
*/
static public function registerAutoloadNamespace($namespace, $dirs = null)
{
......@@ -73,11 +80,13 @@ static public function registerAutoloadNamespace($namespace, $dirs = null)
}
/**
* Register multiple namespaces
* Registers multiple namespaces.
*
* Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
*
* @param array $namespaces
*
* @return void
*/
static public function registerAutoloadNamespaces(array $namespaces)
{
......@@ -85,13 +94,15 @@ static public function registerAutoloadNamespaces(array $namespaces)
}
/**
* Register an autoloading callable for annotations, much like spl_autoload_register().
* Registers an autoloading callable for annotations, much like spl_autoload_register().
*
* NOTE: These class loaders HAVE to be silent when a class was not found!
* IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class.
*
* @param callable $callable
*
* @return void
*
* @throws \InvalidArgumentException
*/
static public function registerLoader($callable)
......@@ -103,9 +114,10 @@ static public function registerLoader($callable)
}
/**
* Autoload an annotation class silently.
* Autoloads an annotation class silently.
*
* @param string $class
*
* @return boolean
*/
static public function loadAnnotationClass($class)
......
......@@ -52,27 +52,24 @@ final class CachedReader implements Reader
/**
* @var array
*/
private $loadedAnnotations;
private $loadedAnnotations = array();
/**
* Constructor
* Constructor.
*
* @param Reader $reader
* @param Cache $cache
* @param bool $debug
* @param Cache $cache