Skip to content

feat!: upgrade all dependencies to current stable versions#32

Open
Patrick Gugelsberger (Patrick-Gugelsberger) wants to merge 2 commits into
masterfrom
dependency_update
Open

feat!: upgrade all dependencies to current stable versions#32
Patrick Gugelsberger (Patrick-Gugelsberger) wants to merge 2 commits into
masterfrom
dependency_update

Conversation

@Patrick-Gugelsberger

Copy link
Copy Markdown
Contributor

feat!: upgrade all dependencies to current stable versions

Summary

Upgrades every dependency in jtl/connector-core to its current stable version. This is a breaking change — minimum PHP version moves from 7.4 to 8.2 and multiple major versions are bumped.


Dependency Changes

Production (require)

Package Before After
php >=7.4 >=8.2
symfony/* (5 packages) ^5.0|^6.0 ^8.0
doctrine/dbal ^3.0 ^4.0
doctrine/collections ^2.2 ^3.0
monolog/monolog ^2.0|^3.0 ^3.0
php-di/php-di ^6.0 ^7.0

Development (require-dev)

Package Before After
phpunit/phpunit ^9.0 ^11.0
phpstan/phpstan ^1.0 ^2.0
squizlabs/php_codesniffer ^3.10 ^4.0
slevomat/coding-standard ^8.15 ^8.29
micheh/phpcs-gitlab ^1.1 ^2.0
jtl/connector-cq * ^2.0
mockery/mockery ^1.3 ^1.6

Removed

Package Reason
doctrine/annotations Zero direct usage in codebase
doctrine/cache Zero direct usage in codebase
jtl/unit-test Only provided 3 reflection helpers — inlined into tests/src/dbc/TestCase.php

Code Changes by Area

Doctrine DBAL 3 → 4 (largest migration)

The custom QueryBuilder (src/dbc/Query/QueryBuilder.php) was fully rewritten to work with DBAL 4's redesigned builder API. Key changes across the DBAL layer:

  • QueryBuilder: Tracks query type internally; applies restrictions differently per type (INSERT via setValue, UPDATE via set+andWhere, SELECT/DELETE via andWhere)
  • Result API: fetch()fetchAssociative(), fetchAll()fetchAllAssociative()
  • Execution: execute() removed → executeQuery() / executeStatement()
  • Schema: getSchemaManager()createSchemaManager(), getMigrateToSql()Comparator + getAlterSchemaSQL()
  • Types: Type::getName()TypeRegistry::lookupName(), platform classes renamed (MySqlPlatformMySQLPlatform, SqlitePlatformSQLitePlatform)
  • Parameters: Connection::PARAM_STR_ARRAYArrayParameterType::STRING
  • Exceptions: DBALExceptionException, SchemaException::columnDoesNotExist()ColumnDoesNotExist::new(), ConversionException::conversionFailedInvalidType()InvalidType::new()
  • Connection params: pdo key no longer accepted, driver key mandatory
  • SQLite schema normalization: Added normalizeIntrospectedSchema() to handle type mismatches (DateTimeType vs DateTimeImmutableType, float defaults) during schema comparison

Affected files: src/dbc/ (8 files), src/mapping-tables/ (4 files), corresponding test files

Symfony 7 → 8

  • Request::get() removed → replaced with $request->request->get() (POST) and $request->query->get() (query string) in Application.php
  • Test mocks using disableOriginalConstructor() replaced with real Request objects (typed $files property no longer allows uninitialized access)

PHPUnit 9 → 11

  • 69 @dataProvider#[DataProvider()] attributes across 27 test files
  • All data provider methods made static
  • @depends#[Depends()], @runInSeparateProcess#[RunInSeparateProcess]
  • setMethods()onlyMethods() (2 calls)
  • Removed SebastianBergmann\RecursionContext\InvalidArgumentException (85 occurrences across 45 files)
  • Removed ~260 invalid PHPUnit MockObject exception @throws annotations
  • Fixed unqualified exception names in @throws to prevent namespace misresolution
  • phpunit.xml.dist: Updated schema to 11.5, <coverage><source>

PHPStan 1 → 2

~148 errors fixed across ~47 files at level max:

  • Narrow mixed types before binary operations, casts, foreach, and offset access
  • Remove redundant type checks (instanceof, is_int, is_string, is_array, is_object) flagged by stricter analysis
  • Fix ReflectionClass template covariance — inlined construction instead of storing as typed property
  • Add @var annotations for superglobals ($_SESSION, $_SERVER, $_GET) and loosely-typed method returns
  • Extract typed variables from method chains for static analysis

phpcs 4 / slevomat 8.29

  • 364 @throws annotation ordering violations auto-fixed across 77 files (new ThrowsAnnotationsOrder sniff)
  • $defaultName property → #[AsCommand] attribute on console command

Monolog 3 / PHP-DI 7

  • Removed useAnnotations(true) (PHP-DI 7)
  • Cleaned up backward-compat union type hints in logger processors and handlers

Validation

Check Result
composer run analyze (phpcs + phpstan) 0 errors
composer run tests 891 tests, 1718 assertions

Prerequisites

Requires jtl/connector-cq v2.0.0 (already published).


Stats

  • 114 files changed, 1910 insertions, 2741 deletions

BREAKING CHANGE: Minimum PHP version raised from 7.4 to 8.2.
Multiple major dependency upgrades require consumers to align.

Dependencies upgraded:
- PHP >=7.4 -> >=8.2
- symfony/* ^5.0|^6.0 -> ^8.0 (console, event-dispatcher, filesystem, finder, http-foundation)
- doctrine/dbal ^3.0 -> ^4.0
- doctrine/collections ^2.2 -> ^3.0
- monolog/monolog ^2.0|^3.0 -> ^3.0
- php-di/php-di ^6.0 -> ^7.0
- phpunit/phpunit ^9.0 -> ^11.0
- phpstan/phpstan ^1.0 -> ^2.0
- squizlabs/php_codesniffer ^3.10 -> ^4.0
- slevomat/coding-standard ^8.15 -> ^8.29
- micheh/phpcs-gitlab ^1.1 -> ^2.0
- jtl/connector-cq * -> ^2.0
- mockery/mockery ^1.3 -> ^1.6

Dependencies removed:
- doctrine/annotations (zero usage)
- doctrine/cache (zero usage)
- jtl/unit-test (helpers inlined into tests/src/dbc/TestCase.php)

DBAL 4 migration:
- Rewrite QueryBuilder to track query type internally (INSERT/UPDATE/DELETE/SELECT)
- Replace execute() with executeQuery()/executeStatement()
- Replace fetch()/fetchAll() with fetchAssociative()/fetchAllAssociative()
- Replace getSchemaManager() with createSchemaManager()
- Replace Schema::getMigrateToSql() with Comparator + Platform::getAlterSchemaSQL()
- Replace Type::getName() with TypeRegistry::lookupName()
- Replace Connection::PARAM_STR_ARRAY with ArrayParameterType::STRING
- Replace DBALException with Exception, SchemaException with ColumnDoesNotExist::new()
- Replace ConversionException::conversionFailedInvalidType() with InvalidType::new()
- Add normalizeIntrospectedSchema() for SQLite type round-trip mismatches
- Update platform class references (MySqlPlatform -> MySQLPlatform, SqlitePlatform -> SQLitePlatform)
- Update connection params (driver key mandatory, pdo key removed)

Symfony 8 migration:
- Replace removed Request::get() with Request::request->get() / Request::query->get()
- Replace Request mock with real Request in tests (typed  property)

Monolog 3 / PHP-DI 7:
- Remove useAnnotations(true) call
- Clean up backward-compat union type hints in logger processors/handlers

PHPUnit 11 migration:
- Convert 69 @dataProvider annotations to #[DataProvider()] attributes across 27 files
- Make all data provider methods static
- Convert @Depends to #[Depends()], @runInSeparateProcess to #[RunInSeparateProcess]
- Replace setMethods() with onlyMethods()
- Remove SebastianBergmann\RecursionContext\InvalidArgumentException (85 occurrences, 45 files)
- Remove invalid PHPUnit MockObject exception imports and @throws (~260 annotations)
- Fix unqualified exception names in @throws to prevent namespace misresolution
- Inline jtl/unit-test reflection helpers into tests/src/dbc/TestCase.php
- Update phpunit.xml.dist schema to 11.5, replace <coverage> with <source>

PHPStan 2 migration:
- Fix ~148 errors across ~47 files at level max
- Narrow mixed types before binary ops, casts, foreach, offset access
- Remove redundant type checks (instanceof, is_int, is_string, is_array, is_object)
- Fix ReflectionClass template covariance (inline instead of property)
- Add @var annotations for superglobals and loosely-typed returns
- Extract typed variables from method chains for static analysis

phpcs 4 / slevomat 8.29:
- Auto-fix 364 @throws annotation ordering violations across 77 files
- Console command: $defaultName property -> #[AsCommand] attribute

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades jtl/connector-core to current stable dependencies (PHP 8.2+, Symfony 8, Doctrine DBAL 4, Monolog 3, PHPUnit 11, PHPStan 2) and adapts the codebase and test suite to the new major-version APIs.

Changes:

  • Migrates DB access layer to Doctrine DBAL 4 (schema diffing, query execution, types, exceptions).
  • Updates runtime and serializer/logging utilities for Symfony 8 / Monolog 3 / stricter typing.
  • Modernizes PHPUnit tests to PHPUnit 11 attributes and updated mocking/exception APIs.

Reviewed changes

Copilot reviewed 114 out of 114 changed files in this pull request and generated 36 comments.

Show a summary per file
File Description
tests/src/Utilities/StrTest.php PHPUnit 11 DataProvider attributes
tests/src/TestCase.php Test base updates (static providers)
tests/src/Subscriber/SyncErrorSubscriberTest.php Stronger assertion for no errors
tests/src/Subscriber/RequestParamsTransformSubscriberTest.php DataProvider attributes + doc updates
tests/src/Subscriber/FeaturesSubscriberTest.php PHPUnit exception cleanup
tests/src/Session/SqliteSessionHandlerTest.php PHPStan-friendly typing assertions
tests/src/Session/SessionHelperTest.php Session superglobal typing annotations
tests/src/Serializer/Subscriber/ProductAttributeSubscriberTest.php PHPStan-friendly stdClass typing
tests/src/Serializer/Subscriber/LanguageIsoSubscriberTest.php PHPUnit 11 providers + exception cleanup
tests/src/Serializer/Subscriber/ImageSubscriberTest.php Adds assertion + exception cleanup
tests/src/Serializer/Subscriber/CrossSellingSubscriberTest.php DataProvider attribute + typing
tests/src/Serializer/Handler/IdentityHandlerTest.php DataProvider attribute + static provider
tests/src/Rpc/ResponsePacketTest.php DataProvider attribute + exception cleanup
tests/src/Rpc/RequestPacketTest.php DataProvider attributes + updated provider types
tests/src/Rpc/PacketTest.php Docblock ordering tweak
tests/src/Rpc/MethodTest.php DataProvider attribute + static provider
tests/src/Rpc/ErrorTest.php Removes redundant assertion pattern
tests/src/Model/TranslatableAttributeTest.php PHPUnit 11 attributes + provider hardening
tests/src/Model/TranslatableAttributeI18nTest.php PHPUnit 11 attributes + provider static
tests/src/Model/ModelTest.php DataProvider attribute + provider hardening
tests/src/Model/AbstractImageTest.php DataProvider attribute + static providers
tests/src/mapping-tables/TableStub.php DBAL exception type migration
tests/src/mapping-tables/TableProxyTest.php DBAL exception type migration
tests/src/mapping-tables/TableManagerTest.php DBAL exception type migration
tests/src/mapping-tables/TableDummyTest.php PHPUnit exception cleanup
tests/src/mapping-tables/TableCollectionTest.php PHPUnit exception cleanup
tests/src/Logger/LoggerServiceTest.php Updated exception docs for PHPUnit/Monolog
tests/src/Linker/IdentityLinkerTest.php DataProvider attribute + deterministic providers
tests/src/Definition/RpcMethodTest.php DataProvider attributes + merge behavior tweak
tests/src/Definition/RelationTypeTest.php DataProvider attributes + static providers
tests/src/Definition/PaymentTypeTest.php DataProvider attribute + static provider
tests/src/Definition/ModelTest.php DataProvider attributes + stronger typing
tests/src/Definition/IdentityTypeTest.php DataProvider attribute + static provider
tests/src/Definition/EventTest.php DataProvider attribute + static provider
tests/src/Definition/ControllerTest.php DataProvider attribute + static provider
tests/src/Definition/ActionTest.php DataProvider attribute + static provider
tests/src/dbc/Types/Uuid4TypeTest.php DBAL 4 platform/type exception updates
tests/src/dbc/TestCase.php Inlines removed helpers; DBAL 4 execution API
tests/src/dbc/TableStub.php DBAL 4 Result + Types constants
tests/src/dbc/TableCollectionTest.php DBAL exception type migration
tests/src/dbc/Table2Stub.php DBAL Types constants migration
tests/src/dbc/Schema/TableRestrictionTest.php DBAL 4 ColumnDoesNotExist exception
tests/src/dbc/DbManagerTest.php DBAL 4 params + execution APIs
tests/src/dbc/DbManagerStub.php Adjusts return shapes for DBAL 4
tests/src/dbc/CoordinatesStub.php DBAL 4 Result + Types constants
tests/src/Controller/ConnectorTest.php PHPUnit exception cleanup
tests/src/Config/FileConfigTest.php PHPUnit exception cleanup
tests/src/Config/ConfigSchemaTest.php PHPUnit exception cleanup
tests/src/Config/ConfigParameterTest.php DataProvider attribute + static provider
tests/src/Authentication/TokenValidationTest.php DataProvider attribute + static provider
tests/src/Application/ResponseTest.php DataProvider attribute + static provider
tests/src/Application/RequestTest.php PHPUnit exception cleanup
tests/bootstrap.php Removes Doctrine annotations bootstrap
src/Utilities/Validator/ValidatorInterface.php Docblock ordering tweak
src/Utilities/Validator/Validator.php Better exception message typing
src/Utilities/Validator/Validate.php Docblock ordering tweak
src/Utilities/Money.php Tightens legacy method signatures/docs
src/System/Check.php Clearer PHP version compare logic
src/SyncError/SqliteSyncErrorCollector.php PHPStan typing for sqlite fetch result
src/Subscriber/RequestParamsTransformSubscriber.php Safer array handling + typed usort
src/Session/SqliteSessionHandler.php Docblock ordering tweak
src/Session/SessionHelper.php Session superglobal typing annotations
src/Serializer/Subscriber/ProductStockLevelSubscriber.php Removes phpstan ignore via visitor typing
src/Serializer/Subscriber/LanguageIsoSubscriber.php Removes phpstan ignore + typing
src/Serializer/Subscriber/ImageSubscriber.php Removes phpstan ignore + typing
src/Serializer/Subscriber/CrossSellingSubscriber.php Removes phpstan ignores + typing
src/Serializer/SerializerBuilder.php Docblock ordering tweak
src/Serializer/Handler/IdentityHandler.php Adds typing for current path
src/Rpc/ResponsePacket.php Warning validation tweak
src/Rpc/RequestPacket.php Removes annotations exception references
src/Rpc/Packet.php Removes annotations exception references
src/Model/TranslatableAttributeI18n.php Docblock ordering tweak
src/Model/TranslatableAttribute.php Adjusts getValues type selection logic
src/Model/QueryFilter.php Stronger stdClass handling/typing
src/Model/Generator/TaxRateFactory.php Docblock ordering tweak
src/Model/Generator/ProductVariationFactory.php Corrects i18ns array typing
src/Model/Generator/ProductPriceFactory.php Makes faker price generation safer
src/Model/Generator/ProductFactory.php Docblock ordering tweak
src/Model/Generator/AbstractModelFactory.php Better typing around overrides + asserts
src/Model/AbstractImage.php Removes cached ReflectionClass property
src/mapping-tables/Validator.php Uses DBAL 4 Result type
src/mapping-tables/TableProxy.php DBAL exception type migration + doc updates
src/mapping-tables/TableManager.php Adjusts boolean semantics for operations
src/Logger/Processor/WarningProcessor.php Monolog 3 LogRecord-only processor
src/Logger/Processor/RequestProcessor.php Monolog 3 LogRecord-only processor
src/Logger/LoggerService.php Monolog 3 log level resolution + handler lifecycle
src/Logger/Handler/ChunkedHandler.php Monolog 3 LogRecord-only handler
src/Linker/IdentityLinker.php Docblock ordering tweak
src/Linker/ChecksumLinker.php Better typing around checksums/model id
src/Http/JsonResponse.php Removes annotations exception references
src/Definition/PaymentType.php Tightens cached constants typing
src/Definition/Event.php Docblock ordering tweaks
src/Definition/Action.php Tightens cached constants typing
src/dbc/Types/Uuid4Type.php DBAL 4 type exception + SQL conversion changes
src/dbc/TableCollection.php Simplifies has()
src/dbc/Session/SessionHandler.php DBAL 4 query execution + builder API
src/dbc/Schema/TableRestriction.php DBAL 4 ColumnDoesNotExist exception
src/dbc/Query/QueryBuilder.php DBAL 4 QueryBuilder rewrite for restrictions
src/dbc/DbManager.php DBAL 4 schema diffing + normalize introspected schema
src/dbc/Console/Command/UpdateDatabaseSchemaCommand.php Symfony 8 AsCommand attribute
src/dbc/Connection.php DBAL 4 parameter/return typing + rollback rename
src/dbc/AbstractTable.php DBAL 4 types registry + Result API updates
src/Controller/ConnectorController.php Safer feature parsing + ini_get handling
src/Config/CoreConfigInterface.php Docblock ordering tweak
phpunit.xml.dist PHPUnit 11 schema + <source> config
composer.json Dependency bumps + PHP 8.2 minimum

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 67 to 71
if (!empty($this->warnings)) {
foreach ($this->warnings as $warning) {
if (!\is_string($warning)) {
if ($warning === '') {
$isValid = false;
}
Comment on lines 72 to 75
* @return void
* @throws \PHPUnit\Framework\ExpectationFailedException
* \Exception
* @throws \RuntimeException
Comment on lines 89 to 93
* @return void
* @throws ExpectationFailedException
* @throws InvalidArgumentException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws \InvalidArgumentException
* \Exception
* @throws \PHPUnit\Framework\ExpectationFailedException
*/
Comment on lines 106 to 109
* @return void
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws \PHPUnit\Framework\ExpectationFailedException
* \Exception
*/
Comment on lines 103 to 107
* @return void
* @throws DatabaseException
* @throws ExpectationFailedException
* @throws InvalidArgumentException
* @throws RuntimeException
* @throws \InvalidArgumentException
* @throws \InvalidArgumentException
* @throws \PDOException
Comment on lines 20 to 25
/**
* @return array<int, \Doctrine\DBAL\Schema\Table>
* @throws DBALException
* @return array<\Doctrine\DBAL\Schema\Table>
* @throws DbcRuntimeException
* @throws DbcRuntimeException
* @throws Exception
*/
Comment on lines 7 to 11
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Result;
use Jtl\UnitTest\TestCase as JtlTestCase;
use PDO;
use PDOException;
use RuntimeException;
Comment thread src/dbc/DbManager.php
Comment on lines +10 to 14
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\SchemaManagerFactory;
use Doctrine\DBAL\Schema\Table;
Comment on lines 63 to 67
*/
public function save(int $type, string $endpointId, int $hostId): bool
{
return \is_int($this->collection->get($type)->save($endpointId, $hostId));
return $this->collection->get($type)->save($endpointId, $hostId) > 0;
}
Comment thread composer.json
Comment on lines 14 to 16
"require": {
"php": ">=8.1",
"php": ">=8.2",
"jms/serializer": "*",
Replace the single Mockery usage in IdentityLinkerTest with PHPUnit's
built-in createMock(). Sequential return values are handled via
willReturnCallback() with array queues. This also removes the transitive
hamcrest/hamcrest-php dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants