Happens on PHP 7.1 and higher.
A lot of info messages appear in logs during standards check on CI:
php.INFO: Deprecated: Function ReflectionType::__toString() is deprecated {"exception":"[object] (ErrorException(code: 0): Deprecated: Function ReflectionType::__toString() is deprecated at /var/www/html/vendor/roave/better-reflection/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php:478)"}
Sometimes there are so many warnings that it causes standards to fail.
Newer version of the package should be used so that it doesn't spam those deprecated messages. It was fixed in this commit.
Hi @LuKillman,
I have looked at this and there is problem with circular dependencies. To solve this we would have to also update zalas/phpunit-injector to version 2, which requires PHP 7.4 and newer, so this will be possible in next major version.
This deprecations caused problems on our GitlabCI - output was too big and job failed.
Our workaround:
diff --git a/build.xml b/build.xml
index 564365260..eee6c4c1a 100644
--- a/build.xml
+++ b/build.xml
@@ -206,4 +206,24 @@
</target>
+ <target name="annotations-check" description="Checks whether annotations of extended classes in the project match the actual types according to ClassExtensionRegistry. Reported problems can be fixed using 'annotations-fix' phing target">
+ <if>
+ <istrue value="${check-and-fix-annotations}"/>
+ <then>
+ <exec executable="${path.php.executable}" passthru="true" checkreturn="true">
+ <arg value="${path.bin-console}"/>
+ <arg value="app:extended-classes:annotations"/>
+ <arg value="--dry-run"/>
+ <arg value="--env=test"/>
+ </exec>
+ </then>
+ <else>
+ <echo>
+ Annotations checks are turned off by configuration, see "check-and-fix-annotations" build property.
+ You are still able to run "shopsys:extended-classes:annotations" Symfony command directly.
+ </echo>
+ </else>
+ </if>
+ </target>
+
</project>
diff --git a/config/services/commands.yaml b/config/services/commands.yaml
index ab796272e..2c45356a6 100644
--- a/config/services/commands.yaml
+++ b/config/services/commands.yaml
@@ -6,3 +6,4 @@ services:
App\Command\:
resource: '../../src/Command'
+ exclude: '../../src/Command/ExtendedClassesAnnotationsCommand.php'
diff --git a/config/services_test.yaml b/config/services_test.yaml
index f41a212ad..cc914e522 100644
--- a/config/services_test.yaml
+++ b/config/services_test.yaml
@@ -303,3 +303,12 @@ services:
+
+ Shopsys\FrameworkBundle\Component\ClassExtension\ClassExtensionRegistry:
+ arguments:
+ - '%shopsys.entity_extension.map%'
+ - '%shopsys.framework.root_dir%'
+
+ App\Command\ExtendedClassesAnnotationsCommand:
+ arguments:
+ - '%shopsys.root_dir%'
diff --git a/src/Command/ExtendedClassesAnnotationsCommand.php b/src/Command/ExtendedClassesAnnotationsCommand.php
new file mode 100644
index 000000000..05ad98e89
--- /dev/null
+++ b/src/Command/ExtendedClassesAnnotationsCommand.php
@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Command;
+
+use Shopsys\FrameworkBundle\Command\ExtendedClassesAnnotationsCommand as BaseExtendedClassesAnnotationsCommand;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class ExtendedClassesAnnotationsCommand extends BaseExtendedClassesAnnotationsCommand
+{
+ /**
+ * @var string
+ */
+ protected static $defaultName = 'app:extended-classes:annotations';
+
+ /**
+ * @param \Symfony\Component\Console\Input\InputInterface $input
+ * @param \Symfony\Component\Console\Output\OutputInterface $output
+ * @return int
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ error_reporting(error_reporting() & ~E_DEPRECATED);
+
+ return parent::execute($input, $output);
+ }
+}