Add TypeInferenceTest for current_time()#76
Conversation
|
So all functions from |
|
I think we can start moving tests over for extensions that will be removed. Also newly added things should have tests I suppose, yes. Depends :) |
|
what for exactly? sorry, I didn't understand it yet. this change is not affecting consumers in any way, right? it's just adding tests closer to the type definition because @IanDelMar correctly pointed out that it's super weird to have them in the other repo still and the repo here doesn't even know about phpstan-wordpress yet, dependency-wise all should be clean IMO UPDATE: ah you mean that if we remove the extensions from phpstan-wordpress older WP versions will loose those types because this repo here is only having them for newer WP versions. something like that, right? That's definitely a valid argument against removing them in phpstan-wordpress I suppose.. but adding tests here still makes sense, right? :) |
|
I think you could just publish a major version increment for phpstan-wordpress (2.0.0) and then if someone needs those types for WordPress 4.9 they'll just have to use the existing v1 branch. |
Co-authored-by: IanDelMar <42134098+IanDelMar@users.noreply.github.com>
|
Can I commit to this PR to add tests for other functions? |
of course, go ahead! I just wanted to check here if Viktor accepts this and move only one test over for now |
|
Tbh I was not asking for permission but whether it works. I get an authentication failure. |
I added you as collaborator to my fork. but I never did that before. if it doesn't work, feel free to just create a new branch / PR, I'll close this one then |
|
Works now! |
|
Please use a vendor+package style namespace. |
tests/data/get_object_taxonomies.php
Outdated
| /** @var string $string */ | ||
| $string = null; |
There was a problem hiding this comment.
Could (string)$_GET['unknown_string'] work here?
To avoid introducing a new variable.
There was a problem hiding this comment.
As long as we exclude the test data from being analyzed with PHPStan it works. PHPStan would complain about an maybe undefined index.
There was a problem hiding this comment.
$_GET is used in other test data files.
|
May I press Merge now? |
Tests for |
|
Now WordPress got a bit better 🙃 Thank you Martin and Ian! |

@IanDelMar @szepeviktor @johnbillion
maybe this is useful to continue with szepeviktor/phpstan-wordpress#182 / szepeviktor/phpstan-wordpress#180?
still missing: phpcs and all the crazy CS rules that Viktor has in the extension repo 😊