propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 393 forks source link

PHP 8.2 unexpected token "\", expecting variable #1962

Closed murraycollingwood closed 1 year ago

murraycollingwood commented 1 year ago

Hello

It's not often I get errors in the generated classes, but one has just turned up. The error generated is: Parse error: syntax error, unexpected token "\", expecting variable in /Users/murraycollingwood/dev/sobs-git/trunk/generated-classes/Base/Supmonitor.php on line 295

And the base class at line 295 looks like this:

/**
     * An array of objects scheduled for deletion.
     * @var ObjectCollection|ChildSupmon2[]
     * @phpstan-var ObjectCollection&\Traversable<ChildSupmon2>
     */
    protected \{$supmon2s}ScheduledForDeletion = null;

I use a composer install, and apparently I have the dev-master...

murraycollingwood@Jacaranda trunk % composer show propel/propel
name     : propel/propel
descrip. : Propel2 is an open-source Object-Relational Mapping (ORM) for PHP.
keywords : Active Record, orm, persistence
versions : * dev-master, * 2.0.x-dev

PHP 8.2

murraycollingwood@Jacaranda trunk % php -v
PHP 8.2.0 (cli) (built: Dec  8 2022 03:16:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies

I'm running OSX Ventura 13.1

So, what changed recently... hmmm, not really sure. I would have run the composer install recently to get the latest libraries, but nothing that should impact Propel2. Maybe I collected the beta3 release of Propel2 - which I'm hoping and why I'm writing here.

I've been on Venture 13.1 for a few months now, and PHP 8.2 for a few months also. So the Propel2 update is really the only thing that has changes afaik.

I hope somebody can help, because I'm kind of stuck with my development until I can get this resolved.

Cheers Murray

murraycollingwood commented 1 year ago

So on a hunch I tried a composer update propel/propel with the following:

murraycollingwood@Jacaranda trunk % composer update propel/propel
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires sabre/dav dev-master, found sabre/dav[dev-master] but the package is fixed to 4.4.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

So I tried an update of Sabre/dav also: composer update propel/propel sabre/dav And now I'm on source : https://github.com/propelorm/Propel2/tree/2.0.0-beta3

This has resolved the problem.