Giter Site home page Giter Site logo

Comments (6)

korkoshko avatar korkoshko commented on May 24, 2024 2

@plumthedev This isn't a BC. Your example isn't entirely accurate in this case. This applies only to parameters that default to null (they implicitly become nullable). So, int $foo = null is equal to ?int $foo = null.

Before:

// framework class
interface Service
{
	public function func(DateTime $date = null): void;
}

// application class
class FooService implements Service
{
	public function func(DateTime $date = null): void
	{
		echo $date->format('Y');
	}
}

(new FooService())->func(new DateTime('now'));

After:

// framework class
interface Service
{
	public function func(?DateTime $date = null): void;
}

// application class
class FooService implements Service
{
	public function func(DateTime $date = null): void
	{
		echo $date->format('Y');
	}
}

(new FooService())->func(new DateTime('now'));

from framework.

plumthedev avatar plumthedev commented on May 24, 2024 2

Indeed you are right @korkoshko - thanks for your eagle eye 😄

from framework.

driesvints avatar driesvints commented on May 24, 2024 1

It's highly unlikely we'll support PHP 8.4 on Laravel v10. But if it's not too much work and there aren't any breaking changes we can give it a go. I'll try to get a CI job up soon.

from framework.

jnoordsij avatar jnoordsij commented on May 24, 2024

It's highly unlikely we'll support PHP 8.4 on Laravel v10. But if it's not too much work and there aren't any breaking changes we can give it a go. I'll try to get a CI job up soon.

It is functionally equivalent and just guessed it is probably easier to maintain by using same styling across both branches, but if it turns out that's not the case then definitely updating just 11.x sounds fine. Moreover it's only a deprecation and not a require change.

from framework.

plumthedev avatar plumthedev commented on May 24, 2024

It is breaking change as method signature will be changed and all child classes which are overriding affected methods will throw a fatal error.

// framework class
interface Service
{
	public function func(?DateTime $date): void;
}

// application class
class FooService implements Service
{
	public function func(DateTime $date): void
	{
		echo $date->format('Y');
	}
}

// Fatal error: Declaration of FooService::func(DateTime $date): void must be compatible with Service::func(?DateTime $date): void 
(new FooService())->func(new DateTime('now'));

from framework.

crynobone avatar crynobone commented on May 24, 2024

PR has been merged to 11.x branch.

from framework.

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.