-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
feature/issuesIssues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP codeIssues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP codetype/bugSomething is brokenSomething is broken
Description
| Q | A |
|---|---|
| PHPUnit version | 12.4.5 |
| PHP version | 8.5.0 |
| Installation Method | Composer |
composer info | sort:
myclabs/deep-copy 1.13.4 Create deep copies (clones) of your objects
nikic/php-parser 5.6.2 A PHP parser written in PHP
phar-io/manifest 2.0.4 Component for reading phar.io manifest information fro...
phar-io/version 3.2.1 Library for handling version information and constraints
phpunit/php-code-coverage 12.5.0 Library that provides collection, processing, and rend...
phpunit/php-file-iterator 6.0.0 FilterIterator implementation that filters files based...
phpunit/php-invoker 6.0.0 Invoke callables with a timeout
phpunit/php-text-template 5.0.0 Simple template engine.
phpunit/php-timer 8.0.0 Utility class for timing
phpunit/phpunit 12.4.5 The PHP Unit Testing framework.
sebastian/cli-parser 4.2.0 Library for parsing CLI options
sebastian/comparator 7.1.3 Provides the functionality to compare PHP values for e...
sebastian/complexity 5.0.0 Library for calculating the complexity of PHP code units
sebastian/diff 7.0.0 Diff implementation
sebastian/environment 8.0.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 7.0.2 Provides the functionality to export PHP variables for...
sebastian/global-state 8.0.2 Snapshotting of global state
sebastian/lines-of-code 4.0.0 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 7.0.0 Traverses array structures and object graphs to enumer...
sebastian/object-reflector 5.0.0 Allows reflection of object attributes, including inhe...
sebastian/recursion-context 7.0.1 Provides functionality to recursively process PHP vari...
sebastian/type 6.0.3 Collection of value objects that represent the types o...
sebastian/version 6.0.0 Library that helps with managing the version number of...
staabm/side-effects-detector 1.0.5 A static analysis tool to detect side effects in PHP code
theseer/tokenizer 1.3.1 A small library for converting tokenized PHP source co...
vendor/bin/phpunit --check-php-configuration:
PHPUnit 12.4.5 by Sebastian Bergmann and contributors.
Checking whether PHP is configured according to https://docs.phpunit.de/en/12.4/installation.html#configuring-php-for-development
display_errors = On ... ok
display_startup_errors = On ... ok
error_reporting = -1 ... ok
zend.assertions = 1 ... ok
assert.exception = 1 ... ok
memory_limit = -1 ... ok
Summary
Deprecations triggered when parsing an auto-loaded class are not displayed.
Current behavior
Following the steps below does not display any deprecation.
How to reproduce
Create the following files in a new empty directory:
composer.json:
{
"autoload": {
"psr-4": {
"Bug\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Bug\\Tests\\": "tests/"
}
},
"require-dev": {
"phpunit/phpunit": "^12.4"
}
}phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
failOnPhpunitDeprecation="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
<!-- Uncomment to get the deprecation to display. -->
<!-- <file>vendor/composer/ClassLoader.php</file> -->
</include>
</source>
</phpunit>src/Deprecated.php:
<?php
declare(strict_types=1);
namespace Bug;
final class Deprecated
{
public function __construct(int $deprecated = null) // should trigger "Implicitly marking parameter $deprecated as nullable is deprecated, the explicit nullable type must be used instead"
{
}
}tests/DeprecatedTest.php:
<?php
declare(strict_types=1);
namespace Bug\Tests;
use Bug\Deprecated;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(Deprecated::class)]
final class DeprecatedTest extends TestCase
{
public function testDeprecated(): void
{
$this->assertNotNull(new Deprecated());
}
}Generate the vendor/autoload.php file by running composer dump-autoload.
Run vendor/bin/phpunit --display-deprecations and notice that no deprecation is displayed.
Expected behavior
Following the reproduction steps above should display the following deprecation:
Bug\Deprecated::__construct(): Implicitly marking parameter $deprecated as nullable is deprecated, the explicit nullable type must be used instead
A workaround is to uncomment the <file> element in phpunit.xml. Another workaround is to set ignoreIndirectDeprecations="false".
Metadata
Metadata
Assignees
Labels
feature/issuesIssues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP codeIssues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP codetype/bugSomething is brokenSomething is broken