updated composer
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [7.2, 7.3, 7.4, 8.0]
|
||||
composer-flags: [ "" ]
|
||||
include:
|
||||
- php: 7.2
|
||||
composer-flags: "--prefer-lowest"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: COMPOSER_ROOT_VERSION=dev-master composer update ${{ matrix.composer-flags }}
|
||||
id: end-of-setup
|
||||
|
||||
- name: Run tests (phpspec)
|
||||
run: ./vendor/bin/phpspec run --format=dot
|
||||
if: always() && steps.end-of-setup.outcome == 'success'
|
||||
|
||||
- name: Run tests (phpunit)
|
||||
run: ./vendor/bin/phpunit
|
||||
if: always() && steps.end-of-setup.outcome == 'success'
|
||||
Vendored
+9
@@ -1,3 +1,12 @@
|
||||
1.13.0 / 2021/03/17
|
||||
===================
|
||||
|
||||
* [added] willYield can now specify a return value [@camilledejoye]
|
||||
* [added] Prophecy exception interfaces are explicitly Throwable [@ciaranmcnulty]
|
||||
* [fixed] Argument::in() and notIn() now marked as static [@tyteen4a03]
|
||||
* [fixed] Can now double unions containing false [@ciaranmcnulty]
|
||||
* [fixed] Virtual magic methods with arguments are now doublable in PHP 8 [@ciaranmcnulty]
|
||||
|
||||
1.12.2 / 2020/12/19
|
||||
===================
|
||||
|
||||
|
||||
+4
-4
@@ -218,20 +218,20 @@ class Argument
|
||||
* @return Token\InArrayToken
|
||||
*/
|
||||
|
||||
public function in($value)
|
||||
public static function in($value)
|
||||
{
|
||||
return new Token\InArrayToken($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that argument is in array.
|
||||
* Checks that argument is not in array.
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return Token\InArrayToken
|
||||
* @return Token\NotInArrayToken
|
||||
*/
|
||||
|
||||
public function notIn($value)
|
||||
public static function notIn($value)
|
||||
{
|
||||
return new Token\NotInArrayToken($value);
|
||||
}
|
||||
|
||||
+12
-1
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use Prophecy\Doubler\Generator\Node\ArgumentNode;
|
||||
use Prophecy\Doubler\Generator\Node\ClassNode;
|
||||
use Prophecy\Doubler\Generator\Node\MethodNode;
|
||||
use Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever;
|
||||
@@ -25,6 +26,8 @@ use Prophecy\PhpDocumentor\MethodTagRetrieverInterface;
|
||||
*/
|
||||
class MagicCallPatch implements ClassPatchInterface
|
||||
{
|
||||
const MAGIC_METHODS_WITH_ARGUMENTS = ['__call', '__callStatic', '__get', '__isset', '__set', '__set_state', '__unserialize', '__unset'];
|
||||
|
||||
private $tagRetriever;
|
||||
|
||||
public function __construct(MethodTagRetrieverInterface $tagRetriever = null)
|
||||
@@ -71,6 +74,15 @@ class MagicCallPatch implements ClassPatchInterface
|
||||
|
||||
if (!$reflectionClass->hasMethod($methodName)) {
|
||||
$methodNode = new MethodNode($methodName);
|
||||
|
||||
// only magic methods can have a contract that needs to be enforced
|
||||
if (in_array($methodName, self::MAGIC_METHODS_WITH_ARGUMENTS)) {
|
||||
foreach($tag->getArguments() as $argument) {
|
||||
$argumentNode = new ArgumentNode($argument['name']);
|
||||
$methodNode->addArgument($argumentNode);
|
||||
}
|
||||
}
|
||||
|
||||
$methodNode->setStatic($tag->isStatic());
|
||||
$node->addMethod($methodNode);
|
||||
}
|
||||
@@ -91,4 +103,3 @@ class MagicCallPatch implements ClassPatchInterface
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -59,6 +59,7 @@ abstract class TypeNodeAbstract
|
||||
case 'array':
|
||||
case 'callable':
|
||||
case 'bool':
|
||||
case 'false':
|
||||
case 'float':
|
||||
case 'int':
|
||||
case 'string':
|
||||
@@ -77,7 +78,15 @@ abstract class TypeNodeAbstract
|
||||
protected function guardIsValidType()
|
||||
{
|
||||
if ($this->types == ['null' => 'null']) {
|
||||
throw new DoubleException('Argument type cannot be standalone null');
|
||||
throw new DoubleException('Type cannot be standalone null');
|
||||
}
|
||||
|
||||
if ($this->types == ['false' => 'false']) {
|
||||
throw new DoubleException('Type cannot be standalone false');
|
||||
}
|
||||
|
||||
if ($this->types == ['false' => 'false', 'null' => 'null']) {
|
||||
throw new DoubleException('Type cannot be nullable false');
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 80000 && isset($this->types['mixed']) && count($this->types) !== 1) {
|
||||
|
||||
@@ -17,10 +17,6 @@ namespace Prophecy\Exception;
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
interface Exception
|
||||
interface Exception extends \Throwable
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage();
|
||||
}
|
||||
|
||||
@@ -227,12 +227,13 @@ class MethodProphecy
|
||||
|
||||
/**
|
||||
* @param array $items
|
||||
* @param mixed $return
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Prophecy\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function willYield($items)
|
||||
public function willYield($items, $return = null)
|
||||
{
|
||||
if ($this->voidReturnType) {
|
||||
throw new MethodProphecyException(
|
||||
@@ -248,10 +249,10 @@ class MethodProphecy
|
||||
));
|
||||
}
|
||||
|
||||
$generator = function() use ($items) {
|
||||
foreach ($items as $key => $value) {
|
||||
yield $key => $value;
|
||||
}
|
||||
$generator = function() use ($items, $return) {
|
||||
yield from $items;
|
||||
|
||||
return $return;
|
||||
};
|
||||
|
||||
return $this->will($generator);
|
||||
|
||||
Reference in New Issue
Block a user