-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
PHPStan lvl 4 & Fix/issue 233 followup #257
PHPStan lvl 4 & Fix/issue 233 followup #257
Conversation
The keys array contains I overrode the type of |
Makes sense, thanks for explaining! Maybe someday Laravel will switch to native types, solving these docblock inconsistencies. Do you have an idea why the Singlestore CI is failing? |
The SingleStore issues are coming from this change: The This works, but isn't very elegant... public function getExpressionGrammar()
{
/** @var \Illuminate\Database\Connection $connection */
$connection = $this->query->getConnection();
switch ($connection->getDriverName()) {
case 'mysql':
/** @var \Illuminate\Database\MySqlConnection $connection */
$grammar = $connection->isMaria()
? new MariaDbGrammar($this->model)
: new MySqlGrammar($this->model);
$grammar = $connection->withTablePrefix($grammar);
break;
case 'mariadb':
$grammar = $connection->withTablePrefix(
new MariaDbGrammar($this->model)
);
break;
case 'pgsql':
$grammar = $connection->withTablePrefix(
new PostgresGrammar($this->model)
);
break;
case 'sqlite':
$grammar = $connection->withTablePrefix(
new SQLiteGrammar($this->model)
);
break;
case 'sqlsrv':
$grammar = $connection->withTablePrefix(
new SqlServerGrammar($this->model)
);
break;
case 'singlestore':
$grammar = $connection->withTablePrefix(
new SingleStoreGrammar($this->model)
);
break;
case 'firebird':
$grammar = $connection->withTablePrefix(
new FirebirdGrammar($this->model)
);
break;
default:
throw new RuntimeException('This database is not supported.'); // @codeCoverageIgnore
}
/** @var \Staudenmeir\LaravelAdjacencyList\Query\Grammars\ExpressionGrammar $grammar */
return $grammar;
} |
@staudenmeir I've resolved it with this 63749db, what do you think? |
@SanderMuller Thanks. Unfortunately, this behaves differently from the current implementation. We need to keep using There are two ways of using Laravel with MariaDB:
|
@staudenmeir let me know what you think about 8fe6aae |
Perfect 👍 |
@staudenmeir let me know if this PR still requires some changes or elaboration |
@calebdw similar PR here if you are in a review mood 🙏 |
I think this would require your fix you mentioned on the other PR, because:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good---great work!
One thing to keep in mind is that the Relations are going to be disjunctive between L10 and L11.
When using this package with L11 the relations should use the new generic types introduced in the framework, but of course they don't exist on older versions
Thanks! |
That's probably the easiest thing to do, you can also drop support for lower version while you're at it. Another thing that could be done is creating a versioned stub system like what larastan does for the different versions |
@staudenmeir can you look at the 3 remaining phpstan errors? PHPStan is saying that the values cannot be
null
in these cases, and I would agree from a theoretical look at it, but maybe you understand the cases / code flows where they can be null