Skip to content

UploadableListener::getDefaultPath returns null|string despite defaultPath not being nullable #3042

@crtl

Description

@crtl

Package

show

$ composer show --latest gedmo/doctrine-extensions
name     : gedmo/doctrine-extensions
descrip. : Doctrine behavioral extensions
keywords : Blameable, behaviors, doctrine, extensions, gedmo, loggable, nestedset, odm, orm, sluggable, sortable, timestampable, translatable, tree, uploadable
versions : * v3.22.0
released : 2025-12-13, 2 months ago
latest   : v3.22.0 released 2025-12-13, 2 months ago
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://gediminasm.org/
source   : [git] https://github.com/doctrine-extensions/DoctrineExtensions.git e4350ee2daa7f34aa5806f2e1ea11fa4b5800e57
dist     : [zip] https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/e4350ee2daa7f34aa5806f2e1ea11fa4b5800e57 e4350ee2daa7f34aa5806f2e1ea11fa4b5800e57
path     : /var/www/vendor/gedmo/doctrine-extensions
names    : gedmo/doctrine-extensions

support
docs : https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc
issues : https://github.com/doctrine-extensions/DoctrineExtensions/issues
source : https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.22.0

autoload
psr-4
Gedmo\ => src/

requires
doctrine/collections ^1.2 || ^2.0
doctrine/deprecations ^1.0
doctrine/event-manager ^1.2 || ^2.0
doctrine/persistence ^2.2 || ^3.0 || ^4.0
php ^7.4 || ^8.0
psr/cache ^1 || ^2 || ^3
psr/clock ^1
symfony/cache ^5.4 || ^6.4 || ^7.3 || ^8.0
symfony/string ^5.4 || ^6.4 || ^7.3 || ^8.0

requires (dev)
behat/transliterator ^1.2
doctrine/annotations ^1.13 || ^2.0
doctrine/cache ^1.11 || ^2.0
doctrine/common ^2.13 || ^3.0
doctrine/dbal ^3.7 || ^4.0
doctrine/doctrine-bundle ^2.3 || ^3.0
doctrine/mongodb-odm ^2.3
doctrine/orm ^2.20 || ^3.3
friendsofphp/php-cs-fixer ^3.89
nesbot/carbon ^2.71 || ^3.0
phpstan/phpstan ^2.1.31
phpstan/phpstan-doctrine ^2.0.1
phpstan/phpstan-phpunit ^2.0.3
phpunit/phpunit ^9.6
rector/rector ^2.2.6
symfony/console ^5.4 || ^6.4 || ^7.3 || ^8.0
symfony/doctrine-bridge ^5.4 || ^6.4 || ^7.3 || ^8.0
symfony/phpunit-bridge ^6.4 || ^7.3 || ^8.0
symfony/uid ^5.4 || ^6.4 || ^7.3 || ^8.0
symfony/yaml ^5.4 || ^6.4 || ^7.3 || ^8.0

suggests
doctrine/mongodb-odm to use the extensions with the MongoDB ODM
doctrine/orm to use the extensions with the ORM

conflicts
behat/transliterator <1.2 || >=2.0
doctrine/annotations <1.13 || >=3.0
doctrine/common <2.13 || >=4.0
doctrine/dbal <3.7 || >=5.0
doctrine/mongodb-odm <2.3 || >=3.0
doctrine/orm <2.20 || >=3.0 <3.3 || >=4.0

Doctrine packages

show

$ composer show --latest 'doctrine/*'
# Put the result here.

PHP version

$ php -v
PHP 8.4.18 (cli) (built: Feb 13 2026 18:38:00) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.18, Copyright (c), by Zend Technologies
    with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans

Subject

Type conflict

Steps to reproduce

$listener = $this->uploadableManager->getUploadableListener();
$currentDir = $listener->getDefaultPath();
$listener->setDefaultPath($currentDir); //phpstan warning because $currentDir is nullable

Expected results

getDefaultPath should not return string|null but string because UploadableListener::$defaultPath is also string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions