-
Notifications
You must be signed in to change notification settings - Fork 345
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
ci: Add PHPStan check #1409
Merged
Merged
ci: Add PHPStan check #1409
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for selfoss canceled.
|
Had to disable php-cs-fixer phpdoc rules since it would try to add invalid typehints.
All three supported database engines will return `null` PHP value for a `NULL` value in database. Previously all ensured values would be cast to the expected type (except for `DateTime` which had a special case for `NULL`), possibly replacing `NULL` value with 0 or other incorrect value. Let’s make the `null` part of the “type system” using binary or. It will also be useful once we start adding return type hints for daos methods. ---- ```php $c = $dice->create(helpers\DatabaseConnection::class); $v = $c->exec('select NULL as "null", 42 as "int", 3.14 as "decimal", CURRENT_TIMESTAMP as "timestamp", \'test\' as "string", true as "true", false as "false";'); var_dump($v); ``` ## PHP 8.2 ### SQLite ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> int(42) ["decimal"]=> float(3.14) ["timestamp"]=> string(19) "2023-02-08 23:07:00" ["string"]=> string(4) "test" ["true"]=> int(1) ["false"]=> int(0) } } ``` ### MariaDB 10.6.11 ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> int(42) ["decimal"]=> string(4) "3.14" ["timestamp"]=> string(19) "2023-02-09 00:06:47" ["string"]=> string(4) "test" ["true"]=> int(1) ["false"]=> int(0) } } ``` ### PostgreSQL 14.6 ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> int(42) ["decimal"]=> string(4) "3.14" ["timestamp"]=> string(29) "2023-02-08 23:06:57.433412+00" ["string"]=> string(4) "test" ["true"]=> bool(true) ["false"]=> bool(false) } } ``` ## PHP 7.2 ### SQLite ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> string(2) "42" ["decimal"]=> string(4) "3.14" ["timestamp"]=> string(19) "2023-02-08 23:23:54" ["string"]=> string(4) "test" ["true"]=> string(1) "1" ["false"]=> string(1) "0" } } ``` ### MariaDB 10.6.11 ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> string(2) "42" ["decimal"]=> string(4) "3.14" ["timestamp"]=> string(19) "2023-02-09 00:24:33" ["string"]=> string(4) "test" ["true"]=> string(1) "1" ["false"]=> string(1) "0" } } ``` ### PostgreSQL 14.6 ```php array(1) { [0]=> array(7) { ["null"]=> NULL ["int"]=> int(42) ["decimal"]=> string(4) "3.14" ["timestamp"]=> string(29) "2023-02-08 23:24:30.032842+00" ["string"]=> string(4) "test" ["true"]=> bool(true) ["false"]=> bool(false) } } ```
It is not needed since PHP 7.0.
Up to level 5.
Will still require more work on filling in array item types.
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.