Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- stage: Lint
before_script:
- travis_retry composer require --dev --prefer-dist --prefer-stable phpstan/phpstan:^0.7
- travis_retry composer require --dev --prefer-dist --prefer-stable phpstan/phpstan:^0.12.20
script: vendor/bin/phpstan analyse -l 3 -c phpstan.neon lib tests

- stage: Benchmark
Expand All @@ -41,3 +41,4 @@ jobs:
- curl -o phpbench.phar https://phpbench.github.io/phpbench/phpbench.phar
- curl -o phpbench.phar.pubkey https://phpbench.github.io/phpbench/phpbench.phar.pubkey
script: php phpbench.phar run
php: 7.4
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"require-dev": {
"doctrine/cache": "1.*",
"phpstan/phpstan": "^0.12.20",
"phpunit/phpunit": "^7.5"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Annotations/Annotation/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
final class Attributes
{
/**
* @var array<Doctrine\Common\Annotations\Annotation\Attribute>
* @var array<Attribute>
*/
public $value;
}
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Annotations/Annotation/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class Target
/**
* Literal target declaration.
*
* @var integer
* @var string
*/
public $literal;

Expand Down
7 changes: 3 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
parameters:
autoload_files:
- %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php
excludes_analyse:
- %currentWorkingDirectory%/tests/*/Fixtures/*
- %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php
- %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php
- %currentWorkingDirectory%/tests/Doctrine/Tests/DoctrineTestCase.php
polluteScopeWithLoopInitialAssignments: true
ignoreErrors:
- '#Class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#'
- '#Instantiated class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#'
- '#Property Doctrine\\Tests\\Common\\Annotations\\DummyClassNonAnnotationProblem::\$foo has unknown class#'
- '#Call to an undefined method ReflectionClass::getUseStatements\(\)#'

# That tag is empty on purpose
- '#PHPDoc tag @var has invalid value \(\)\: Unexpected token "\\n ", expected type at offset 15#'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\Common\Annotations\Reader;
use PHPUnit\Framework\TestCase;
use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader;

Expand Down Expand Up @@ -469,10 +470,7 @@ public function testWillFailOnAnnotationConstantReferenceContainingDashes()
$reader->getClassAnnotations($reflection);
}

/**
* @return AnnotationReader
*/
abstract protected function getReader();
abstract protected function getReader(): Reader;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\DocParser;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\SingleUseAnnotation;
use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithFullPathUseStatement;
use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithImportedIgnoredAnnotation;
Expand All @@ -19,10 +20,9 @@
class AnnotationReaderTest extends AbstractReaderTest
{
/**
* @param DocParser|null $parser
* @return AnnotationReader
*/
protected function getReader(DocParser $parser = null)
protected function getReader(DocParser $parser = null): Reader
{
return new AnnotationReader($parser);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Doctrine\Tests\Common\Annotations;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\Cache;
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Route;
use Doctrine\Common\Annotations\AnnotationReader;
Expand Down Expand Up @@ -283,7 +284,7 @@ protected function doTestCacheFresh($className, $lastCacheModification)
$this->assertEquals([$route], $reader->getClassAnnotations(new \ReflectionClass($className)));
}

protected function getReader()
protected function getReader(): Reader
{
$this->cache = new ArrayCache();
return new CachedReader(new AnnotationReader(), $this->cache);
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/Common/Annotations/DocParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,12 @@ public function getConstantsProvider()
'@AnnotationWithConstants({
AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER,
ClassWithConstants::SOME_KEY = ClassWithConstants::SOME_VALUE,
Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_KEY = InterfaceWithConstants::SOME_VALUE
Doctrine\Tests\Common\Annotations\Fixtures\InterfaceWithConstants::SOME_KEY = InterfaceWithConstants::SOME_VALUE
})',
[
AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER,
ClassWithConstants::SOME_KEY => ClassWithConstants::SOME_VALUE,
ClassWithConstants::SOME_KEY => InterfaceWithConstants::SOME_VALUE
InterfaceWithConstants::SOME_KEY => InterfaceWithConstants::SOME_VALUE
]
];
$provider[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\FileCacheReader;
use Doctrine\Common\Annotations\Reader;

class FileCacheReaderTest extends AbstractReaderTest
{
private $cacheDir;

protected function getReader()
protected function getReader(): Reader
{
$this->cacheDir = sys_get_temp_dir() . '/annotations_' . uniqid('', true);
@mkdir($this->cacheDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Doctrine\Tests\Common\Annotations;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Annotations\SimpleAnnotationReader;

class SimpleAnnotationReaderTest extends AbstractReaderTest
Expand Down Expand Up @@ -117,7 +118,7 @@ public function testInvalidAnnotationButIgnored()
self::assertCount(1, $reader->getPropertyAnnotations($class->getProperty('foo')));
}

protected function getReader()
protected function getReader(): Reader
{
$reader = new SimpleAnnotationReader();
$reader->addNamespace(__NAMESPACE__);
Expand Down