Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
717a9ac
Add typed extractors for array assertions in Sql tests
simon-mundy Jul 8, 2026
5079ce3
Replace reflection with ConcreteSql test asset in AbstractSqlTest
simon-mundy Jul 8, 2026
410f896
Guard remaining fixed-index array access in Sql tests
simon-mundy Jul 8, 2026
a5f2533
Add project mago.toml
simon-mundy Jul 8, 2026
8c2607a
Type Sql builder shapes and clear AbstractSql/Join/Select analysis
simon-mundy Jul 8, 2026
c2f9e13
Type Insert/Update/Delete and centralise table alias handling
simon-mundy Jul 8, 2026
a6ab5cc
Add specificationString() accessor for plain-string specifications
simon-mundy Jul 8, 2026
dd8f15e
Type Combine and Sql; accept aliased tables in statement constructors
simon-mundy Jul 8, 2026
69c9fda
Type Expression parameters and AbstractPlatform decorators
simon-mundy Jul 8, 2026
eeed242
Type the Predicate builders and align identifier params
simon-mundy Jul 9, 2026
ec4d9e6
Type the Ddl column, constraint, index and table builders
simon-mundy Jul 9, 2026
b6d9224
Align where()/argument value array shapes with their delegates
simon-mundy Jul 9, 2026
74ba74a
Accept subquery values in predicate and expression parameters
simon-mundy Jul 10, 2026
0a8cd6c
Type the Sql functional test base, Delete test and shared readers
simon-mundy Jul 10, 2026
fd41a65
Type SelectTest raw-state reads and magic property access
simon-mundy Jul 10, 2026
dc7f756
Type the Insert, Combine, Ddl and Platform tests
simon-mundy Jul 10, 2026
6255d80
Type the Update, Expression and Predicate set/expression/in tests
simon-mundy Jul 10, 2026
3fcc81a
Restore phpcs compliance after the type-safety cleanup
simon-mundy Jul 10, 2026
19f3a22
Stop enforcing class finality and @api/@internal annotations
simon-mundy Jul 10, 2026
522fac0
Drop the non-functional typed value-set assertions from InTest
simon-mundy Jul 10, 2026
ce64bdc
Restore phpstan compliance after the type-safety cleanup
simon-mundy Jul 10, 2026
3c7ff50
Build SelectTest where fixtures via closures, not the magic property
simon-mundy Jul 10, 2026
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
126 changes: 126 additions & 0 deletions mago.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
php-version = "8.2"

[source]
paths = ["src", "test"]
includes = ["vendor"]

[source.glob]
literal-separator = false

[formatter]
preset = "default"
preserve-breaking-member-access-chain = true
preserve-breaking-member-access-chain-first-method-on-same-line = true
preserve-breaking-argument-list = true
preserve-breaking-array-like = true
preserve-breaking-parameter-list = true
preserve-breaking-attribute-list = true
preserve-breaking-conditional-expression = true
preserve-breaking-condition-expression = true
preserve-redundant-logical-binary-expression-parentheses = true
preserve-breaking-binary-expression = true
space-after-logical-not-unary-prefix-operator = true
always-break-named-arguments-list = true
align-assignment-like = true
sort-class-methods = true

[linter]
minimum-fail-level = "Help"
integrations = ["laminas", "phpunit"]

[linter.rules]
literal-named-argument = { enabled = true }
halstead = { effort-threshold = 7000 }
valid-docblock = { enabled = true }
no-negated-ternary = { enabled = true }
no-short-bool-cast = { enabled = true }
no-inline = { enabled = true }
no-array-accumulation-in-loop = { enabled = true }
no-literal-namespace-string = { enabled = true }
no-parameter-shadowing = { enabled = true }
no-side-effects-with-declarations = { enabled = true }
prefer-array-spread = { enabled = true }
prefer-explode-over-preg-split = { enabled = true }
prefer-first-class-callable = { check-functions = true }
prefer-test-attribute = { enabled = true }
require-namespace = { enabled = true }
prefer-pre-increment = { enabled = true }
prefer-self-return-type = { enabled = true }
sorted-integer-keys = { enabled = true }
yoda-conditions = { enabled = true }
file-name = { enabled = true }
array-style = { level = "Help" }
block-statement = { level = "Help" }
braced-string-interpolation = { enabled = true, level = "Help" }
no-alias-function = { level = "Help" }
no-php-tag-terminator = { level = "Help" }
no-trailing-space = { level = "Help" }
string-style = { enabled = true, level = "Help" }
ambiguous-constant-access = { enabled = true }
ambiguous-function-call = { enabled = true }
class-name = { psr = true }
function-name = { camel = true, exclude = ["src/functions/*"] }
interface-name = { psr = true }
method-name = { enabled = true, camel = true }
no-fully-qualified-global-class-like = { enabled = true }
no-fully-qualified-global-constant = { enabled = true }
no-fully-qualified-global-function = { enabled = true }
property-name = { enabled = true }
trait-name = { psr = true }
variable-name = { enabled = true, camel = true, either = false }
too-many-methods = { exclude = ["test/"] }
no-iterator-to-array-in-foreach = { enabled = true }
no-duplicate-match-arm = { level = "Help" }
no-empty-comment = { level = "Help" }
no-empty-loop = { level = "Help" }
no-is-null = { enabled = true, level = "Help" }
no-null-property-init = { enabled = true }
no-redundant-else = { enabled = true }
disallowed-type-instantiation = { enabled = true }
no-debug-symbols = { level = "Help" }
no-assign-in-argument = { enabled = true }
no-dead-store = { enabled = true }
no-redundant-variable = { enabled = true }
no-unused-closure-capture = { enabled = true }
no-unused-global = { enabled = true }
no-unused-static = { enabled = true }
switch-continue-to-break = { enabled = true }
invalid-open-tag = { level = "Help" }

