GithubHelp home page GithubHelp logo

Comments (7)

lorenzo avatar lorenzo commented on May 21, 2024

That could potentially be painful for end users, since using both \DateTime and Chronos\DateTime in the same class would require aliasing.

from chronos.

dereuromark avatar dereuromark commented on May 21, 2024

And the other 3 don't have a core PHP counterpart you mean?

One could probably argue that using both in the same class file is usually a not a good idea. Or should make use of some aliasing like

use DateTime as PhpDateTime;

or manually

new \DateTime()

etc. Since the goal of using this Chronos DateTime class is to make things more consistent you should be using it everywhere to be able to leverage that. Using the PHP core one on top in the same files should be the exception to the rule in that case.

But I understand what you mean.

from chronos.

lorenzo avatar lorenzo commented on May 21, 2024

Yeah, that's what I mean... In general I don't like class names to be repeated, even if we have namespaces, because reading the code becomes more difficult

from chronos.

dereuromark avatar dereuromark commented on May 21, 2024

In that case pre- or suffixing is usually the way to go, but ChronosDateTime could become a little bit much to write maybe?
I still think, though, that mixing the classes inside a class is an edge case. As soon as testing, timezones or buggy core behavior is involved that will blow up eventually.

from chronos.

josegonzalez avatar josegonzalez commented on May 21, 2024

What about:

class Chronos extends Chronos\DateTime

That way users that want to just use the Chronos version can, and all others can use the Chronos name.

from chronos.

dereuromark avatar dereuromark commented on May 21, 2024

That sounds like a fair (and BC) compromise.

from chronos.

antograssiot avatar antograssiot commented on May 21, 2024

PR #74 is open so discution can take place there.

from chronos.

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.