I installed phpunit using composer on Windows, but whenever I run phpunit I get a "strict_types must be first statement" error. Does anybody have an idea on in what direction to look in order to fix this?
there's a shebang and a newline before it, but nothing else
#!/usr/bin/env php <?php declare(strict_types=1);
Since I have done nothing too special, I expected the combination of the error and phpunit would give me good google results, but the only php-unit related results I'm getting are old (fixed or won't fix) issues which do not apply to my situation.
On a completely different matter: is there a good way to check if php itself is treating something differently from older versions when include is involved?
oh, no usage problem with, looking for a name. Is that a "variable path" and "arrow line", is it "arrowing down" what is a common description for something like that. Variable accessing chain?
(the example is stupid to have in ones code, just an exaggerated example)
That's what I meant: the operator is meant for such chains, and if the entire MDN article doesn't use anything better than chaining, there's probably no better terminology
@Tiffany It is in a class. It's part of a large and complicated project, though, and as the other 3v4l showed: I have not yet been able to reproduce it
In fact, I now think it's related to phpunit (and in particular the @runTestsInSeparateProcesses annotation I'm using)
It also hooks right in with a work-around that I had in place in the past
I removed it earlier because it was broken (as should be expected for a work-around that uses reflection to edit some internal blacklist) and I thought it wasn't a problem to remove it because it worked for the other test class without the work-around
I probably either had the work-around in more places than it was needed or their include-tracking changed over the years to no longer track includes that were done by includes
(and the work-around probably didn't work anymore because it's called an ExcludeList now)
The problem I ran into with the autoload_classmap was that it necessarily ignored order as otherwise I would have had to have turned the function callback into a union and made a much larger change... If you're re-writing it, consider making it a possibility =)
Rather than invoking the chain of autoload handlers, it accepted a precompiled list of class names => paths and just loaded them directly. github.com/php/php-src/pull/6776
The thing was it always checked the precompiled list first, if I had changed SPL_G(autoload_functions) to have a type + array union I could have ordered them, but that would have broken spl_autoload_functions (unless they were skipped entirely)
@Girgias Small micro-optimization on one of the most frequently called functions. Performance gain of gain ~5 - 7% vs invoking the function list (in terms exclusively of autoloading)
@Girgias I hadn't, but as the performance bump was minimal I didn't want to add any extra overhead of the new stack frames at all. I'm not sure where I would have kept the pointer to the array either.
@Girgias Right, that was the premise behind it. As composer is building the classmaps anyway I convinced them to register a classmap if it made it into PHP, it would have in effect been transparent free performance.