Object parameters should be type hinted 3

  • Minor
  • Bugrisk

More information: https://insight.sensiolabs.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. if (!$this->subject->exists) {
  2. $this->subject->prepareToAttachMedia($media, $this);
  3. $class = get_class($this->subject);
  4. $class::created(function ($model) {

    The parameter model, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Vyacheslav
  5. $model->processUnattachedMedia(function (Media $media, FileAdder $fileAdder) use ($model) {
  6. $this->processMediaItem($model, $media, $fileAdder);
  7. });
  8. });
  1. public function createDerivedFiles(Media $media, array $only = [], $onlyIfMissing = false)
  2. {
  3. $profileCollection = ConversionCollection::createForMedia($media);
  4. if (! empty($only)) {
  5. $profileCollection = $profileCollection->filter(function ($collection) use ($only) {

    The parameter collection, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by David Bonner
  6. return in_array($collection->getName(), $only);
  7. });
  8. }
  9. $this->performConversions(
in src/File.php, line 16
  1. public $size;
  2. /** @var string */
  3. public $mimeType;
  4. public static function createFromMedia($media)

    The parameter media, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by freek
  5. {
  6. return new static($media->file_name, $media->size, $media->mime_type);
  7. }
  8. public function __construct(string $name, int $size, string $mimeType)

Text files should end with a newline character 3

  • Info
  • Codestyle

More information: https://insight.sensiolabs.com/what-we-analyse/missing_e_o_l

in src/File.php, line 36
  1. {
  2. return "name: {$this->name}, size: {$this->size}, mime: {$this->mimeType}";
  3. }
  4. }

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by freek
  1. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  2. <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="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jZUlEPSJ4bXAuaWlkOjBhMGQ4YTBjLWZiOTQtNGUwZi1iN2M5LTc5ZjJlZDRhOTExNyIgc3RSZWY6ZG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOmY5YmJkMTdmLTFiNDctMTE3Yi1hNDU5LTg5ZmM0ODgxNDQ2ZCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/uAA5BZG9iZQBkwAAAAAH/2wCEAAgGBgYGBggGBggMCAcIDA4KCAgKDhANDQ4NDRARDA4NDQ4MEQ8SExQTEg8YGBoaGBgjIiIiIycnJycnJycnJycBCQgICQoJCwkJCw4LDQsOEQ4ODg4REw0NDg0NExgRDw8PDxEYFhcUFBQXFhoaGBgaGiEhICEhJycnJycnJycnJ//AABEIABUAIAMBIgACEQEDEQH/xABnAAABBAMAAAAAAAAAAAAAAAAAAQQGBwIDBQEAAwEAAAAAAAAAAAAAAAAAAAECAxAAAQMCBwEAAAAAAAAAAAAAAAECAwQFESExQRIyBhMRAQEAAgMAAAAAAAAAAAAAAAABQQJRgZH/2gAMAwEAAhEDEQA/AIjQ3Tg5MyXWz0DWYYuKwje5NB9DVyM0Uw20mExdNP6eNGdhrWeoZs4q1lymROymElwldq5SZreTrlR/M3px2AAvavC5iZgA4H//2Q==">
  4. </image>
  5. </svg>

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by freek
  1. {
  2. $this->singleFile = true;
  3. return $this;
  4. }
  5. }

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by freek