[analyzer]
plugins = ["psl", "psr-container"]
find-unused-definitions = true
find-unused-expressions = true
find-overly-wide-return-types = true
analyze-dead-code = true
memoize-properties = true
check-throws = true
unchecked-exceptions = [
'Error',
'LogicException',
'PHPUnit\Framework\Exception',
'PHPUnit\Framework\MockObject\Exception',
'PHPUnit\Event\NoPreviousThrowableException',
]
unchecked-exception-classes = []
check-missing-override = true
find-unused-parameters = true
strict-list-index-checks = true
strict-array-index-existence = true
allow-array-truthy-operand = false
no-boolean-literal-comparison = true
check-missing-type-hints = true
check-arrow-function-missing-type-hints = true
register-super-globals = false
check-property-initialization = true
class-initializers = [
'PHPUnit\Framework\TestCase::setUp',
'PHPUnit\Framework\TestCase::setUpBeforeClass',
]
check-use-statements = true
check-name-casing = true
enforce-class-finality = false
require-api-or-internal = false
ignore = [
{ code = "invalid-enum-case-value", in = "src/Sql/" },
]
52 changes: 38 additions & 14 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
parameters:
ignoreErrors:
-
message: '#^Variable \$paramSpecs might not be defined\.$#'
identifier: variable.undefined
message: '#^Offset 0 on array\{list\<string\>\} on left side of \?\? always exists and is not nullable\.$#'
identifier: nullCoalesce.offset
count: 1
path: src/Sql/AbstractSql.php
path: src/Sql/Expression.php

-
message: '#^Argument of an invalid type PhpDb\\Sql\\Platform\\PlatformDecoratorInterface supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
count: 1
path: src/Sql/Platform/Platform.php

-
message: '#^Method PhpDb\\Sql\\Platform\\Platform\:\:getDecorators\(\) should return array\<string, PhpDb\\Sql\\Platform\\PlatformDecoratorInterface\> but returns PhpDb\\Sql\\Platform\\PlatformDecoratorInterface\.$#'
identifier: return.type
count: 1
path: src/Sql/Platform/Platform.php

-
message: '#^Parameter \#1 \$attribute \(string\) of method PhpDbTest\\Adapter\\Driver\\TestAsset\\PdoMock\:\:getAttribute\(\) should be compatible with parameter \$attribute \(int\) of method PDO\:\:getAttribute\(\)$#'
Expand Down Expand Up @@ -78,6 +90,12 @@ parameters:
count: 3
path: test/unit/Sql/AbstractSqlFunctionalTestCase.php

-
message: '#^Call to new PhpDb\\Sql\\Argument\\Select\(\) on a separate line has no effect\.$#'
identifier: new.resultUnused
count: 1
path: test/unit/Sql/ArgumentTest.php

-
message: '#^PHPDoc tag @var with type PhpDb\\Sql\\Ddl\\Column\\ColumnInterface is not subtype of native type PHPUnit\\Framework\\MockObject\\MockObject\.$#'
identifier: varTag.nativeType
Expand All @@ -91,22 +109,22 @@ parameters:
path: test/unit/Sql/Ddl/AlterTableTest.php

-
message: '#^Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject\:\:addColumn\(\)\.$#'
identifier: method.notFound
message: '#^Access to an undefined property PhpDb\\Sql\\Delete\:\:\$unknown\.$#'
identifier: property.notFound
count: 1
path: test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php
path: test/unit/Sql/DeleteTest.php

-
message: '#^Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject\:\:getColumns\(\)\.$#'
identifier: method.notFound
count: 3
path: test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php
message: '#^Access to protected property PhpDb\\Sql\\Delete\:\:\$table\.$#'
identifier: property.protected
count: 1
path: test/unit/Sql/DeleteTest.php

-
message: '#^Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject\:\:setColumns\(\)\.$#'
identifier: method.notFound
count: 2
path: test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with array\|PhpDb\\Sql\\TableIdentifier\|string will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: test/unit/Sql/DeleteTest.php

-
message: '#^Access to an undefined property PhpDb\\Sql\\InsertIgnore\:\:\$foo\.$#'
Expand All @@ -125,3 +143,9 @@ parameters:
identifier: property.notFound
count: 1
path: test/unit/Sql/InsertTest.php

-
message: '#^Access to an undefined property PhpDb\\Sql\\Select\:\:\$invalidProperty\.$#'
identifier: property.notFound
count: 1
path: test/unit/Sql/SelectTest.php
Loading