Hi,
I created a fresh project (on local by flywheel, Apache, PHP 8.0.22) and installed bedrock, acorn and sage, but when I activate sage I get an error saying “You need to install Acorn to use this theme.”
The output from the error can be seen here: <?phpobject(ParseError)#526 (7) { ["message":protected]=> string(34) "sy - Pastebin.com
I can’t see anything that looks off in the file where php sees the error (marked the line with >>>):
/**
* Searches files and directories which match defined rules.
*
* @param string|string[] $dirs A directory path or an array of directories
*
* @return $this
*
* @throws DirectoryNotFoundException if one of the directories does not exist
*/
public function in(string|array $dirs): static
{
$resolvedDirs = [];
foreach ((array) $dirs as $dir) {
if (is_dir($dir)) {
$resolvedDirs[] = [$this->normalizeDir($dir)];
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
sort($glob);
>>> $resolvedDirs[] = array_map($this->normalizeDir(...), $glob);
} else {
throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
}
}
$this->dirs = array_merge($this->dirs, ...$resolvedDirs);
return $this;
}
Acorn is installed as composer dependency, in fact I first had the same problem when creating a second sage theme inside a bedrock-sage setup, where an earlier version of sage 10 definitely was working. I then updated acorn + deps, as a result the older sage theme stopped working too, with the same error. Only then I tried so set everything up from scratch, with the problem persisting.
If not, add it, then invoke composer dump-autoload to make that post-dump-autoload script run.
If already added, still invoke composer dump-autoload to see whether this helps.