-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Implement missing INFO function
#4709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement missing INFO function
#4709
Conversation
|
I'm going to have to think about this for a bit. Your work on INFO is fine. However, the tests which you are removing from TypeAttributePreservationTest are problematic. The tests, of course, no longer succeed because INFO would no longer be unimplemented. But they are designed to test important functionality in PhpSpreadsheet. I do not know if there is an existing unimplemented function which we might be able to substitute. Or perhaps we need to add our own unimplemented function. Or perhaps removing the tests is not as important as I think. Regardless, I will need time. |
|
I think a kludgey solution will work here. Add a static boolean property Next, restore the deleted tests from TypeAttributePreservationTest. Add a With this approach, we can implement and test your code. We don't have to search for a substitute unimplemented function for our existing tests, an exercise that we might have to repeat if we at some point implement the substitute. We preserve our existing tests. This seems like a good overall result despite the kludginess. |
|
Thank you for your feedback, I've implemented your suggestion. |
|
Please add a cosmetic change - use the following docBlock for /**
* @internal
*/This will exclude the property from being listed in the official API documentation. There are 3 INFO function arguments which you don't support - directory, origin, and release. You have good reasons for not supporting them, but you are returning a VALUE error if they are used. That is what you would return for, say, xxxxxxx, and it's somewhat misleading to return the same result for values that Excel itself doesn't support vs. values that Excel supports but PhpSpreadsheet can't support. Can you instead return something like "unavailable" for the 3 (or maybe something like "$A:$A$1" for origin, the format that Excel uses and which I readily admit I do not understand)? |
|
According to https://support.microsoft.com/en-us/office/info-function-725f259a-0e4b-49b3-8b52-58815c69acae, there are 3 additional arguments - memavail, memused, and totmem, all of which return #N/A. You may as well add these too. |
|
Thank you for your feedback. Can you take another look? |
|
I apologize for not noticing this earlier. It is, I hope, the last change I'll ask you to make. INFO takes only 1 argument, but, in Information/Info, you have defined a second argument $cell for it. Please remove that argument from the function definition and the doc-block and the |
|
I added |
|
Ah, clever, and the test you just added demonstrates that use. Thanks. |
This is:
Checklist:
Why this change is needed?
Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.