Comments (5)
It seems that it's because of this function declaration:
Line 923 in 362b93b
If you simply remove the UnitEnum
parameter type declaration from that line, then Phake will happily mock Bugsnag\Report
, even if it's type is still declared in the docblock.
from bugsnag-php.
Hi @randykinne,
The enumToString
method using that type isnβt called unless there is a UnitEnum instance in metadata: https://github.com/bugsnag/bugsnag-php/blob/362b93bb4b1318bb4bfe3a9e553413e6c2c1f382/src/Report.php#LL855 so its not clear why Phake would be suggesting this class doesn't exist as it should never actually be called and therefore irrelevant.
The bugsnag-php library is completely type safe and backwards compatible to php5.5. I believe this is more likely an issue with Phake incorrectly catching this as an error. Perhaps you could ask their support team for clarification on this or is there is a suggested workaround.
from bugsnag-php.
Hi @johnkiely1!
It isn't so much an issue with being backwards compatible for our general usage of the library, but rather that Phake cannot create a mock of this class because of the strong typing done on enumToString()
's signature.
When you create a mock with Phake, Phake goes and creates mock classes for every type that's referenced in a method signature on the class. This includes private methods, in order to support this feature. So as long as the new UnitEnum
type is used on a method signature (even a private one), Phake cannot create a mock for it in older PHP versions.
As I said in my comment above, the solution is to remove UnitEnum
on L923. You can leave it in the docblock, but it cannot be used in a method signature in order for Phake to be able to mock it.
from bugsnag-php.
Hi @chelsea-youmans,
I see what you are saying. So in essence because of how Phake mocks classes it can end up creating an implied dependency. To me this does still sound like something Phake should address as it seems like this could cause a lot of false positives across a lot of libraries. Going to close this out as theres not much we can do on it.
Either way it seems you have found a workaround.
@randykinne does this work for you?
from bugsnag-php.
Hi @johnkiely1, I have gone ahead and opened a pull request for the fix I had suggested: #657
from bugsnag-php.
Related Issues (20)
- Joomla integration ? similar Wordpress.. HOT 1
- StyleCI not working HOT 9
- Packagist hooks need updating HOT 1
- Unable to install on PHP 5.5 HOT 5
- PHP 7.2: count(): Parameter must be an array or an object that implements Countable HOT 3
- Session handler design HOT 1
- Consider using phpstan (or another analyser) on the codebase HOT 2
- Memory exhaustion error reports are lost HOT 4
- setRedactedKeys cannot support non-regex and regex filters at the same time HOT 7
- Option to disable syslog() call HOT 4
- Downstream Vulnerability - Guzzle <1.8.4 >=2.0.0, <2.1.1 HOT 3
- Is payloadVersion set on the wrong object? HOT 2
- Yii2: Logs are not flushed on shutdown HOT 5
- Unable to modify breadcrumbs from registerCallback HOT 3
- Redact command-line options HOT 4
- New Relic PHP extension causes duplicate errors in BugSnag HOT 2
- startSession immediately triggers deliverSessions HOT 1
- API keys for service accounts
- SSL certificate problem: self-signed certificate in certificate chain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bugsnag-php.