Skip to content
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: Streamline vendor file location with local dev-env #80

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,6 @@ parameters:
count: 1
path: src/Connection.php

-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{PDO\\|null, string\\} given\\.$#"
count: 1
path: src/Connection.php

-
message: "#^Parameter \\#1 \\$condition of method ipl\\\\Sql\\\\Delete\\:\\:where\\(\\) expects array\\|ipl\\\\Sql\\\\ExpressionInterface\\|ipl\\\\Sql\\\\Select\\|string, mixed given\\.$#"
count: 1
Expand All @@ -260,11 +255,6 @@ parameters:
count: 1
path: src/Connection.php

-
message: "#^Parameter \\#1 \\$object_or_class of function method_exists expects object\\|string, PDO\\|null given\\.$#"
count: 1
path: src/Connection.php

-
message: "#^Parameter \\#2 \\$className of method PDOStatement\\:\\:setFetchMode\\(\\) expects int\\|object\\|string, mixed given\\.$#"
count: 1
Expand Down
15 changes: 10 additions & 5 deletions src/Connection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$mode of method PDOStatement\:\:setFetchMode\(\) expects int, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$className of method PDOStatement\:\:setFetchMode\(\) expects int\|object\|string, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:prepexec\(\) expects array\|string\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

Check failure on line 1 in src/Connection.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of method ipl\\Sql\\Connection\:\:yieldPairs\(\) expects array\|null, mixed given\.$# in path /app/src/Connection.php was not matched in reported errors.

namespace ipl\Sql;

Expand Down Expand Up @@ -72,14 +72,19 @@
{
$this->connect();

if (! method_exists($this->pdo, $name)) {
/** @var PDO $pdo */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to use mixins here instead. Check https://phpstan.org/writing-php-code/phpdocs-basics#mixins

$pdo = $this->pdo;
if (! method_exists($pdo, $name)) {
$class = get_class($this);
$message = "Call to undefined method $class::$name";

throw new BadMethodCallException($message);
}

return call_user_func_array([$this->pdo, $name], $arguments);
/** @var callable $callback */
$callback = [$this->pdo, $name];

return call_user_func_array($callback, $arguments);
}

/**
Expand Down Expand Up @@ -211,7 +216,7 @@
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchAll($stmt, array $values = null)
{
Expand All @@ -225,7 +230,7 @@
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchCol($stmt, array $values = null)
{
Expand Down Expand Up @@ -264,7 +269,7 @@
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchPairs($stmt, array $values = null)
{
Expand Down
Loading