Added:
- Add support for PHP 8.4 (@andypost)
Fixed:
- Fix support for doubling methods using an enum case as default value of a parameter (@jdreesen)
- Fix deprecation when doubling a class with constructor parameters (@singinwhale, @W0rma)
- Fix deprecation warning when using phpdocumentor/reflection-docblock 5.4+ (@jrfnl)
Added:
- Allow sebastian/comparator and sebastian/recursion-context 6
- [added] Add support for PHP 8.3 [@rajeshreeputra]
- [changed] Improve the error when using return types that Prophecy does not support for mocking [@stof]
- [changed] Add more precise type for static analysis [@stof]
- [fixed] Error when comparing object arguments with integers [@lucassabreu]
- [changed] Add PHP 8.2 to test matrix [@Jean85]
- [Added] Allow sebastian/comparator and sebastian/recursion-context 5, and phpunit/phpunit 10 [@Jean85]
- [docs] Switch travis status badge to GHA one [@michalbundyra]
- [added] Add generic types for ProphecyInterface and ObjectProphecy [@stof]
- [added] Add the conditional return type for
ObjectProphecy::getMethodProphecies
[@stof] - [added] Add support for doctrine/instantiator 2.0 [@stof]
- [added] Add the ability to customize the __toString representation of a CallbackToken [@ian-zunderdorp]
- [changed] Remove support for instantiating a MethodProphecy without its arguments [@stof]
- [deprecated] Deprecate
\Prophecy\Comparator\Factory
assebastian/comparator
v5 makes it parent class final [@stof]
- [added] Allow installing with PHP 8.2 [@gquemener]
- [added] Use shorter object IDs for object comparison [@TysonAndre]
- [added] Support standalone false,true and null types [@kschatzle]
- [added] Support doubling readonly classes [@gquemener]
- [fixed] Remove workarounds for unsupported HHVM [@TysonAndre]
- [fixed] Clear error message when doubling DNF types [@kschatzle]
- [added] Support for the
static
return type [@denis-rolling-scopes] - [fixed] Add return types for Comparator implementations to avoid deprecation warnings from Symfony's DebugClassLoader [@stof]
- [added] Support for static closures in will and should [@ntzm]
- [added] Allow install on PHP 8.1 (with test suite fixes) [@javer]
- [added] Support for the 'never' return type [@ciaranmcnulty]
- [fixed] Better error message when doubling intersection return types [@ciaranmcnulty]
- [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]
- [fixed] MethodNotFoundException sometimes thrown with wrong class attached [@ciaranmcnulty]
- [fixed] Incorrect handling of inherited 'self' return types [@ciaranmcnulty]
- [added] PHP 8 support [@ciaranmcnulty]
- [added] Argument::in() and Argument::notIn() [@viniciusalonso]
- [added] Support for union and mixed types [@ciaranmcnulty]
- [fixed] Issues caused by introduction of named parameters [@ciaranmcnulty]
- [fixed] Issues caused by stricter rounding [@ciaranmcnulty]
- [fixed] can't double objects with
self
type hints (@greg0ire) - [fixed] cloned doubes were not loosely comparable (@tkulka)
- [changed] dropped support for PHP versions earlier than 7.2 (@ciaranmcnulty)
- [fixed] removed use of Reflection APIs deprecated in PHP 8.0 (@Ayesh)
- [fixed] removed fatal error when phpdocumentor/reflection-docblock 5 parses an invalid
@method
tag (@stof)
- [added] support for new versions of
sebastian/comparator
andsebastian/recursion-context
(@sebastianbergmann)
- [fixed] identical callables no longer match as arguments (@ciaranmcnulty)
- [added] shouldHaveBeenCalled evaluation happens later so un-stubbed calls don't throw (@elvetemedve)
- [added] methods can now be doubled case-insensitively to match PHP semantics (@michalbundyra)
- [fixed] reduced memory usage by optimising CachedDoubler (@DonCallisto)
- [fixed] removed fatal error nesting level when comparing large objects (@scroach)
- [added] Add willYield feature to Method Prophecy(@tkotosz)
- [fixed] Allow
MethodProphecy::willThrow()
to accept Throwable as string (@timoschinkel ) - [fixed] Allow new version of phpdocumentor/reflection-docblock (@ricpelo)
- [fixed] Don't try to patch final constructors (@NiR)
- Support for void return types without explicit will (@crellbar)
- Clearer error message for unexpected method calls (@meridius)
- Clearer error message for aggregate exceptions (@meridius)
- More verbose
shouldBeCalledOnce
expectation (@olvlvl) - Ability to double Throwable, or methods that extend it (@ciaranmcnulty)
- [fixed] Doubling methods where class has additional arguments to interface (@webimpress)
- [fixed] Doubling methods where arguments are nullable but default is not null (@webimpress)
- [fixed] Doubling magic methods on parent class (@dsnopek)
- [fixed] Check method predictions only once (@dontub)
- [fixed] Argument::containingString throwing error when called with non-string (@dcabrejas)
- Allow sebastian/comparator ^3.0 (@sebastianbergmann)
- Support for object return type hints (thanks @greg0ire)
- Fix issues with PHP 7.2 (thanks @greg0ire)
- Support object type hints in PHP 7.2 (thanks @@jansvoboda11)
- Fix SplInfo ClassPatch to work with Symfony 4 (Thanks @gnugat)
- Reverted "check method predictions only once" due to it breaking Spies
- Allow PHP5 keywords methods generation on PHP7 (thanks @bycosta)
- Allow reflection-docblock v4 (thanks @GrahamCampbell)
- Check method predictions only once (thanks @dontub)
- Escape file path sent to \SplFileObjectConstructor when running on Windows (thanks @danmartin-epiphany)
- Add full PHP 7.1 Support (thanks @prolic)
- Allow
sebastian/comparator ^2.0
(thanks @sebastianbergmann) - Allow
sebastian/recursion-context ^3.0
(thanks @sebastianbergmann) - Allow
\Error
instances inThrowPromise
(thanks @jameshalsall) - Support
phpspec/phpspect ^3.2
(thanks @Sam-Burns) - Fix failing builds (thanks @Sam-Burns)
- Added support for detecting @method on interfaces that the class itself implements, or when the stubbed class is an interface itself (thanks @Seldaek)
- Added support for sebastian/recursion-context 2 (thanks @sebastianbergmann)
- Added testing on PHP 7.1 on Travis (thanks @danizord)
- Fixed the usage of the phpunit comparator (thanks @Anyqax)
- Ignored empty method names in invalid
@method
phpdoc - Fixed the mocking of SplFileObject
- Added compatibility with phpdocumentor/reflection-docblock 3
- Add Variadics support (thanks @pamil)
- Add ProphecyComparator for comparing objects that need revealing (thanks @jon-acker)
- Add ApproximateValueToken (thanks @dantleech)
- Add support for 'self' and 'parent' return type (thanks @bendavies)
- Add __invoke to allowed reflectable methods list (thanks @ftrrtf)
- Updated ExportUtil to reflect the latest changes by Sebastian (thanks @jakari)
- Specify the required php version for composer (thanks @jakzal)
- Exclude 'args' in the generated backtrace (thanks @oradwell)
- Fix code generation for scalar parameters (thanks @trowski)
- Fix missing sprintf in InvalidArgumentException __construct call (thanks @emmanuelballery)
- Fix phpdoc for magic methods (thanks @Tobion)
- Fix PhpDoc for interfaces usage (thanks @ImmRanneft)
- Prevent final methods from being manually extended (thanks @kamioftea)
- Enhance exception for invalid argument to ThrowPromise (thanks @Tobion)
- Add support for PHP7 scalar type hints (thanks @trowski)
- Add support for PHP7 return types (thanks @trowski)
- Update internal test suite to support PHP7
- Fixed bug in closure-based argument tokens (#181)
- Fixed errors in return type phpdocs (thanks @sobit)
- Fixed stringifying of hash containing one value (thanks @avant1)
- Improved clarity of method call expectation exception (thanks @dantleech)
- Add ability to specify which argument is returned in willReturnArgument (thanks @coderbyheart)
- Add more information to MethodNotFound exceptions (thanks @ciaranmcnulty)
- Support for mocking classes with methods that return references (thanks @edsonmedina)
- Improved object comparison (thanks @whatthejeff)
- Adopted '^' in composer dependencies (thanks @GrahamCampbell)
- Fixed non-typehinted arguments being treated as optional (thanks @whatthejeff)
- Magic methods are now filtered for keywords (thanks @seagoj)
- More readable errors for failure when expecting single calls (thanks @dantleech)
- Fix the edge case when failed predictions weren't recorded for
getCheckedPredictions()
- Add a way to get checked predictions with
MethodProphecy::getCheckedPredictions()
- Fix HHVM compatibility
- Remove dead code (thanks @stof)
- Add support for DirectoryIterators (thanks @shanethehat)
- Added support for doubling magic methods documented in the class phpdoc (thanks @armetiz)
- Fixed a segfault appearing in some cases (thanks @dmoreaulf)
- Fixed the doubling of methods with typehints on non-existent classes (thanks @gquemener)
- Added support for internal classes using keywords as method names (thanks @milan)
- Added IdenticalValueToken and Argument::is (thanks @florianv)
- Removed the usage of scalar typehints in HHVM as HHVM 3 does not support them anymore in PHP code (thanks @whatthejeff)
- Spy automatically promotes spied method call to an expected one
- Added support for HHVM
- Changed the generated class names to use a static counter instead of a random number
- Added a clss patch for ReflectionClass::newInstance to make its argument optional consistently (thanks @docteurklein)
- Fixed mirroring of classes with typehints on non-existent classes (thanks @docteurklein)
- Fixed the support of array callables in CallbackPromise and CallbackPrediction (thanks @ciaranmcnulty)
- Added support for properties in ObjectStateToken (thanks @adrienbrault)
- Added support for mocking classes with a final constructor (thanks @ciaranmcnulty)
- Added ArrayEveryEntryToken and Argument::withEveryEntry() (thanks @adrienbrault)
- Added an exception when trying to prophesize on a final method instead of ignoring silently (thanks @docteurklein)
- Added StringContainToken and Argument::containingString() (thanks @peterjmit)
- Added
shouldNotHaveBeenCalled
on the MethodProphecy (thanks @ciaranmcnulty) - Fixed the comparison of objects in ExactValuetoken (thanks @sstok)
- Deprecated
shouldNotBeenCalled
in favor ofshouldNotHaveBeenCalled
- Better randomness for generated class names (thanks @sstok)
- Add support for interfaces into TypeToken and Argument::type() (thanks @sstok)
- Add support for old-style (method name === class name) constructors (thanks @l310 for report)
- Support callable typehints (thanks @stof)
- Do not attempt to autoload arrays when generating code (thanks @MarcoDeBortoli)
- New ArrayEntryToken (thanks @kagux)
- Logical
AND
token added (thanks @kagux) - Logical
NOT
token added (thanks @kagux) - Add support for setting custom constructor arguments
- Properly stringify hashes
- Record calls that throw exceptions
- Migrate spec suite to PhpSpec 2.0
- Fix broken UnexpectedCallException message
- Trim AggregateException message
- Improve exception messages
- Add more debug information to CallTimes and Call prediction exception messages
- Fix MethodNotFoundException wrong namespace (thanks @gunnarlium)
- Fix some typos in the exception messages (thanks @pborreli)
- Initial release