This is intended to assist with avoiding having competing non-root instances of valet dependency services running due to userland use of brew CLI commands.
Now, when running `valet stop` or `valet restart` it will (silently) attempt to stop the non-root instance (ignoring any errors thrown), before stopping (and/or starting) the sudo/root instance which is normally used.
(Though obvious, I'll point out that this only applies to services Valet manages.)
Fixes#1057
When switching PHP versions the valet.sock file may not be removed if the linked PHP process doesn't get shut down properly. This can happen when Homebrew switches default `php` version aliases and if one has started multiple homebrew PHP instances under different permission levels or different users.
This patch merely forces the .sock file's removal when switching versions.
In very rare cases a filesystem lock may prevent the file's proper removal, in which case a reboot might be required.
To prevent these issues, keep Homebrew up-to-date by running `brew upgrade` on a regular basis (weekly is good).
Update test suite to phpunit 9.5 syntax
Refactored to use polyfill for older PHP versions via `yoast/phpunit-polyfills`
Note: this includes 2 important differences from usual phpunit test suites:
- instead of extending `PHPUnit\Framework\TestCase` we extend `Yoast\PHPUnitPolyfills\TestCases\TestCase`
- instead of handling fixtures via `setUp()` and `tearDown()` we use `set_up()` and `tear_down()` respectively
Comment regarding formatting: I chose to use the FQDN in the `extends` syntax of the class declaration instead of using `use` so that it is more quickly apparent that we're doing something slightly different than usual phpunit syntax, particularly in regards to the set_up() / tear_down() methods that appear immediately following the `extends` line.
Including the linked resolv.conf helps with troubleshooting situations where dns appears to not be working.
(Mostly the goal is to determine whether a conflicting entry is listed too early, or if the localhost is not listed first when others are present.)
- properly detects if the requested version is already installed, and skips re-installing/re-starting/re-configuring
- allows --force to re-configure anyway
- smarter treatment of 'php' when it's aliased to another specific installed version