Coder Social home page Coder Social logo

Symfony 6.3 BC break about clockwork HOT 11 OPEN

mihai-stancu avatar mihai-stancu commented on May 29, 2024
Symfony 6.3 BC break

from clockwork.

Comments (11)

itsgoingd avatar itsgoingd commented on May 29, 2024 1

Hey, I've pushed a bunch of Symfony 6 fixes to dev-master, please give it a try and let me know if it works for you.

Unfortunately, it's impossible to release these in 5.1.x, as they break compatibility with older Symfony versions running on older PHP.

from clockwork.

mihai-stancu avatar mihai-stancu commented on May 29, 2024

At the least this should be mentioned in composer's conflicts section to avoid installing clockwork on an usupported version of Symfony.

from clockwork.

erikn69 avatar erikn69 commented on May 29, 2024

Symfony 6 compatibility was reversed, 51eae8d

from clockwork.

mihai-stancu avatar mihai-stancu commented on May 29, 2024

Thank you @erikn69 that's useful to know.

from clockwork.

erikn69 avatar erikn69 commented on May 29, 2024

There are also PHP 8.2 deprecations ,

$this->container = $container;

Dynamic propertiy `container`
User Deprecated: Since symfony/framework-bundle 5.4: 
    Accessing the "profiler" service directly from the container is deprecated, use dependency injection instead.

from clockwork.

mihai-stancu avatar mihai-stancu commented on May 29, 2024

Thank you, I'll take it for a spin!

from clockwork.

PaolaRuby avatar PaolaRuby commented on May 29, 2024

@itsgoingd hi, what about two Symfony/ClockworkBundle.php files, one for V6 support, like

// Symfony/ClockworkBundleV6.php
class ClockworkBundleV6 extends Bundle
{
	protected function getContainerExtensionClass(): string
	{
		return ClockworkExtension::class;
	}
}

from clockwork.

itsgoingd avatar itsgoingd commented on May 29, 2024

@PaolaRuby That's definitively possible, I'm just not fan of that naming convention and I'm working on a next major version of Clockwork anyway. Since major versions can break backwards-compatibility, we can replace the main Symfony bundle with the updated one and either provide another legacy one or tell people using older Symfony to use older Clockwork version.

from clockwork.

edvordo avatar edvordo commented on May 29, 2024

Old-ish issue, but I thought I'd chime in anyway.

Instead of two files, I've seen devs, that wanted to support older applications just do a PHP version conditional in the class file and implement the whole class within that conditional.

In this case, it could look something like this:

if (true === version_compare(PHP_VERSION, '7.0.0', '<')) {
  class ClockworkBundle extends Bundle
  {
	  protected function getContainerExtensionClass()
	  {
		  return ClockworkExtension::class;
	  }
  }
} else {
  class ClockworkBundle extends Bundle
  {
	  protected function getContainerExtensionClass(): string
	  {
		  return ClockworkExtension::class;
	  }
  }
}

Ugly? Maybe, but it's a solution.

from clockwork.

itsgoingd avatar itsgoingd commented on May 29, 2024

This would be a valid option if the Symfony versions differed only in apis, but won't work when one of the versions uses new PHP syntax features. The older PHP parser needs to parse both branches and throws an error once it encounters the new return type syntax.

from clockwork.

edvordo avatar edvordo commented on May 29, 2024

Well, the symfony kernel provides its current version, so the above conditional could be changed to something like this

if (true === version_compare(\Symfony\Component\HttpKernel\Kernel::VERSION, '6.0.0', '<')) {

and you'd be good to go for whichever version of symfony the end-project uses.

Granted, this is just one class, relatively small and easy to maintain. I'm not familiar with symfony or clockwork enough to say how many classes would need a workaround like this or how much more headache it would add to your life.

from clockwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.