Comments (9)
Yes, this depends on the parent implementation regardless.
The PHP documentation is really mostly irrelevant: tests and php-src code are authoritative.
from proxymanager.
I suggest reproducing this on a test in the ProxyManager test suite: AFAIK, void
is well covered, but feel free to expand on it where you see holes.
from proxymanager.
@Ocramius Not sure why this issue was closed as it is still present/not fixed. I've just run into the same issue as the author of this issue during the generation of a proxy of the \Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
class (which has an explicit void
return type for the __set
and __unset
methods in the \Symfony\Component\VarExporter\LazyGhostTrait
trait which it uses since doctrine/DoctrineBundle#1599).
There's no check at all whether the parent has a void
return type or not, if it detects that there's a parent method it always calls the parent with a return
.
from proxymanager.
Using LazyGhostTrait together with this lib is likely going to explode. You need to figure out why you end up using both on the same class and keep only one of them.
from proxymanager.
@nicolas-grekas We are not using both on the same class. Only proxy manager is being used on that class.
We are using Symfony 5.4 in the app, but we have a transitive dependency which pulled in symfony/var-exporter
6.2 which has the LazyGhostTrait
trait and everything works fine. We are using Doctrine ORM 2.13 and Doctrine bundle 2.7 and now I've wanted to update to ORM 2.14 and Doctrine bundle 2.8. After updating those dependencies and running bin/console ca:cl
we get the Compile Error: A void function must not return a value
error.
from proxymanager.
I'd be happy to have a look at a reproducer if you can provide one please, to confirm whether there's something to fix in this repo or another.
from proxymanager.
@nicolas-grekas 👍 I'll try to create a reproducer soon.
from proxymanager.
@nicolas-grekas Here's a reproducer https://github.com/X-Coder264/proxy-reproducer-bug
It blows up when the repository service is fetched from the container. In our case that happens during the cache:clear
command (as one of the cache warmers tries to instantiate that repository), in the reproducer you have to run bin/console foo
to get the error (the repository is injected in that command).
from proxymanager.
Thanks, makes sense now. The issue is indeed in this repo, which generates this code:
public function __set($name, $value) : void
{
$this->initializer480f6 && ($this->initializer480f6->__invoke($valueHolderd4bf6, $this, '__set', array('name' => $name, 'value' => $value), $this->initializer480f6) || 1) && $this->valueHolderd4bf6 = $valueHolderd4bf6;
return $this->valueHolderd4bf6->__set($name, $value);
}
The return
is wrong obviously. I guess this issue should be reopened + fixed. Anyone up to give it a try?
The work around is to not make your repository lazy. It should not be needed anyway.
from proxymanager.
Related Issues (20)
- Add PHP 8.1 to CI pipeline HOT 1
- Verify support of `readonly` properties
- Upgrade CI pipeline to fit in a single file
- Integrate dependabot upgrades for PHP and GitHub Actions, including auto-merge
- Add `mixed` type to verified type checks
- Add simple check verifying that proxying an `enum` type fails
- Add scenario for generating proxies for union types in class properties
- Add scenario for generating proxies for intersection types in class properties/parameters/methods
- Verify code generation for the new `never` type HOT 1
- Consider replacing Prefix/suffix interceptor approach with middleware approach HOT 4
- Promoted readonly properties are not respected HOT 7
- Setting property default value to enum points to invalid namespace HOT 12
- AccessInterceptorValueHolder which proxies a parent __get triggers E_USER_NOTICE
- Error with static return type HOT 3
- Directly invoking proxy within pre hook crashes terminal HOT 2
- Dependency Dashboard
- Use of mutation testing in ProxyManager - Help needed HOT 1
- Get returned data of called method HOT 3
- Nullable constructor property promotion support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxymanager.