Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist: trusty
dist: xenial
sudo: false
language: php

Expand Down Expand Up @@ -42,5 +42,8 @@ jobs:
- bash <(curl -s https://codecov.io/bash)

- stage: Lint
install:
# Use lock file for install so old version of phpstan is used.
- travis_retry composer install -n --prefer-dist
php: 7.4
script: vendor/bin/phpstan analyse
15 changes: 6 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
{"name": "Marco Pivetta", "email": "[email protected]"}
],
"require": {
"php": "^7.1",
"php": "^7.1 || ^8.0",
"ext-tokenizer": "*",
"doctrine/annotations": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"doctrine/coding-standard": "^6.0 || ^8.2.0",
"doctrine/common": "^2.10",
"phpstan/phpstan": "^0.11.0",
"phpstan/phpstan-phpunit": "^0.11.0",
"phpunit/phpunit": "^7.0"
"phpstan/phpstan": "^0.11.0 || ^0.12.20",
"phpstan/phpstan-phpunit": "^0.11.0 || ^0.12.16",
Comment on lines +27 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that part is necessary for PHPStan, is it?

Suggested change
"phpstan/phpstan": "^0.11.0 || ^0.12.20",
"phpstan/phpstan-phpunit": "^0.11.0 || ^0.12.16",
"phpstan/phpstan": "^0.12.20",
"phpstan/phpstan-phpunit": "^0.12.16",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for composer to be able to resolve for 7.1 to 8.0 I found these changes necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? 0.12 is compatible with PHP 7.1 …

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but this library fails badly on 0.12 :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so it's locked to 0.11 in composer.lock, is that it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - I've added a comment to .travis.yml to this effect.

"phpunit/phpunit": "^7.5 || ^9.1.5"
},
"conflict": {
"doctrine/common": "<2.9"
Expand All @@ -43,10 +43,7 @@
}
},
"config": {
"sort-packages": true,
"platform": {
"php": "7.1.0"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be hard for you to produce a good lock file if you remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a lock file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also https://github.com/doctrine/cache doesn't have this in its composer.json file either.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a policy that is enforced in some but not all repositories to avoid issues with external tools such as phpcs, phpstan, Psalm etc.

"sort-packages": true
},
"extra": {
"branch-alias": {
Expand Down
7 changes: 2 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility\Php7;

use ReflectionException;

trait ReflectionClass
{
/**
* {@inheritDoc}
*/
public function getConstants()
{
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
public function newInstance($args)
{
throw new ReflectionException('Method not implemented');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility\Php7;

use ReflectionException;

trait ReflectionMethod
{
/**
* {@inheritDoc}
*/
public function invoke($object, $parameter = null)
{
throw new ReflectionException('Method not implemented');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility\Php8;

use ReflectionException;

trait ReflectionClass
{
/**
* {@inheritDoc}
*/
public function getConstants(?int $filter = null)
{
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
public function newInstance(mixed ...$args)
{
throw new ReflectionException('Method not implemented');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility\Php8;

use ReflectionException;

trait ReflectionMethod
{
/**
* {@inheritDoc}
*/
public function invoke(?object $object, mixed ...$args)
{
throw new ReflectionException('Method not implemented');
}
}
18 changes: 18 additions & 0 deletions lib/Doctrine/Common/Reflection/Compatibility/ReflectionClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility;

use const PHP_VERSION_ID;
use function class_alias;

if (PHP_VERSION_ID >= 80000) {
class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass');
} else {
class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass');
}

if (false) {
class ReflectionClass
{
}
}
18 changes: 18 additions & 0 deletions lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Doctrine\Common\Reflection\Compatibility;

use const PHP_VERSION_ID;
use function class_alias;

if (PHP_VERSION_ID >= 80000) {
class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod');
} else {
class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod');
}

if (false) {
class ReflectionMethod
{
}
}
19 changes: 3 additions & 16 deletions lib/Doctrine/Common/Reflection/StaticReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

namespace Doctrine\Common\Reflection;

use Doctrine\Common\Reflection\Compatibility\ReflectionClass as CompatibilityReflectionClass;
use ReflectionClass;
use ReflectionException;

class StaticReflectionClass extends ReflectionClass
{
use CompatibilityReflectionClass;

/**
* The static reflection parser object.
*
Expand Down Expand Up @@ -83,14 +86,6 @@ public function getConstant($name)
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
public function getConstants()
{
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -371,14 +366,6 @@ public function isUserDefined()
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
public function newInstance($args)
{
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
Expand Down
11 changes: 3 additions & 8 deletions lib/Doctrine/Common/Reflection/StaticReflectionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

namespace Doctrine\Common\Reflection;

use Doctrine\Common\Reflection\Compatibility\ReflectionMethod as CompatibilityReflectionMethod;
use ReflectionException;
use ReflectionMethod;

class StaticReflectionMethod extends ReflectionMethod
{
use CompatibilityReflectionMethod;

/**
* The PSR-0 parser object.
*
Expand Down Expand Up @@ -110,14 +113,6 @@ public function getPrototype()
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
public function invoke($object, $parameter = null)
{
throw new ReflectionException('Method not implemented');
}

/**
* {@inheritDoc}
*/
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ parameters:
ignoreErrors:
- '#Doctrine\\Common\\Reflection\\StaticReflection[a-zA-Z0-9_]+::__construct\(\) does not call parent constructor from Reflection[a-zA-Z0-9_]+#'

excludes_analyse:
- lib/Doctrine/Common/Reflection/Compatibility/ReflectionClass.php
- lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon