Replacement for deprecated Shopware EntityRepositoryInterface is also deprecated - symfony

According to Shopware 6.4.13.0 upgrade instructions, EntityRepositoryInterface has been deprecated and should be replaced by EntityRepository. But EntityRepository is also marked as deprecated in my IDE, using the recommended development setup all upgraded to the latest versions:
PhpStorm (2022.1.3 Build #PS-221.5921.28)
Symfony Support plugin 2022.1.230
Shopware plugin 4.4.3
Shopware development setup cloned from github.com/shopware/development
Shopware platform "6.4.9999999.9999999 Developer Version"
loaded and upgraded by psh according to composer.json in development setup:
"require": {
"shopware/platform": "6.4.x#dev || dev-trunk"
Deprecation note in my PhpStorm IDE:
Class 'EntityRepository' is deprecated
class EntityRepository implements EntityRepositoryInterface \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
Deprecated: 5.6.0
Namespace:
\Shopware\Core\Framework\DataAbstractionLayer\
Source:
development/vendor/shopware/platform/src/Core/Framework/DataAbstractionLayer/EntityRepository.php
How to handle the deprecation and what to use instead of EntityRepositoryInterface that will not be deprecated as well?
How to know if the IDE's deprecation notice can be safely ignored? I suppose that it can be ignored, as the mentioned version number "5.6.0" does not match any current or upcoming Shopware 6 release.
How to turn off misleading deprecation notices in my IDE?

Has been fixed with commit https://github.com/shopware/platform/commit/99cf9093464d679f6abcb91bb68cc4205bc6ccf0
it has now only #final https://github.com/shopware/platform/blob/trunk/src/Core/Framework/DataAbstractionLayer/EntityRepository.php#L29

Related

symfony 4.4 + sonata deprecations like sonata.deprecated_text.twig.extension | sonata.twig.deprecated_template_extension

I've installed sonata + symfony 4.4 on new clean empty project.
Did everything according to https://symfony.com/doc/current/bundles/SonataAdminBundle/getting_started/installation.html
and executed the recipes , composer adviced me to apply.
But on pristine setup I'm having a few deprecations like:
User Deprecated: The "sonata.twig.deprecated_template_extension"
service is deprecated since sonata-project/twig-extensions 1.4.
User Deprecated: The "sonata.deprecated_text.twig.extension" service
is deprecated since sonata-project/admin-bundle 3.70. You should stop
using it, as it will be removed in 4.0.
The child node "legacy_twig_text_extension" at path
"sonata_admin.options" is deprecated since sonata-project/admin-bundle
3.70 and will be removed in 4.0.
Is it ok? I don't have any legacy I've just set up compeltely new project?
Can I somehow avoid these deprecations or is it just an expected behavior and I have to get used to it?

class PHPUnit\Framework\ExpectationFailedException not found

when I try to run a failed test with this command :
./vendor/bin/phpunit
I get this Fatal Error :
PHPUnit 5.7.20 by Sebastian Bergmann and contributors.
PHP Fatal error: Class 'PHPUnit\Framework\ExpectationFailedException'
not found in /var/www/zend/vendor/zendframework/zend-
test/src/PHPUnit/Controller/AbstractControllerTestCase.php on line 444
Your version of phpunit is probably too old for your version of Zend. The class PHPUnit\Framework\ExpectationFailedException have been renamed in PhpUnit 6.X from PHPUnit_Framework_ExpectationFailedException to ExpectationFailedException
Please check your PhpUnit version: phpunit --version, it should be 6.X. Update it to the last version to avoid this error.
This is "fixed" by a script in Zend\Test called phpunit-class-aliases.php but it's not configured properly IMHO since it's in the autoload-dev section (meaning it doesn't propagate out to other projects.)
So, in your project composer.json, do something like this:
"autoload-dev": {
"files": [
"vendor/zendframework/zend-test/autoload/phpunit-class-aliases.php"
]
},
Then composer install
N.B. Zend\Test has a pull request that fixes this very thing, but they're saying it's PHPUnit's fault (Shame on you PHPUnit 4 for... idunno... having the wrong class name according to Zend\Test) So, I've done it instead: composer require illchuk/phpunit-class-aliases
This is a configuration flaw in zend-test. It consumes classes from Phpunit 6 but per it's Composer requirements, Phpunit before that version are OK to require:
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0",
Most likely as your system because of the PHP version does not satisfy the requirements of Phpunit 6, the next lower version was installed.
As the code in the base test case (https://github.com/zendframework/zend-test/blob/master/src/PHPUnit/Controller/AbstractControllerTestCase.php#L444) makes use of Phpunit 6 classes, I strongly assume that when the configuration flaw is made aware to the Zend-Test project, you won't be even able to install on your system any longer.
Therefore upgrade to a recent PHP version and then run
composer update
If you're stuk with the PHP version, downgrade zend-test to a version that supports an older Phpunit version. I don't know that project well, so it's just a suggestion, I don't know if such a version exists or can't even recommend one.
I filed a report, perhaps using that one class was an oversight or there is a less hard way to resolve the dependency: https://github.com/zendframework/zend-test/issues/50

FOSRestBundle & JMSSerializerBundle with symfony 2.7 and PHP 5.5.12

I'd like to add the 2 libraries FOSRestBundle & JMSSerializerBundle to my application built with symfony 2.7 but i encountred this response
Problem 1
- Installation request for friendsofsymfony/rest-bundle dev-master -> satisfiable by friendsofsymfony/rest-bundle[dev-master].
- friendsofsymfony/rest-bundle dev-master requires php ^5.5.9|~7.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Problem 2
- Installation request for jms/serializer-bundle dev-master -> satisfiable by jms/serializer-bundle[dev-master].
- jms/serializer-bundle dev-master requires php >=5.4.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Notice that PHP version is 5.5.12
I think the problem is the version of this 2 libraries. If yes, What are the versions of FOSRestBundle & JMSSerializerBundle ?
dev-master should never be used as version bound when requiring a package as dependency, except in some specific cases.
Go to https://packagist.org/ then search for the packages you are looking for and use their respective current stable version as version bound for your composer.json's requirement.
Also, in your composer.json, you have a config key containing a platform.php key with 5.3.9 as value. Remove or override this block according to your real PHP version. See Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement.
Of course, if the last stable version of one of them isn't compatible with your environment (PHP >= 5.5.9 for friendsofsymfony/rest-bundle), you need to look for an older version supporting your environment (all is available on packagist, and surely on the official documentation of these packages).

Symfony 3.0.4 security.secure_random doesn't exists

I'm migrating symfony 2.6 app to the 3.0.4, I'm in a trouble with security.secure_random service, I was using it with dependency injection. Which is representing in security.xml
but I cannot see in 3.0.x I checked changelog every pixel of the project where it does go ? That I'm missing something ?
The class deprecated in 2.8 and removed in 3.0 in favour of the random_bytes function.
Essentialy the SecureRandomInterface had one nextBytes method, which behaves exactly as the PHP7 random_bytes function.
You can install https://github.com/paragonie/random_compat for forward compatibility

recent version of FOSTwitterBundle

In my symfony project i would like to implement a twitter inscription button, and
i'm searching about the most recent version of FOSTwitterBundle(version 1.1).
the version which i found is not compatible with symfony2.2.1.
Unfortunately the FOSTwitterBundle has no released versions yet for current symfony versions. You have to use the dev-master branch.
"require": {
"kertz/twitteroauth": "*#dev",
"friendsofsymfony/twitter-bundle": "*#dev"
}

Resources