Code Monkey home page Code Monkey logo

php-manipulator's Introduction

php-manipulator's People

Contributors

fabpot avatar marcioalmada avatar schmittjoh avatar stephpy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-manipulator's Issues

Compatibility with PHP 5.3

The composer.json claims compatibility with PHP 5.3, but the code is not. In SimultaneousTokenAstStream for instance, there is a reference to T_TRAIT, which is only available in PHP 5.4+.

Missing token removal methods?

Hi Johannes,

I may be wrong, but token streams are mutable since they provide methods for token insertion. My problem is that I can't find any method for token removal. Is there a reason for that?

I could send a PR to implement such methods, but I prefer to ask if it's a good idea before. I'd like to have two new methods in the TokensStream class:

  • removeToken(AbstractToken $token)
  • removeConsecutiveTokens(AbstractToken $firstToken, AbstractToken $lastToken)

Tell me what you think!

More docs?

Where can I find a more complete documentation?

TokenStream silently omitting T_WHITESPACE

Token stream is not listing T_WHITESPACE:

$stream = new TokenStream();
$stream->setCode("<?php  class SomeClass\n{\n}");
while ($stream->moveNext())
    var_dump($stream->token->isWhitespace());

Output:

bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)

PHPUnit tests are all passing:

Configuration read from /.../jms/php-manipulator/phpunit.xml.dist

..............................S.....

Time: 173 ms, Memory: 8.00Mb

There was 1 skipped test:

1) JMS\PhpManipulator\Tests\TokenStreamTest::testOpenTag2

OK, but incomplete, skipped, or risky tests!
Tests: 36, Assertions: 86, Skipped: 1.

Tested on PHP 5.4.* and 5.5.*

Warning with AbstractToken::getIndentation

Hi,

I just noticed that sometimes, when token stream is not ignoring T_WHITESPACE $token->getStartColumn() is larger than $token->getLineIdentation() and this causes a warning (see here):

Warning: str_repeat(): Second argument has to be greater than or equal to 0 in
/home/marcio/Projetos/X-PHP/vendor/jms/php-manipulator/src/JMS/PhpManipulator
TokenStream/AbstractToken.php on line 218

Broken isFirstTokenOnLine when T_WHITESPACE

Bug occurs with streams using the following configuration:

$stream->setIgnoreWhitespace(false);

Now every T_WHITESPACE token in the stream returns false positive for:

$token->isFirstTokenOnLine(); // always true

As a side effect, methods that depend on token->previousToken are failing too:

$token->getIndentation(); // throws exception "None has no value"

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.