Comments (3)
Indeed, good catch!
now I'm off to find out what I did wrong to generate this Exception
You tried to use array access syntax in write mode (e.g. $rrule[] = x
or unset($rrule[x])
) which is impossible.
perhaps you could reference such dependencies as at the top of the file (e.g. "use LogicException;") That provides a bit more clarity concerning the external classes you use.
I do not know what are is "recommended" way of doing it, you might be right. Though at first glance it seems that I would need a fair amount of use
statements at the beginning of the file (most of the standard Exceptions, DateTime
, DateTimeZone
, DateTimeInterface
, and so on). Care to elaborate the benefits?
from php-rrule.
You tried to use array access syntax in write mode (e.g. $rrule[] = x or unset($rrule[x])) which is impossible.
You're right. After a code refactor I ended up using $rrule both for the input var and the RRule object.
I do not know what are is "recommended" way of doing it, you might be right. Though at first glance it seems that I would need a fair amount of use statements at the beginning of the file (most of the standard Exceptions, DateTime, DateTimeZone, DateTimeInterface, and so on). Care to elaborate the benefits?
As far as I know it's not part of a PSR standard, so I guess there isn't really a clear recommended way of doing it. The benefits are in particular apparent when you've got a file with several 3rd party references and/or long paths. With built-in classes the benefits are certainly less clear. The exception to this though are Exceptions. It is useful for consuming developers to be able to see at a glance which Exceptions could be thrown by a module.
Some of the other benefits are that you're less likely to make typo's like the one I reported here, you get one clear list of dependencies and by grouping all dependencies you'll be made more aware of the moment you're trying to do too much within a single class. At least, that's my personal view on the matter.
A disadvantage is that the actual line by line code may become somewhat less clear, but if you're using a modern editor (such as PhpStorm) this is not much of an issue.
from php-rrule.
Thank you for taking the time to elaborate. I fully agree with you about 3rd party classes and long names. However, for standard PHP classes, I checked what other PHP projects are doing, and it seems that the standard way of doing it is to reference them with their full name. So I'm going to leave it like that for the moment.
from php-rrule.
Related Issues (20)
- addExRule not working for me HOT 4
- Drop support for PHP < 7.3 HOT 2
- Daylight Savings Time issue with PHP 8.1 HOT 13
- How to create Rrule for every day from X to Y? HOT 4
- How to use exdate with byhour? HOT 3
- Question: Performance optimization when calculating occurrences using multiple rules HOT 3
- exRule and addRule conflict HOT 3
- More forgiving DTSTART behavior when using only date for UNTIL HOT 2
- Nested exrules HOT 2
- occursAt sometimes failing HOT 2
- Problem with getOccurrencesAfter HOT 9
- Removing all dates that are inside a DatePeriod from Rset HOT 1
- bi-weekly occurance wrong HOT 3
- dtstart vs. Repeat Dates / Current Time Not Considered in Calculation HOT 5
- humanreadable not so much HOT 2
- Looking for a way to add DTEND HOT 1
- Exrul not working
- Add alias methods for better reading of code HOT 1
- Legacy Code - Can I 'require_once' instead of composer ? HOT 2
- Danish translation file attached
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 php-rrule.