Comments (8)
Did you setup a database server in CI and imported a db schema into a database?
Could you reproduce your problem in a small example repository?
from phpstan-dba.
No, but I manage that I don't need do that because I use cache from https://github.com/staabm/phpstan-dba/blob/main/docs/record-and-replay.md
from phpstan-dba.
ok this means we can close here?
from phpstan-dba.
So I need to setup db? What about this https://github.com/staabm/phpstan-dba/blob/main/docs/record-and-replay.md ?
from phpstan-dba.
ohh I missunderstood your previous comment.
record-and-replay can be used for cases when you really cannot setup a DB in CI.
you would commit the recorded files into the repo and it should work then.
having a real db and a real schema might be more work, but is more accurate for the analysis - in case you managed a good dev process how you handle db migrations etc.
from phpstan-dba.
For me works like you mentioned, but looks like just Doctrine\DBAL\Connection::delete
or Doctrine\DBAL\Connection::insert
didn't work when run on CI without DB with record-and-replay
. There are not errors with missing table or connection when analyse raw SQL queries.
from phpstan-dba.
would be great if you would post a full example, which shows what does not work and what you expect
from phpstan-dba.
I have simplified code.
final readonly class Db
{
public function __construct(private \Doctrine\DBAL\Connection $connection)
{
}
public function save(
string $id,
): string {
$this->connection->insert('table', [
'id' => $id,
]);
return $this->connection->executeQuery('SELECT id FROM id = :id', [
'id' => $id,
])->fetchOne();
}
}
When I run on local with db with all correct loaded schema, then I use ReplayAndRecordingQueryReflector
and phpstan analyse pass.
When I run on CI without db, then I use ReplayQueryReflector
and phpstan analyse fail only on insert
(Query error: Table "table" does not exist
). Analyse on executeQuery
looks like working with cache. Cache from dev env is commited to be using on CI.
I always run with bootstrap file from first message. $isCi
choose a correct QueryReflector
.
from phpstan-dba.
Related Issues (20)
- Argument expects a literal string, got literal-string HOT 5
- Connection::insert data inference does not use indicated Types HOT 4
- mysqli: error on invalid escaping HOT 5
- Query AST analysis? HOT 2
- Get AST data from `$queryReflection->getResultType` HOT 15
- AST doubts regarding null/not-null HOT 4
- AST: inconsistent behavior with functions and aliases HOT 4
- Analyzing multiple connections HOT 6
- Right vs left join HOT 2
- AST: generic operator support HOT 2
- pgsql support for AST HOT 2
- give up sql based narrowing in case sqlftw cannot parse the query
- pgsql support for uuid type
- Support for (PDO->prepare())->execute() HOT 6
- generic type mysqli_result error with phpstan v1.10.36 and v1.10.37 HOT 2
- Support for custom API's for type inference HOT 1
- Check driver differences
- dibi support DATE_FORMAT
- Psalm support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpstan-dba.